You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kumaap <am...@gmail.com> on 2011/04/13 16:23:48 UTC

Custom Exchange ID

Hi ,

I'm using camel 2.4 and we have a need to create unique ids for every
message going through our routes, We were looking at using the Exchange ID
but its in a different format than our requirement is it possible to
override the Exchange id generation class. Our routes are xml format and are
dynamically loaded.


Cheers
Amitesh

--
View this message in context: http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300720.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Custom Exchange ID

Posted by Claus Ibsen <cl...@gmail.com>.
Okay found this JIRA ticket who introduced the behavior in JmsMessage
https://issues.apache.org/jira/browse/CAMEL-1375


-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Custom Exchange ID

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Apr 14, 2011 at 10:04 AM, Willem Jiang <wi...@gmail.com> wrote:
> Hi Claus,
>
> I know there are two different ID and I'm +1 for removing the JmsMessage id
> overriding. I will update the JIRA title for it.
>

Okay talked to James. He can't remember the good reason for that. So
we are +1 for your change.
Then the exchange id is always generated by default exchange and thus
it uses the pluggable api, so end user can use a custom generate if
they want.


>
> Willem
>
>
> On 4/14/11 3:45 PM, Claus Ibsen wrote:
>>
>> Willem its 2 different ids
>>
>> Although the camel-jms component indeed favors using the JMSMessageID
>> (if possible) in the createExchangeId method it overrides in the
>> JmsMessage.
>>
>> But its still 2 different ids
>> - exchange id
>> - message id
>>
>> But that said, I don't think we should add bluntly more features and
>> bells just because a single person want to use his custom ids in an
>> old Camel release (Camel 2.4). That person has the source code and can
>> adjust the code however he likes.
>>
>> Frankly we may even consider removing the JmsMessage override, and
>> always let it use the id generated by default exchange. Then its
>> consistent.
>>
>> I will try to ping James if he sees a good point of the reason of the
>> current behavior.
>>
>>
>> On Thu, Apr 14, 2011 at 9:27 AM, Willem Jiang<wi...@gmail.com>
>>  wrote:
>>>
>>> Hi Claus,
>>>
>>> I dug the code of DefaultExchange and found below lines in
>>> DefaultExchange
>>>
>>>    protected String createExchangeId() {
>>>        String answer = null;
>>>        if (in != null) {
>>>            answer = in.createExchangeId();
>>>        }
>>>        if (answer == null) {
>>>            answer = context.getUuidGenerator().generateUuid();
>>>        }
>>>        return answer;
>>>    }
>>>
>>>  From the code you can see the ExchangeId is decided by the in message
>>> first,
>>> and in the JMSMessage there is no way to inject the ExchangeId by the
>>> pluggable API. That is way I create a JIRA for it.
>>>
>>>
>>> Willem
>>>
>>> On 4/14/11 1:19 PM, Claus Ibsen wrote:
>>>>
>>>> On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiang<wi...@gmail.com>
>>>>  wrote:
>>>>>
>>>>> Yes, it's hard to change unless you extends the JMS component and
>>>>> override
>>>>> this method.
>>>>>
>>>>> I just created a JIRA CAMEL-3859[1] for it.
>>>>>
>>>>> [1]https://issues.apache.org/jira/browse/CAMEL-3859
>>>>>
>>>>
>>>> No thats not necessary. There are 2 id's
>>>> - exchange
>>>> - message id
>>>>
>>>> And he want to assign custom exchange id. Which is easier to do in
>>>> Camel 2.5 as there is a pluggable API for that.
>>>>
>>>> The message id is part of the message, and since that message is JMS,
>>>> the message id is the JMSMessageID.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Willem
>>>>>
>>>>> On 4/13/11 11:46 PM, kumaap wrote:
>>>>>>
>>>>>> Hi thanks for that .. but theres another issue we consuming messages
>>>>>> off
>>>>>> multiple JMS  providers
>>>>>>
>>>>>> Camel 2.5 JmsMessage class
>>>>>>
>>>>>> @Override
>>>>>>     protected String createMessageId() {
>>>>>>         if (jmsMessage == null) {
>>>>>>             if (LOG.isTraceEnabled()) {
>>>>>>                 LOG.trace("No javax.jms.Message set so generating a
>>>>>> new
>>>>>> message id");
>>>>>>             }
>>>>>>             return super.createMessageId();
>>>>>>         }
>>>>>>         try {
>>>>>>             String id =
>>>>>> getDestinationAsString(jmsMessage.getJMSDestination()) +
>>>>>> jmsMessage.getJMSMessageID();
>>>>>>             return getSanitizedString(id);
>>>>>>         } catch (JMSException e) {
>>>>>>             throw new RuntimeExchangeException("Unable to retrieve
>>>>>> JMSMessageID from JMS Message", getExchange(), e);
>>>>>>         }
>>>>>>     }
>>>>>>
>>>>>> It will always use the JMS qualifiers , its hardly ever the case that
>>>>>> JMS
>>>>>> messages have a null JMSMessageID. Is there a way to override this ?
>>>>>>
>>>>>> Cheers in advance
>>>>>> kumaap0
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>>
>>>>>>
>>>>>> http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Willem
>>>>> ----------------------------------
>>>>> FuseSource
>>>>> Web: http://www.fusesource.com
>>>>> Blog:    http://willemjiang.blogspot.com (English)
>>>>>         http://jnn.javaeye.com (Chinese)
>>>>> Twitter: willemjiang
>>>>>
>>>>> Connect at CamelOne May 24-26
>>>>> The Open Source Integration Conference
>>>>> http://camelone.com
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Willem
>>> ----------------------------------
>>> FuseSource
>>> Web: http://www.fusesource.com
>>> Blog:    http://willemjiang.blogspot.com (English)
>>>         http://jnn.javaeye.com (Chinese)
>>> Twitter: willemjiang
>>>
>>> Connect at CamelOne May 24-26
>>> The Open Source Integration Conference
>>> http://camelone.com
>>>
>>
>>
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
>
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
> http://camelone.com
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Custom Exchange ID

Posted by Willem Jiang <wi...@gmail.com>.
Hi Claus,

I know there are two different ID and I'm +1 for removing the JmsMessage 
id overriding. I will update the JIRA title for it.


Willem


On 4/14/11 3:45 PM, Claus Ibsen wrote:
> Willem its 2 different ids
>
> Although the camel-jms component indeed favors using the JMSMessageID
> (if possible) in the createExchangeId method it overrides in the
> JmsMessage.
>
> But its still 2 different ids
> - exchange id
> - message id
>
> But that said, I don't think we should add bluntly more features and
> bells just because a single person want to use his custom ids in an
> old Camel release (Camel 2.4). That person has the source code and can
> adjust the code however he likes.
>
> Frankly we may even consider removing the JmsMessage override, and
> always let it use the id generated by default exchange. Then its
> consistent.
>
> I will try to ping James if he sees a good point of the reason of the
> current behavior.
>
>
> On Thu, Apr 14, 2011 at 9:27 AM, Willem Jiang<wi...@gmail.com>  wrote:
>> Hi Claus,
>>
>> I dug the code of DefaultExchange and found below lines in DefaultExchange
>>
>>     protected String createExchangeId() {
>>         String answer = null;
>>         if (in != null) {
>>             answer = in.createExchangeId();
>>         }
>>         if (answer == null) {
>>             answer = context.getUuidGenerator().generateUuid();
>>         }
>>         return answer;
>>     }
>>
>>  From the code you can see the ExchangeId is decided by the in message first,
>> and in the JMSMessage there is no way to inject the ExchangeId by the
>> pluggable API. That is way I create a JIRA for it.
>>
>>
>> Willem
>>
>> On 4/14/11 1:19 PM, Claus Ibsen wrote:
>>>
>>> On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiang<wi...@gmail.com>
>>>   wrote:
>>>>
>>>> Yes, it's hard to change unless you extends the JMS component and
>>>> override
>>>> this method.
>>>>
>>>> I just created a JIRA CAMEL-3859[1] for it.
>>>>
>>>> [1]https://issues.apache.org/jira/browse/CAMEL-3859
>>>>
>>>
>>> No thats not necessary. There are 2 id's
>>> - exchange
>>> - message id
>>>
>>> And he want to assign custom exchange id. Which is easier to do in
>>> Camel 2.5 as there is a pluggable API for that.
>>>
>>> The message id is part of the message, and since that message is JMS,
>>> the message id is the JMSMessageID.
>>>
>>>
>>>
>>>
>>>
>>>> Willem
>>>>
>>>> On 4/13/11 11:46 PM, kumaap wrote:
>>>>>
>>>>> Hi thanks for that .. but theres another issue we consuming messages off
>>>>> multiple JMS  providers
>>>>>
>>>>> Camel 2.5 JmsMessage class
>>>>>
>>>>> @Override
>>>>>      protected String createMessageId() {
>>>>>          if (jmsMessage == null) {
>>>>>              if (LOG.isTraceEnabled()) {
>>>>>                  LOG.trace("No javax.jms.Message set so generating a new
>>>>> message id");
>>>>>              }
>>>>>              return super.createMessageId();
>>>>>          }
>>>>>          try {
>>>>>              String id =
>>>>> getDestinationAsString(jmsMessage.getJMSDestination()) +
>>>>> jmsMessage.getJMSMessageID();
>>>>>              return getSanitizedString(id);
>>>>>          } catch (JMSException e) {
>>>>>              throw new RuntimeExchangeException("Unable to retrieve
>>>>> JMSMessageID from JMS Message", getExchange(), e);
>>>>>          }
>>>>>      }
>>>>>
>>>>> It will always use the JMS qualifiers , its hardly ever the case that
>>>>> JMS
>>>>> messages have a null JMSMessageID. Is there a way to override this ?
>>>>>
>>>>> Cheers in advance
>>>>> kumaap0
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>>
>>>>> http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>> --
>>>> Willem
>>>> ----------------------------------
>>>> FuseSource
>>>> Web: http://www.fusesource.com
>>>> Blog:    http://willemjiang.blogspot.com (English)
>>>>          http://jnn.javaeye.com (Chinese)
>>>> Twitter: willemjiang
>>>>
>>>> Connect at CamelOne May 24-26
>>>> The Open Source Integration Conference
>>>> http://camelone.com
>>>>
>>>
>>>
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>          http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>>
>> Connect at CamelOne May 24-26
>> The Open Source Integration Conference
>> http://camelone.com
>>
>
>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com

Re: Custom Exchange ID

Posted by Claus Ibsen <cl...@gmail.com>.
Willem its 2 different ids

Although the camel-jms component indeed favors using the JMSMessageID
(if possible) in the createExchangeId method it overrides in the
JmsMessage.

But its still 2 different ids
- exchange id
- message id

But that said, I don't think we should add bluntly more features and
bells just because a single person want to use his custom ids in an
old Camel release (Camel 2.4). That person has the source code and can
adjust the code however he likes.

Frankly we may even consider removing the JmsMessage override, and
always let it use the id generated by default exchange. Then its
consistent.

I will try to ping James if he sees a good point of the reason of the
current behavior.


On Thu, Apr 14, 2011 at 9:27 AM, Willem Jiang <wi...@gmail.com> wrote:
> Hi Claus,
>
> I dug the code of DefaultExchange and found below lines in DefaultExchange
>
>    protected String createExchangeId() {
>        String answer = null;
>        if (in != null) {
>            answer = in.createExchangeId();
>        }
>        if (answer == null) {
>            answer = context.getUuidGenerator().generateUuid();
>        }
>        return answer;
>    }
>
> From the code you can see the ExchangeId is decided by the in message first,
> and in the JMSMessage there is no way to inject the ExchangeId by the
> pluggable API. That is way I create a JIRA for it.
>
>
> Willem
>
> On 4/14/11 1:19 PM, Claus Ibsen wrote:
>>
>> On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiang<wi...@gmail.com>
>>  wrote:
>>>
>>> Yes, it's hard to change unless you extends the JMS component and
>>> override
>>> this method.
>>>
>>> I just created a JIRA CAMEL-3859[1] for it.
>>>
>>> [1]https://issues.apache.org/jira/browse/CAMEL-3859
>>>
>>
>> No thats not necessary. There are 2 id's
>> - exchange
>> - message id
>>
>> And he want to assign custom exchange id. Which is easier to do in
>> Camel 2.5 as there is a pluggable API for that.
>>
>> The message id is part of the message, and since that message is JMS,
>> the message id is the JMSMessageID.
>>
>>
>>
>>
>>
>>> Willem
>>>
>>> On 4/13/11 11:46 PM, kumaap wrote:
>>>>
>>>> Hi thanks for that .. but theres another issue we consuming messages off
>>>> multiple JMS  providers
>>>>
>>>> Camel 2.5 JmsMessage class
>>>>
>>>> @Override
>>>>     protected String createMessageId() {
>>>>         if (jmsMessage == null) {
>>>>             if (LOG.isTraceEnabled()) {
>>>>                 LOG.trace("No javax.jms.Message set so generating a new
>>>> message id");
>>>>             }
>>>>             return super.createMessageId();
>>>>         }
>>>>         try {
>>>>             String id =
>>>> getDestinationAsString(jmsMessage.getJMSDestination()) +
>>>> jmsMessage.getJMSMessageID();
>>>>             return getSanitizedString(id);
>>>>         } catch (JMSException e) {
>>>>             throw new RuntimeExchangeException("Unable to retrieve
>>>> JMSMessageID from JMS Message", getExchange(), e);
>>>>         }
>>>>     }
>>>>
>>>> It will always use the JMS qualifiers , its hardly ever the case that
>>>> JMS
>>>> messages have a null JMSMessageID. Is there a way to override this ?
>>>>
>>>> Cheers in advance
>>>> kumaap0
>>>>
>>>> --
>>>> View this message in context:
>>>>
>>>> http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>> --
>>> Willem
>>> ----------------------------------
>>> FuseSource
>>> Web: http://www.fusesource.com
>>> Blog:    http://willemjiang.blogspot.com (English)
>>>         http://jnn.javaeye.com (Chinese)
>>> Twitter: willemjiang
>>>
>>> Connect at CamelOne May 24-26
>>> The Open Source Integration Conference
>>> http://camelone.com
>>>
>>
>>
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
>
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
> http://camelone.com
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Custom Exchange ID

Posted by Willem Jiang <wi...@gmail.com>.
Hi Claus,

I dug the code of DefaultExchange and found below lines in DefaultExchange

     protected String createExchangeId() {
         String answer = null;
         if (in != null) {
             answer = in.createExchangeId();
         }
         if (answer == null) {
             answer = context.getUuidGenerator().generateUuid();
         }
         return answer;
     }

 From the code you can see the ExchangeId is decided by the in message 
first, and in the JMSMessage there is no way to inject the ExchangeId by 
the pluggable API. That is way I create a JIRA for it.


Willem

On 4/14/11 1:19 PM, Claus Ibsen wrote:
> On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiang<wi...@gmail.com>  wrote:
>> Yes, it's hard to change unless you extends the JMS component and override
>> this method.
>>
>> I just created a JIRA CAMEL-3859[1] for it.
>>
>> [1]https://issues.apache.org/jira/browse/CAMEL-3859
>>
>
> No thats not necessary. There are 2 id's
> - exchange
> - message id
>
> And he want to assign custom exchange id. Which is easier to do in
> Camel 2.5 as there is a pluggable API for that.
>
> The message id is part of the message, and since that message is JMS,
> the message id is the JMSMessageID.
>
>
>
>
>
>> Willem
>>
>> On 4/13/11 11:46 PM, kumaap wrote:
>>>
>>> Hi thanks for that .. but theres another issue we consuming messages off
>>> multiple JMS  providers
>>>
>>> Camel 2.5 JmsMessage class
>>>
>>> @Override
>>>      protected String createMessageId() {
>>>          if (jmsMessage == null) {
>>>              if (LOG.isTraceEnabled()) {
>>>                  LOG.trace("No javax.jms.Message set so generating a new
>>> message id");
>>>              }
>>>              return super.createMessageId();
>>>          }
>>>          try {
>>>              String id =
>>> getDestinationAsString(jmsMessage.getJMSDestination()) +
>>> jmsMessage.getJMSMessageID();
>>>              return getSanitizedString(id);
>>>          } catch (JMSException e) {
>>>              throw new RuntimeExchangeException("Unable to retrieve
>>> JMSMessageID from JMS Message", getExchange(), e);
>>>          }
>>>      }
>>>
>>> It will always use the JMS qualifiers , its hardly ever the case that JMS
>>> messages have a null JMSMessageID. Is there a way to override this ?
>>>
>>> Cheers in advance
>>> kumaap0
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>          http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>>
>> Connect at CamelOne May 24-26
>> The Open Source Integration Conference
>> http://camelone.com
>>
>
>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com

Re: Custom Exchange ID

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiang <wi...@gmail.com> wrote:
> Yes, it's hard to change unless you extends the JMS component and override
> this method.
>
> I just created a JIRA CAMEL-3859[1] for it.
>
> [1]https://issues.apache.org/jira/browse/CAMEL-3859
>

No thats not necessary. There are 2 id's
- exchange
- message id

And he want to assign custom exchange id. Which is easier to do in
Camel 2.5 as there is a pluggable API for that.

The message id is part of the message, and since that message is JMS,
the message id is the JMSMessageID.





> Willem
>
> On 4/13/11 11:46 PM, kumaap wrote:
>>
>> Hi thanks for that .. but theres another issue we consuming messages off
>> multiple JMS  providers
>>
>> Camel 2.5 JmsMessage class
>>
>> @Override
>>     protected String createMessageId() {
>>         if (jmsMessage == null) {
>>             if (LOG.isTraceEnabled()) {
>>                 LOG.trace("No javax.jms.Message set so generating a new
>> message id");
>>             }
>>             return super.createMessageId();
>>         }
>>         try {
>>             String id =
>> getDestinationAsString(jmsMessage.getJMSDestination()) +
>> jmsMessage.getJMSMessageID();
>>             return getSanitizedString(id);
>>         } catch (JMSException e) {
>>             throw new RuntimeExchangeException("Unable to retrieve
>> JMSMessageID from JMS Message", getExchange(), e);
>>         }
>>     }
>>
>> It will always use the JMS qualifiers , its hardly ever the case that JMS
>> messages have a null JMSMessageID. Is there a way to override this ?
>>
>> Cheers in advance
>> kumaap0
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
>
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
> http://camelone.com
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Custom Exchange ID

Posted by Willem Jiang <wi...@gmail.com>.
Yes, it's hard to change unless you extends the JMS component and 
override this method.

I just created a JIRA CAMEL-3859[1] for it.

[1]https://issues.apache.org/jira/browse/CAMEL-3859

Willem

On 4/13/11 11:46 PM, kumaap wrote:
> Hi thanks for that .. but theres another issue we consuming messages off
> multiple JMS  providers
>
> Camel 2.5 JmsMessage class
>
> @Override
>      protected String createMessageId() {
>          if (jmsMessage == null) {
>              if (LOG.isTraceEnabled()) {
>                  LOG.trace("No javax.jms.Message set so generating a new
> message id");
>              }
>              return super.createMessageId();
>          }
>          try {
>              String id =
> getDestinationAsString(jmsMessage.getJMSDestination()) +
> jmsMessage.getJMSMessageID();
>              return getSanitizedString(id);
>          } catch (JMSException e) {
>              throw new RuntimeExchangeException("Unable to retrieve
> JMSMessageID from JMS Message", getExchange(), e);
>          }
>      }
>
> It will always use the JMS qualifiers , its hardly ever the case that JMS
> messages have a null JMSMessageID. Is there a way to override this ?
>
> Cheers in advance
> kumaap0
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com

Re: Custom Exchange ID

Posted by kumaap <am...@gmail.com>.
Hi thanks for that .. but theres another issue we consuming messages off
multiple JMS  providers 

Camel 2.5 JmsMessage class

@Override
    protected String createMessageId() {
        if (jmsMessage == null) {
            if (LOG.isTraceEnabled()) {
                LOG.trace("No javax.jms.Message set so generating a new
message id");
            }
            return super.createMessageId();
        }
        try {
            String id =
getDestinationAsString(jmsMessage.getJMSDestination()) +
jmsMessage.getJMSMessageID();
            return getSanitizedString(id);
        } catch (JMSException e) {
            throw new RuntimeExchangeException("Unable to retrieve
JMSMessageID from JMS Message", getExchange(), e);
        }
    }

It will always use the JMS qualifiers , its hardly ever the case that JMS
messages have a null JMSMessageID. Is there a way to override this ?

Cheers in advance 
kumaap0

--
View this message in context: http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Custom Exchange ID

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You need Camel 2.5 or better. See
http://camel.apache.org/uuidgenerator.html

On Wed, Apr 13, 2011 at 4:23 PM, kumaap <am...@gmail.com> wrote:
> Hi ,
>
> I'm using camel 2.4 and we have a need to create unique ids for every
> message going through our routes, We were looking at using the Exchange ID
> but its in a different format than our requirement is it possible to
> override the Exchange id generation class. Our routes are xml format and are
> dynamically loaded.
>
>
> Cheers
> Amitesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300720.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Custom Exchange ID

Posted by kumaap <am...@gmail.com>.
Thanks guys,

we have a interim fix and will be updating to 2.6 anyway but 
https://issues.apache.org/jira/browse/CAMEL-3859 [CAMEL-3859]  will give us
a better solution.

Thanks 
kumaap0

--
View this message in context: http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4302527.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Custom Exchange ID

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Apr 13, 2011 at 4:23 PM, kumaap <am...@gmail.com> wrote:
> Hi ,
>
> I'm using camel 2.4 and we have a need to create unique ids for every
> message going through our routes, We were looking at using the Exchange ID
> but its in a different format than our requirement is it possible to
> override the Exchange id generation class. Our routes are xml format and are
> dynamically loaded.
>

To re-iterate you only option with Camel 2.4 is to change the source
code. See DefaultExchange and JmsMessage where you need to alter the
code so it can use your custom exchange id generator.

In JmsMessage just remove the createExchangeId method so it defaults
to the behavior from DefaultExchange. Then you use your custom id
generate in DefaultExchange.


>
> Cheers
> Amitesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300720.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/