Hi All,
In my application, I’m trying to make a Saga to handle a message from AMQP.
But unfortunately, I found that it works fine if I annotate a @ProcessGroup(“order”) on a normal bean containing methods with @EventHandler, but if I cut the same annotation to a Saga, it’s not working.
I’ve already define the mapping in the application.property.
axon.amqp.exchange=Axon.EventBus
axon.eventhandling.processors.order.source=queueMessageSource
@Configuration
public class AMQPConfiguration {
private static final Logger LOGGER = getLogger(AMQPConfiguration.class);
@Value("${axon.amqp.exchange}")
private String exchangeName;
@Bean
public Queue queue(){
return new Queue("orderqueue", true);
}
@Bean
public Exchange exchange(){
return ExchangeBuilder.fanoutExchange(exchangeName).durable(true).build();
}
@Bean
public Binding queueBinding() {
return BindingBuilder.bind(queue()).to(exchange()).with("").noargs();
}
@Bean
public SpringAMQPMessageSource queueMessageSource(Serializer serializer){
return new SpringAMQPMessageSource(serializer){
@RabbitListener(queues = "orderqueue")
@Override
public void onMessage(Message message, Channel channel) throws Exception {
LOGGER.debug("Message received: "+message.toString());
super.onMessage(message, channel);
}
};
}
}
The Saga class is not subscribing to SpringAMQPMessageSource. So the message will be ignored.
Is Axon not supporting saga to accept amqp message in this way, or I’m not doing the right way?
What’s the proper way if I want Saga to handle the message from mq?