Search code examples
spring-integrationjms-topic

Spring Integration jmsmessage-driven-channel-adapter with IBM MQ


I have written code to read message from IBM MQ using Spring Integration JMS-message-driven-channel-adapter but not able to read message from queue can anybody help me out below is my configuration.

<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" />

Above configuration is working but failing when I added logging adapter its continously printing warning on console .Detail are mention below .

<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)

Solution

  • Sorry for delay. So, I guess your id="logger" is redundant component. And the problem is exactly with the <integration:wire-tap> and combination with the TraceChannelInterceptor.

    I mean that you use here Spring Cloud Sleuth.

    Would you mind sharing DEBUG for the org.springframework.integration category meanwhile I'm trying to reproduce an issue locally.

    Plus you can exclude componentInfologger from the tracing to avoid that java.lang.StackOverflowError.

    I think it happens somehow that we loop tracing via wire-tap.