Announcement Announcement Module
No announcement yet.
Custom AMQP header mapper Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom AMQP header mapper

    Hello all,

    I have a scenario where a client is posting a message to RabbitMQ which my server is getting though the use of an <int-amqp:inbound-gateway>.

    I have been using the mapped-reply-headers and mapped-request-headers for some trivial header field mapping, but now I need something more flexible. My server needs to know about headers that do not necessarily have known keys, but may start with a certain prefix. For example:


    All I know is the "myproduct" part, I have to scan for the rest of it.

    I have created a new class called MyAmqpHeaderMapper which extends DefaultAmqpHeaderMapper. But it is not immediately clear how the default mapper works, and which methods to override to get the required behavior. My guess is that I need to override extractUserDefinedHeaders() but I have not been able to find any good examples on how to actually do this.

    The mapping only has to go one way, but if it goes both ways it isn't a problem.

    Can anyone help with suggestions or small examples?

    Kind regards,
    Michael Berg

  • #2
    Okay, this turned out to be much simpler than I made it into .. :-)

    I just added "myproduct-key-*" as mapped-request-headers on the inbound and outbound gateways and voila everything worked as I wanted it to .. :-)