[ 
https://issues.apache.org/jira/browse/CAMEL-18791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-18791.
---------------------------------
    Resolution: Not A Bug

MDC is thread bound. If you receive JMS from another JVM or app, it has its own 
MDC stuff

> MDC logging not work after JMS Consumer
> ---------------------------------------
>
>                 Key: CAMEL-18791
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18791
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jms
>    Affects Versions: 3.18.3
>            Reporter: Alexander Domke
>            Priority: Minor
>
> The MDC logging in connection with the JMS component does not work properly. 
> Although MDC logging is switched on in the CamelContext and MDC logging has 
> been configured, the log file is not filled. During further tests I found out 
> that logging only works if the first JMS message is sent from the same 
> CamelContext.  Unfortunately, it is out of the question for us to change the 
> JMS component to synchronous operation.  I hope my hint helps you to fix the 
> component.
> *blueprint.xml*
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
> https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>                                http://camel.apache.org/schema/blueprint 
> http://camel.apache.org/schema/blueprint/camel-blueprint-3.18.2.xsd";>    
> <reference id="artemisCF" interface="javax.jms.ConnectionFactory" 
> filter="(osgi.jndi.service.name=artemis)" />    <bean id="jmsTxManager" 
> class="org.springframework.jms.connection.JmsTransactionManager">
>         <property name="connectionFactory" ref="artemisCF" />
>     </bean>    <bean id="PROPAGATION_REQUIRED" 
> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>         <property name="transactionManager" ref="jmsTxManager" />
>     </bean>    <bean id="jms" 
> class="org.apache.camel.component.jms.JmsComponent">
>         <property name="connectionFactory" ref="artemisCF" />
>         <property name="transactionManager" ref="jmsTxManager" />
>         <property name="transacted" value="false" />
>     </bean>
>         <camelContext id="testCamelContext" useMDCLogging="true" 
> autoStartup="true" xmlns="http://camel.apache.org/schema/blueprint";>        
> <!-- mdc logging works only if the send route in the same camel context! -->
>         <route id="send-to-queue">
>             <from uri="timer:TestTimer?repeatCount=1" />
>             <setBody>
>                 <constant>my message</constant>
>             </setBody>
>             <to uri="jms:queue:myqueue?connectionFactory=artemisCF" />
>         </route>
>         
>         <route id="read-from-queue">
>             <from uri="jms:queue:myqueue?concurrentConsumers=3" />            
> <transacted />            <to uri="mock:end" />
>         </route>
>     
> </blueprint> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to