Hello,
I issue an event from my command-service to RabbitMQ with @EventSourcingHandler
in my aggregate and the following configuration:
@Configuration
public class AmqpEventPublicationConfiguration {
@Value("${axon.amqp.exchange:undss.events}")
String exchangeName;
@Bean
public Exchange exchange(){
return ExchangeBuilder.fanoutExchange(exchangeName).build();
}
@Bean
public Queue queue(){
return QueueBuilder.durable(exchangeName).build();
}
@Bean
public Binding binding(Queue queue, Exchange exchange){
return BindingBuilder.bind(queue).to(exchange).with("*").noargs();
}
@Autowired
public void configure(AmqpAdmin amqpAdmin, Exchange exchange, Queue queue, Binding binding){
amqpAdmin.declareExchange(exchange);
amqpAdmin.declareQueue(queue);
amqpAdmin.declareBinding(binding);
}
}
I have a query-service with a listener that listens for messages and associates those messages to a processor with the @ProcessingGroup("amqpEvents")
annotation and the following configuration.
@Configuration
public class AmqpConfiguration {
@Bean
public SpringAMQPMessageSource complaintEventsMethod(AMQPMessageConverter messageConverter) {
return new SpringAMQPMessageSource(messageConverter) {
@RabbitListener(queues = "${axon.amqp.exchange}")
@Override
public void onMessage(Message message, Channel channel) {
super.onMessage(message, channel);
}
};
}
// Default all processors to subscribing mode.
@Autowired
public void configure(EventProcessingConfigurer config) {
config.usingSubscribingEventProcessors();
}
}
— application.yml
axon:
amqp:
exchange: undss.events
eventhandling:
processors:
amqpEvents:
source: complaintEventsMethod
mode: subscribing
I can see that it goes into this eventhandler
@EventHandler
public void on(GenericDomainEventMessage genericDomainEventMessage ) {
and not this one
@EventHandler
public void on(CreatedGroupEvent createdGroupEvent) {
What this means is that I am sending aggregate type (GenericDomainEventMessage
) events and not the type I would like (CreatedGroupEvent
).
How can I configure this to receive events of type CreatedGroupEvent
?
Thank you very much