【问题标题】:Inserting messages in a JMS queue and then sending back the acknowledgement using Spring Integration在 JMS 队列中插入消息,然后使用 Spring Integration 发回确认
【发布时间】:2016-02-04 19:47:55
【问题描述】:

我有一项服务,它通过 http 入站适配器接收 xml 消息,然后将它们转换为文本,成为发送出去的电子邮件的内容。 我现在需要先将这些消息插入到 JMS 队列中,并在消息插入 Q 后将确认发送回 200 ok,然后继续进行其余处理。

  <int-http:inbound-channel-adapter channel="inputChannel" 
    id="httpInbound"  
    auto-startup="true" 
    request-payload-type="java.lang.String"
    path="/message"  
    supported-methods="POST" 
    error-channel="logger" >
    <int-http:request-mapping consumes="application/xml" />
</int-http:inbound-channel-adapter>


<int:chain id="chain" input-channel="inputChannel" >
 <int:service-activator ref="mailTransformerBean" method="transform" />
</int:chain>

服务激活器负责将 xml 转换为电子邮件的处理。

在此之前,我需要合并一个 JMS 队列,接收到的消息将被插入到该队列中,然后发送回确认。这是为了保留消息并在服务失败时重试。 我想将其设置为以 JMS 队列为端点的事务。 我该如何处理?

【问题讨论】:

    标签: jms spring-integration spring-jms


    【解决方案1】:

    如果您正在寻找类似in-process persistence storage 的东西,请查看SubscribableJmsChannel

    上面示例中的通道的行为与主 Spring Integration 命名空间中的普通 元素非常相似。它可以被任何端点的“输入通道”和“输出通道”属性引用。不同之处在于此通道由名为“exampleQueue”的 JMS 队列实例支持。

    【讨论】:

    • 感谢 Artem,这正是我所需要的!!
    猜你喜欢
    • 2015-07-08
    • 2020-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-20
    • 2020-04-05
    • 2022-12-01
    • 2014-09-16
    相关资源
    最近更新 更多