【问题标题】:Spring Integration jmsmessage-driven-channel-adapter with IBM MQSpring Integration jmsmessage-driven-channel-adapter 与 IBM MQ
【发布时间】:2017-02-24 23:26:52
【问题描述】:

我已经编写了代码来使用 Spring Integration JMS-message-driven-channel-adapter 从 IBM MQ 读取消息,但无法从队列中读取消息,下面是我的配置。

<beans:bean id="ibmJmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <beans:property name="transportType" value="1"/>
    <beans:property name="queueManager" value="***"/>
    <beans:property name="hostName" value="**"/>
    <beans:property name="port" value="**" />
    <beans:property name="channel" value="***"/>
</beans:bean>


<beans:bean id="receiverQueue" class="com.ibm.mq.jms.MQQueue">
    <beans:constructor-arg index="0" value="****"/>
    <beans:constructor-arg index="1" value="****"/>
</beans:bean>
<integration:channel id="componentInfoChannel" />

 <jms:message-driven-channel-adapter
        id="componentInfoAdapter" connection-factory="ibmJmsConnectionFactory" destination="receiverQueue" channel="componentInfoChannel" 
         />

<integration:service-activator id="componentInfoActivator"
        input-channel="componentInfoChannel" ref="componentInfoConsumer"
        method="componentInfoListen" />

上面的配置正在运行,但是当我添加日志适配器时,它在控制台上持续打印警告失败。详细信息如下所述。

<integration:logging-channel-adapter
        id="componentInfologger" level="INFO" />
    <integration:wire-tap id="componentInfoWireTap"
        channel="componentInfologger" pattern="*" order="2" />
    <integration:logging-channel-adapter
        id="logger" log-full-message="true" level="INFO" />

   2017-02-23 00:09:05.093  WARN [componentdatafiles,48f69e84ab395754,ebf4ae7f3b812a01,false] 90072 --- [ter.container-1] o.s.j.l.DefaultMessageListenerContainer  :  Execution of JMS message listener failed, and no ErrorHandler has been set.
java.lang.StackOverflowError: null
    at java.util.Collections$SynchronizedMap.put(Unknown Source)
    at ch.qos.logback.classic.util.LogbackMDCAdapter.put(LogbackMDCAdapter.java:110)
    at org.slf4j.MDC.put(MDC.java:147)
    at org.springframework.cloud.sleuth.log.Slf4jSpanLogger.logStartedSpan(Slf4jSpanLogger.java:48)
    at org.springframework.cloud.sleuth.trace.DefaultTracer.createChild(DefaultTracer.java:170)
    at org.springframework.cloud.sleuth.trace.DefaultTracer.createSpan(DefaultTracer.java:72)
    at org.springframework.cloud.sleuth.instrument.messaging.TraceChannelInterceptor.startSpan(TraceChannelInterceptor.java:98)
    at org.springframework.cloud.sleuth.instrument.messaging.TraceChannelInterceptor.preSend(TraceChannelInterceptor.java:78)
    at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.preSend(AbstractMessageChannel.java:538)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:415)
    at org.springframework.integration.channel.interceptor.WireTap.preSend(WireTap.java:168)
    at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.preSend(AbstractMessageChannel.java:538)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:415)
    at org.springframework.integration.channel.interceptor.WireTap.preSend(WireTap.java:168)
    at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.preSend(AbstractMessageChannel.java:538)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:415)
    at org.springframework.integration.channel.interceptor.WireTap.preSend(WireTap.java:168)
    at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.preSend(AbstractMessageChannel.java:538)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:415)
    at org.springframework.integration.channel.interceptor.WireTap.preSend(WireTap.java:168)

【问题讨论】:

  • 您介意详细说明一下吗?什么是症状?问题看起来如何?您的配置中没有任何内容。请提供一些日志、StackTraces、测试用例等。
  • 编辑了我的问题,请查看

标签: spring-integration jms-topic


【解决方案1】:

抱歉耽搁了。所以,我猜你的 id="logger" 是多余的组件。而问题正是&lt;integration:wire-tap&gt;TraceChannelInterceptor 的组合。

我的意思是你在这里使用 Spring Cloud Sleuth。

您是否介意将DEBUG 分享给org.springframework.integration 类别,同时我正在尝试在本地重现问题。

另外,您可以从跟踪中排除 componentInfologger 以避免 java.lang.StackOverflowError

我认为我们通过 wire-tap 循环跟踪会以某种方式发生。

【讨论】:

  • 无操作。需要您提供简单的 Spring Boot 应用程序才能玩。我想它可能已经没有 JMS 了。看起来你的配置中有递归......
  • 感谢 Artem 得到了这个问题,这是由于重复的 id 记录器和 Logger 对象是从 LoggerFactory 在两个具有相同类名 ComponentInfoConsumer.class 的不同类中创建的。结束问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-07-21
  • 2017-07-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多