You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by greg_le_bonniec <ke...@yahoo.fr> on 2009/03/08 16:24:48 UTC
JMS correlation id lost
Hi,
I have created the following JMS SU which receives a message on a queue
(consumer) and send this message on another queue (provider). Everything is
OK except the fact that correlation id is lost. is it normal ? how can i
resolve that point ?
Thank you
Greg
--
View this message in context: http://www.nabble.com/JMS-correlation-id-lost-tp22399097p22399097.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: JMS correlation id lost
Posted by greg_le_bonniec <ke...@yahoo.fr>.
Hi,
I agree. In fact, I was expected that JMS properties would be copied in
message properties.
Thank you for your help...I am waiting for your reply ;-)
Regards,
Greg
jb-58 wrote:
>
> Hi Greg,
>
> the consumer takes the JMS and marshal it into a NMR as a
> NormalizedMessage. As the provider does the same (it unmarshals the
> NormalizedMessage coming from the NMR), a new JMS message is created.
> As a new JMS message is created, a new ID is set. I think that we can
> avoid this behavior using message properties.
>
> I'm going to check in the servicemix-jms component source code.
>
> Keep you posted.
>
> Regards
> JB
>
> On Sunday 08 March 2009 - 08:24, greg_le_bonniec wrote:
>>
>> Hi,
>>
>> I have created the following JMS SU which receives a message on a queue
>> (consumer) and send this message on another queue (provider). Everything
>> is
>> OK except the fact that correlation id is lost. is it normal ? how can i
>> resolve that point ?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Thank you
>>
>> Greg
>> --
>> View this message in context:
>> http://www.nabble.com/JMS-correlation-id-lost-tp22399097p22399097.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
> --
> Jean-Baptiste Onofré
> ---------------------------------
> HomePage
> http://www.nanthrax.net
> ---------------------------------
> Contacts
> jbonofre@apache.org
> jb@nanthrax.net
> ---------------------------------
> OpenSource
> BuildProcess/AutoDeploy
> http://buildprocess.sourceforge.net
> Apache ServiceMix
> http://servicemix.apache.org
> -----------------------------------
> PGP : 17D4F086
>
>
--
View this message in context: http://www.nabble.com/JMS-correlation-id-lost-tp22399097p22401928.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: JMS correlation id lost
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Greg,
the consumer takes the JMS and marshal it into a NMR as a NormalizedMessage. As the provider does the same (it unmarshals the NormalizedMessage coming from the NMR), a new JMS message is created.
As a new JMS message is created, a new ID is set. I think that we can avoid this behavior using message properties.
I'm going to check in the servicemix-jms component source code.
Keep you posted.
Regards
JB
On Sunday 08 March 2009 - 08:24, greg_le_bonniec wrote:
>
> Hi,
>
> I have created the following JMS SU which receives a message on a queue
> (consumer) and send this message on another queue (provider). Everything is
> OK except the fact that correlation id is lost. is it normal ? how can i
> resolve that point ?
>
>
>
>
>
>
>
>
>
>
>
> Thank you
>
> Greg
> --
> View this message in context: http://www.nabble.com/JMS-correlation-id-lost-tp22399097p22399097.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
--
Jean-Baptiste Onofré
---------------------------------
HomePage
http://www.nanthrax.net
---------------------------------
Contacts
jbonofre@apache.org
jb@nanthrax.net
---------------------------------
OpenSource
BuildProcess/AutoDeploy
http://buildprocess.sourceforge.net
Apache ServiceMix
http://servicemix.apache.org
-----------------------------------
PGP : 17D4F086
Re: JMS correlation id lost
Posted by greg_le_bonniec <ke...@yahoo.fr>.
Gert,
Thank you for your reply. I have followed your advice and everything is
working now.
Solution :
<<<<<<<<<<<xbean.xml>>>>>>>>>>>>>>>>>>
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
xmlns:zen="http://www.zenika.com">
<jms:consumer service="zen:ConsumerRequeteReservationService"
endpoint="reader"
targetService="zen:ProviderRequeteReservationService"
targetEndpoint="writer"
destinationName="reservation/requete/in"
connectionFactory="#connectionFactory"
marshaler="#marshalerConsumer"
/>
<jms:provider service="zen:ProviderRequeteReservationService"
endpoint="writer"
destinationName="reservation/requete/out"
connectionFactory="#connectionFactory"
messageIdEnabled="false"
marshaler="#marshalerProvider"
/>
<bean id="marshalerConsumer"
class="com.zenika.servicemix.jms.CorrelationConsumerMarshaler" />
<bean id="marshalerProvider"
class="com.zenika.servicemix.jms.CorrelationProviderMarshaler" />
<bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
</beans>
<<<<<<<<<<<correlation consumer>>>>>>>>>>>>>>>>>>
package com.zenika.servicemix.jms;
import javax.jms.TextMessage;
import javax.xml.transform.Source;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler;
public class CorrelationConsumerMarshaler extends DefaultConsumerMarshaler {
protected void populateMessage(javax.jms.Message message,
javax.jbi.messaging.NormalizedMessage normalizedMessage)
throws java.lang.Exception {
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
Source source = new StringSource(textMessage.getText());
normalizedMessage.setContent(source);
normalizedMessage.setProperty("correlationId", textMessage
.getJMSCorrelationID());
} else {
throw new UnsupportedOperationException(
"JMS message is not a TextMessage");
}
}
}
<<<<<<<<<<<correlation provider>>>>>>>>>>>>>>>>>>
package com.zenika.servicemix.jms;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.NormalizedMessage;
import javax.jms.Message;
import javax.jms.Session;
import org.apache.servicemix.jms.endpoints.DefaultProviderMarshaler;
public class CorrelationProviderMarshaler extends DefaultProviderMarshaler {
public Message createMessage(MessageExchange exchange,
NormalizedMessage in, Session session) throws Exception {
Message message = super.createMessage(exchange, in, session);
message.setJMSCorrelationID(in.getProperty("correlationId").toString());
return message;
}
}
Gert Vanthienen wrote:
>
> Greg,
>
> The DefautlConsumerMarshaler doesn't send these properties along, but
> you could create you own copy that does send it along.
>
> However, if you configure the DefaultConsumerMarshaler with an InOut
> MEP, the JMS consumer endpoint will send an InOut MessageExchange into
> the ESB. Configuring a replyDestination on the JMS consumer endpoint
> will send the reponse to that destination. In this scenario, the
> correlation ID from the request JMS message will be set on the reply
> JMS message.
>
> Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
>
> 2009/3/8 greg_le_bonniec <ke...@yahoo.fr>:
>>
>> Hi,
>>
>> I have created the following JMS SU which receives a message on a queue
>> (consumer) and send this message on another queue (provider). Everything
>> is
>> OK except the fact that correlation id is lost. is it normal ? how can i
>> resolve that point ?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Thank you
>>
>> Greg
>> --
>> View this message in context:
>> http://www.nabble.com/JMS-correlation-id-lost-tp22399097p22399097.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>
>
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
>
--
View this message in context: http://www.nabble.com/JMS-correlation-id-lost-tp22399097p22404938.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: JMS correlation id lost
Posted by Gert Vanthienen <ge...@gmail.com>.
Greg,
The DefautlConsumerMarshaler doesn't send these properties along, but
you could create you own copy that does send it along.
However, if you configure the DefaultConsumerMarshaler with an InOut
MEP, the JMS consumer endpoint will send an InOut MessageExchange into
the ESB. Configuring a replyDestination on the JMS consumer endpoint
will send the reponse to that destination. In this scenario, the
correlation ID from the request JMS message will be set on the reply
JMS message.
Regards,
Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/
2009/3/8 greg_le_bonniec <ke...@yahoo.fr>:
>
> Hi,
>
> I have created the following JMS SU which receives a message on a queue
> (consumer) and send this message on another queue (provider). Everything is
> OK except the fact that correlation id is lost. is it normal ? how can i
> resolve that point ?
>
>
>
>
>
>
>
>
>
>
>
> Thank you
>
> Greg
> --
> View this message in context: http://www.nabble.com/JMS-correlation-id-lost-tp22399097p22399097.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>