Axon 3.0.5 to Axon 3.3.2 migration - @EventHnadler not triggering

Hi,

When I am migrating my project from Axon 3.0.5 to Axon 3.3.2 , there are few modules not calling @Event handler on AMQP messages . My configuration is follow

AMQP configuration class

It is working by giving different processing group for two modules

Hi Arun,

I might misinterpret your last response here, so correct me if I am wrong, but can I assume you’ve solved the issue you had?

Nonetheless, I think you should change the source of your ECOM_EVENT_PROCESSOR.

It is now set to the eventBus, whilst it seems you want the source to be your Rabbit queue…

Hope this helps you out Arun.

Cheers,

Steven

Steven,

Running into the same issue myself. This is what my query side config looks like

axon: amqp: exchange: account.events.exchange transaction-mode: transactional serializer: general: jackson eventhandling: processors: ProductViewEventHandler: mode: tracking source: eventBus

Can you ellaborate on setting the source to rabbit queue vs eventbus. Isin’t the event bus configured to be the rabbit queue? I’m new to this so might be missing somethign here.

Thanks!
/pankesh

Hi Pankesh,

The axon.eventhandling.processors.{processing-group-name}.source is the setting that specifies from which place an Event Processor will receive it’s events.

If you are publishing events in an AMQP queue, then that queue can be regarded as a form of Event Bus.

It is however not the Event Bus in the same manor as when you’d have a default Axon application with stores, publishes and handles the events itself.
You should regard the AMQP approach to sending events from one service to another more as a fire and forget solution rather than a persistent approach.

Any how, in the configuration example you give, you have set the source of events for the ProductViewEventHandler to be the ‘EventBus’.

That means it’ll only receive events which have been published, stored (if you’re storing your events that is) and handled within that exact node itself.

If you want the source of its events to be an AMQP queue, you should change the ‘source’ field to the bean name of your queue.

I hope this sheds some light on the problem.

Cheers,
Steven

Thanks for the detailed response Steven. It makes sense now.

I was able to get this working by making the following changes (documenting here for others)

axon: amqp: exchange: account.events.exchange transaction-mode: transactional serializer: general: jackson eventhandling: processors: accountQueryHandler: source: accountMessageQueue

Inside of the configuration class on the query side i have the following

`
@Bean
public SpringAMQPMessageSource accountMessageQueue(AMQPMessageConverter messageConverter) {
SpringAMQPMessageSource springAMQPMessageSource = new SpringAMQPMessageSource(messageConverter) {

@RabbitListener(queues = “#{uniqueQueueName}”)
@Override
public void onMessage(Message message, Channel channel) {
super.onMessage(message, channel);
}
};

return springAMQPMessageSource;
}
`

…and this is what my eventHandler looked like

`
@Component
@ProcessingGroup(“accountQueryHandler”)
public class AccountViewEventHandler {

private static final Logger LOG = LoggerFactory.getLogger(AccountViewEventHandler.class);

@Autowired
private AccountRepository accountRepository;

@EventHandler
public void handle(AccountTierAddedEvent event) {
LOG.info(“AccountTierAddedEvent: [{}] ‘{}’”, event.getId(), event.getName(), event.getTier());
accountRepository.save(new Account(event.getId(), event.getName(), event.getTier(), false));
}

`

Cheers!
/pankesh