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

Alexander Domke updated CAMEL-18791:
------------------------------------
    Description: 
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" />
        </route>
        
        <route id="read-from-queue">
            <from uri="jms:queue:myqueue?concurrentConsumers=3" />            
<transacted />            <to uri="mock:end" />
        </route>
    
</blueprint> {code}
 
 
 

 

  was:
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?concurrentConsumers=3" />
        </route>
        
        <route id="read-from-queue">
            <from uri="jms:queue:myqueue?concurrentConsumers=3" />            
<transacted />            <to uri="mock:end" />
        </route>
    
</blueprint> {code}


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