【问题标题】:Send Custom Acknowledgement message to sender using jms:inbound-channel-adapter using spring integration使用 jms:inbound-channel-adapter 使用 spring 集成向发件人发送自定义确认消息
【发布时间】:2020-08-28 11:41:06
【问题描述】:

一旦消费者队列客户端使用 jms 入站通道适配器接收到服装消息,我想将其作为(收到的消息)发送到生产者队列客户端。需要帮助如何使用 xml 配置来实现此目的或任何替代方法。

XML 文件

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:jms="http://www.springframework.org/schema/integration/jms"
    xmlns:int-file="http://www.springframework.org/schema/integration/file"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
    xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" 
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
        http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd
        http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd   
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
        http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
        
    <context:component-scan base-package="com.fcb.incoming.wires" />
    
    <context:property-placeholder
        location="classpath:application-default.properties, classpath:application-${spring.profiles.active}.properties"
        ignore-unresolvable="true" />   
        
    <int:poller default="true" fixed-delay="${fcb.queue.poller.fixeddelay}"/>   
    
    <int:channel id="incomingWireChannel">
        <int:queue />
    </int:channel>
    <int:channel id="interWireChannel">
       <int:queue />
    </int:channel>
   <int:channel id="verifyWireChannel">
       <int:queue />
    </int:channel>   
     
     
     <jms:inbound-channel-adapter
        channel="incomingWireChannel" connection-factory="${fcb.queue.mq.connection.factory}"
        destination-name="${fcb.incoming.wires.req.queue}" acknowledge="client">
        <int:poller fixed-delay="${fcb.queue.poller.fixeddelay}" />
    </jms:inbound-channel-adapter> 
    
    <int:router input-channel="incomingWireChannel" ref="msgValidator" method="validate"  />    
    
    <bean id="msgValidator" class="com.fcb.incoming.wires.validate.MessageValidator">       
    </bean>

【问题讨论】:

    标签: java spring-boot spring-integration spring-jms


    【解决方案1】:

    使用outbound channel adapterinbound gateway

    Spring Integration 的消息驱动 JMS 入站网关委托给 MessageListener 容器,支持动态调整并发消费者,还可以处理回复。

    【讨论】:

    • 不清楚你有什么下游;你有一个路由器,它引用了一个验证器 bean(不管是什么)。网关下游的某些组件只需要返回一个回复,框架就会将其路由回网关。见the JMS Sample
    • 我已根据您的建议进行了更改 它工作正常,因为我从队列接收消息但不知道设置自定义消息并回复发件人
    猜你喜欢
    • 2014-07-23
    • 2017-04-28
    • 2015-07-08
    • 1970-01-01
    • 2014-02-21
    • 1970-01-01
    • 1970-01-01
    • 2021-03-17
    • 2017-01-13
    相关资源
    最近更新 更多