IntegrationFlow Amqp通道适配器在handle()中不起作用

时间:2019-12-07 18:45:41

标签: spring-integration spring-integration-dsl spring-integration-amqp

我正在研究两个RabbitMQ消息代理之间的集成流程。

我的IntegrationFlow代码是:

   @Bean
    public IntegrationFlow messageFlow() {
        return IntegrationFlows.from(stompInboundChannelAdapter())
                .transform(inBoundStompMsgTransformer::transform)
                .headerFilter("stomp_subscription","content-length")
                .handle(Amqp.outboundAdapter(outboundConfiguration.rabbitTemplate()))
                .log()
                .get();
    }

入站适配器代码为:

   @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;
    }

我正在收到消息。 消息正在转变。 但是,转换后的消息无法到达另一个RabbitMQ

rabbitTemplate代码为:

  @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;
    }

我的IntegrationFlow有什么问题?

谢谢

马西什

0 个答案:

没有答案