Re: Routing keeping originalMessageId

2009-03-25 Thread Claus Ibsen
Hi

See also the section:Using JMSReplyTo for late replies
http://camel.apache.org/jms.html
eg. you need Camel 2.0 for that. But allows you to send an optional Reply.


On Tue, Mar 24, 2009 at 2:12 PM, N.D. nicolas_dufai...@hotmail.com wrote:

 Thanks for your quick reply.




 1)
 You can send a dummy NACK response when the client was not supposed to
 get a response



 I prefer do not use this solution to maintain proper separation between
 usable answers and error ones.
 Actually, clients have a result queue (that they supplied in replyTo) which
 is dedicated to real answer and an error queue in which my processor will
 push a roughly equivalent of your so-called NACK response.




 3)
 Who is overriding the correlation id? Is it the private broker or is
 it Camel itself?



 In fact, it's the message id of routed message which is overriden. To affect
 correlation id, my processor just a use a simple
 out.setJMSCorrelationId(in.getJMSMessageId()) statement.
 I didn't look deeply in camel internal gears but i assume routing is
 achieved by a jms consumer/producer couple, with jmscomponent configuration
 telling jms provider to generate id or not as message sent.




 2)
 Camel 2.0 have better support for InOptionalOut, so if possible try
 with 2.0. There is a 2.0m1 in the central maven repo.



 I'll try to play around this solution.
 I didn't before since my activemq version was packaged with a 1.X and 2.X
 assume a major api change.

 --
 View this message in context: 
 http://www.nabble.com/Routing-keeping-originalMessageId-tp22678749p22680104.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: Routing keeping originalMessageId

2009-03-25 Thread James Strachan
2009/3/24 N.D. nicolas_dufai...@hotmail.com:

 Thanks for your quick reply.




 1)
 You can send a dummy NACK response when the client was not supposed to
 get a response



 I prefer do not use this solution to maintain proper separation between
 usable answers and error ones.
 Actually, clients have a result queue (that they supplied in replyTo) which
 is dedicated to real answer and an error queue in which my processor will
 push a roughly equivalent of your so-called NACK response.




 3)
 Who is overriding the correlation id? Is it the private broker or is
 it Camel itself?



 In fact, it's the message id of routed message which is overriden. To affect
 correlation id, my processor just a use a simple
 out.setJMSCorrelationId(in.getJMSMessageId()) statement.
 I didn't look deeply in camel internal gears but i assume routing is
 achieved by a jms consumer/producer couple, with jmscomponent configuration
 telling jms provider to generate id or not as message sent.

This is a JMS spec thing; not something Camel can fix.

A JMS provider creates the JMSMessageId to be unique for a given JMS
provider. Camel doesn't set this header, nor can it.
http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Message.html#setJMSMessageID(java.lang.String)

The message ID is only set on a message after its sent - so its
typically not that useful as a correlation ID (its kinda too late :).

If you are sending more than one message you want to correlate or want
to perform correlation over multiple JMS providers you might want to
just create your own correlation IDs.

You could use Camel's UuidGenerator to make them for you if you like:
http://camel.apache.org/maven/camel-core/apidocs/org/apache/camel/util/UuidGenerator.html

-- 
James
---
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/


Routing keeping originalMessageId

2009-03-24 Thread N.D.

Hi,

I encoutered some problem deploying a bridge between 2 jms brokers via
spring:

On one hand i have a public access jms broker (currently activemq 5.2.0)
accepting connections from many clients, each one working with a name
standardized set of queues.

On the other hand, i have a private jms broker (same activemq for easier
testing but will change soon) with only a common set of queues listened by
my asynchronous processor.

I want to use a camel route to concentrate every clients queues to the ones
of my private jms broker.
JMS Messages exchange works as follows:

In some cases, input messages doesn't expect reply (no replyTo set - so
InOnly camel speaking)
In other cases, input messages expect a reply (replyTo set) but depending on
input message content and security configuration on processor, those one
could never reply to requester (i quess it falls into the InOptionalOut
scheme)

Here's my initial configuration:

?xml version=1.0 encoding=UTF-8?
beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:amq=http://activemq.apache.org/schema/core;
xmlns:cml=http://activemq.apache.org/camel/schema/spring;
xmlns=http://www.springframework.org/schema/beans;
xsi:schemaLocation=http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd

http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd

http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring-1.5.0.xsd;

!-- - - - - - - - - - - - - - - - - - - - --
!--  PUBLIC BROKER CONFIGURATION  --
!-- - - - - - - - - - - - - - - - - - - - --

!-- The public broker --
bean id=public class=org.apache.camel.component.jms.JmsComponent
property name=configuration
bean 
class=org.apache.camel.component.jms.JmsConfiguration
property name=connectionFactory
amq:connectionFactory 
brokerURL=failover:tcp://localhost:61616

userName=public

password=toto/
/property
/bean
/property
/bean

!-- The private broker --
bean id=private class=org.apache.camel.component.jms.JmsComponent
property name=configuration
bean 
class=org.apache.camel.component.jms.JmsConfiguration
property name=connectionFactory
amq:connectionFactory 
brokerURL=failover:tcp://localhost:61617

userName=private

password=titi/
/property
/bean
/property
/bean

!-- My routing configuration --
cml:camelContext id=router
cml:route
cml:from uri=public:*.queues.in.*/
cml:to uri=private:private-queues.in.0/
/cml:route
/cml:camelContext

/beans

My problem is that when replyTo is set, camel expect a reply on dynamically
created temp queue which may never came-back or very late (due to
asynchronous processing), so dead letter and time out often occurs. I tried
to add exchangePattern=InOptionalOut on queues without success.

So i disable camel replyTo (via the disableReplyTo property) and manually
handle it. Input message are so considered as InOnly and my processor
directly reply setting correlationID as input messageid.

However, routing override incomings messageId so i produce replies with
wrong correlation id as explainded here:

client push message in public broker
 - public broker affect ID=1
  - camel route it to private broker which override ID to 2
   - so my processor listening private broker handle message
with ID=2 (producing correlation ID=2 against 1 desired)

I tried to set messageIdEnabled to false on private but it does works (i saw
activemq 5.2.0 uses camel 1.5.0 which had a bug on messageID copy solved in
later version so i have customized my active mq to use 1.6.0 but wihout
success)

Can someone help me to solve my problem ?

Thanks,
Nicolas

-- 
View this message in context: 
http://www.nabble.com/Routing-keeping-originalMessageId-tp22678749p22678749.html
Sent from the Camel

Re: Routing keeping originalMessageId

2009-03-24 Thread Claus Ibsen
 works (i saw
 activemq 5.2.0 uses camel 1.5.0 which had a bug on messageID copy solved in
 later version so i have customized my active mq to use 1.6.0 but wihout
 success)

 Can someone help me to solve my problem ?

 Thanks,
 Nicolas

 --
 View this message in context: 
 http://www.nabble.com/Routing-keeping-originalMessageId-tp22678749p22678749.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/