On 04/04/2015 08:16 PM, Kevin Burton wrote:
> I was hoping it was the Message ID because the memory store’s message table
> is by message ID so re-producing messages with the same messages IDs would
> use the same key so would only be stored in memory once.
>
> In theory this is possible but the ActiveMQ internals assert the
> producer+sequence design.
>
> I guess I could get clever and do something silly and abuse producer IDs to
> get some internal efficiency from ActiveMQ but that might lead to unknown
> bugs.
>
> Where is the documentation of setting up a unique message ID header?  I
> haven’t been able to find anything on the subject.
>
> On Sat, Apr 4, 2015 at 5:00 PM, Timothy Bish <[email protected]> wrote:
>
>> On 04/04/2015 07:09 PM, Kevin Burton wrote:
>>> I’m trying to generate unique message IDs so that I can idempotently
>>> produce messages from our ‘loader’ so that items don’t get processed more
>>> than once.
>>>
>>> The JMS Message ID should do that .. but it looks like when I call
>>> producer.send() it’s ALWAYs overwritten by a custom message ID:
>>>
>>>
>>> In ActiveMQSession.send it just overwrites it:
>>>
>>> msg.setMessageId(new
>> MessageId(producer.getProducerInfo().getProducerId(),
>>> sequenceNumber));
>>>
>>> … so no matter WHAT I want to send , it’s just overwritten.
>>>
>>> I’m really hoping I’m doing something or that this is just a bug because
>> it
>>> would be a shame to lose this feature.
>>>
>> This is working as it should, from the spec on setJMSMessageID:
>>
>> JMS providers set this field when a message is sent. This method can be
>> used to change the value for a message that has been received.
>>
>> You can use message properties so define a key / value pair that
>> represents the application specific message identifier you want to use,
>> the JMS Message ID value is provider specific.
>>
>> --
>> Tim Bish
>> Sr Software Engineer | RedHat Inc.
>> [email protected] | www.redhat.com
>> twitter: @tabish121
>> blog: http://timbish.blogspot.com/
>>
>>
>
I was referring to standard JMS Message properties which you application
could leverage:

e.g message.setStringProperty("myMessageId", "MyUniqueValue")

Inside the broker the message ID is always the standard
producerId:sequenceId value and I don't recommend abusing it as there is
a lot of broker code that is expecting this design. 

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
[email protected] | www.redhat.com 
twitter: @tabish121
blog: http://timbish.blogspot.com/

Reply via email to