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