Results 1 to 6 of 6

Thread: Message ID unicity

  1. #1
    Join Date
    Apr 2007
    Posts
    29

    Default Message ID unicity

    Hi !

    I would think that the message id was the same through all the channels. But it seems to change, for example, 4 logs in the same execution of one message :
    Code:
    03d53d2d-8737-46d0-b6e4-0989212f3ef3
    19558c72-a6f5-49fd-beac-0cd502c763e9
    07ed4bd8-8d03-4097-85e3-3d57dcb73c86
    1d08eee6-6b6f-4957-a5cc-f43d4a7bcd1d
    I think I misunderstand something.

    Can you explain to me please.

    Regards.

  2. #2
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    640

    Default

    Hello.

    It depends on your channels' endpoints: in most cases handlers work with payload and they send to the output-channel new Message with processed payload and Map of headers. There are other handlers which works with entire Message, e.g. <bridge>.
    Or you can write your own POJO-MethodInvocation-Handlers for <service-activator>, <transformer> etc., their methods can accept entire Message and return the same message. So, in this case the Message ID won't be changed.

    Hope I'm clear,
    Artem Bilan

  3. #3
    Join Date
    Apr 2007
    Posts
    29

    Default

    You are clear
    Thank you.

    I'm trying to create an administration tool. For this I use wire-taps on channels and custom logger service inside custom transformers to register messages in database. Even between 2 wire-taps the ID changes
    So, I need to inject my own identifier inside the header ... to rely all log messages.

  4. #4
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    640

    Default

    I need to inject my own identifier inside the header
    Yes, you should.
    However, take a look on correlationId header and in the end you don't to provide your own additional header. Just set value into correlationId via <header-enricher> and in this case it will look as message-flow id.
    But you're free to make your own identifier header.

    Good luck!

  5. #5
    Join Date
    Apr 2007
    Posts
    29

    Default

    Thank you again !

    I will use my own identifier for one reason : avoid to modify any framework (future ?) behaviour, not to be intrusive.

    Regards.

  6. #6
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Just to clarify, Messages are immutable. That is at the core of any Messaging architecture, so Message ID represents the ID of a single Message created and managed by the framework. Its not a business ID or transaction/flow ID. Its an ID of a single Message.
    As Artem stated you can use custom headers or *correlationId* header to accomplish the same ID propagation.
    Also, just want to clarify that eve if your endpoint accepts and returns a Message the Framework will create a new Message using MessageBuilder.fromMessage(), thus resulting in a new Message with new ID.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •