Hi everyone
I use Axon with Spring AMQP to write the events to a RabbitMQ and read from it.
I have the following configuration:
@Bean
TopicExchange exchange() {
return new TopicExchange("exchange");
}
@Bean
Queue queue() {
return new Queue("myQueue", true);
}
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with("#");
}
@Bean
public SpringAMQPMessageSource profileServiceSource(AMQPMessageConverter messageConverter) {
return new SpringAMQPMessageSource(messageConverter) {
@RabbitListener(queues = "myQueue")
@Override
public void onMessage(Message message, Channel channel) {
super.onMessage(message, channel);
}
};
}
The problem is, at application startup, the RabbitListener runs before the eventProcessors have subscribed to the SpringAMQPMessageSource. As a result, the first events after startup are simply ignored.
I suspect this is a bug in my configuration.
Does anyone have any ideas what this could be??