Axon4 - 卡夫卡分机:查询事件不会调用

问题描述 投票:0回答:1

命令端事件越来越处理,但查询(投影仪)不会被调用。使用轴突卡夫卡延伸4.0-RC2。

请检查下面的代码参考。

AxonConfig

import org.springframework.context.annotation.Configuration;

@Configuration
public class AxonConfig {


}

application.yml

server:
  port: 9001
spring:
  application:
    name: Query Application
  datasource:
    url: jdbc:postgresql://localhost:5441/orderdemo
    username: orderdemo
    password: secret
    driver-class-name: org.postgresql.Driver
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.PostgreSQL95Dialect
        jdbc:
          lob:
            non_contextual_creation: true
        hbm2ddl.auto: update
        implicit_naming_strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
        physical_naming_strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy    

axon:
  eventhandling:
    processors:
      query:
        mode: tracking
        source: kafkaMessageSource
  kafka:
    default-topic: axon-events
    consumer:
      group-id: query-group
      bootstrap-servers: localhost:9092
apache-kafka axon
1个回答
2
投票

对于这种配置工作,其中包含要被称为从卡夫卡处理事件@EventHandler注释功能的类,必须在处理组query的一部分。

从你所选择的配置模式,其中“轴突。eventhandling.processors.query”定义了处理组要配置这个要求如下。要指定处理组,我认为最简单的方法是将@ProcessingGroup注释添加到您的事件处理类。在注释中,你必须提供加工集团,这需要与你设置什么诠释他的配置文件对应的名称。

最后,我建议使用一个不同的名称query为您处理小组。一些更具体的查询模型,事件处理程序的更新似乎更到位给我。

希望这可以帮助!

© www.soinside.com 2019 - 2024. All rights reserved.