Announcement Announcement Module
No announcement yet.
header-value-router in Spring Integration 2.2 with RabbitMQ 3.0.4 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • header-value-router in Spring Integration 2.2 with RabbitMQ 3.0.4

    Is the header-value-router designed to work with custom headers, in Spring Integration 2.2.1? It works very well when the header-name attribute is set to a standard amqp header, like "amqp_redelivered". However, when I use a custom header, like "foo", the message route is always unresolved, so the message is always delivered to the default ouput channel. Not surprisingly, when I try to log the header values, for debugging purposes, via the org.springframework.integration.Message interface, I cannot retrieve any custom header values, using simple string names. All the standard headers, like "timestamp", log fine. I'm probably trying to do something that simply is not supported. If it is supported, and you know of a published working example, please point me to it. Thank you. -Benjamin
    Last edited by bwfrieds; Mar 28th, 2013, 10:34 AM.

  • #2
    When using custom headers, you must tell the adapters/gateways about them, so they will get mapped from AMQP to Spring Integration (and vice versa).

    See mapped-request-headers and mapped-reply-headers attributes.

    You can use wildcards.

    Note that when adding custom headers to these attributes, you need to include "STANDARD_REQUEST_HEADERS" and "STANDARD_REPLY_HEADERS" if you wish the standard headers to continue to be mapped.


    mapped-request-headers="foo, STANDARD_REQUEST_HEADERS"
    If you need more sophistication (such as you want to map AMQP property 'foo' to Spring Integration header 'bar'), you can supply a custom header-mapper instead.

    (Note you can't provide the mapped-*-headers attributes if you supply a custom header mapper).

    Finally, turning on DEBUG logging will give a lot of details about which headers WILL and WILL NOT be mapped.

    Hope that helps.
    Last edited by Gary Russell; Mar 28th, 2013, 10:42 AM.


    • #3
      Thank you for that super fast reply, Mr. Russell! The router works perfectly now and the custom headers are logged! You are an awesome human being! -Ben