I am working on the integration flow between two RabbitMQ message brokers.
My IntegrationFlow code is:
@Bean
public IntegrationFlow messageFlow() {
return IntegrationFlows.from(stompInboundChannelAdapter())
.transform(inBoundStompMsgTransformer::transform)
.headerFilter("stomp_subscription","content-length")
.handle(Amqp.outboundAdapter(outboundConfiguration.rabbitTemplate()))
.log()
.get();
}
Inbound Adapter code is:
@Bean
public MessageChannel stompInputChannel() {
return new DirectChannel();
}
@Bean
public StompInboundChannelAdapter stompInboundChannelAdapter() {
StompInboundChannelAdapter adapter = new StompInboundChannelAdapter(stompSessionManager(), "/queue/myQueue");
adapter.setOutputChannel(stompInputChannel());
adapter.setPayloadType(ByteString.class);
return adapter;
}
I am getting messages. The messages are getting transformed. However, the transformed messages are not reaching the other RabbitMQ
The rabbitTemplate code is:
@Bean
Binding binding(Queue queue, DirectExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(routingkey);
}
@Bean
public ConnectionFactory connectionFactory() {
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(host);
cachingConnectionFactory.setUsername(username);
cachingConnectionFactory.setUsername(password);
return cachingConnectionFactory;
}
@Bean
public AmqpTemplate rabbitTemplate() {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory());
rabbitTemplate.setExchange(exchange);
rabbitTemplate.setRoutingKey(routingkey);
return rabbitTemplate;
}
What is wrong with my IntegrationFlow?
Thanks,
Mahesh
.log
after an outbound adapter - there's no reply message); try setting a breakpoint in template.doSend() and check that the exchange and routing key are correct; also check the binding is correct on the admin UI. If you can't figure it out, post your project someplace and I'll take a look. – Gary RussellExpressingEvaluatingRequestHandlerAdvice
on the outbound AMQP endpoint to be sure what exception you get: docs.spring.io/spring-integration/docs/5.2.2.RELEASE/reference/…? – Artem Bilan