Announcement Announcement Module
Collapse
No announcement yet.
adding header to GenericMessage Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • adding header to GenericMessage

    Hi again, I am trying to send a message through the channel with a String payload and some custom header, like this:

    Code:
    DirectChannel channel = (DirectChannel) context
    				.getBean("senderChannel");
    		
    		Map<String, Object> m = new HashMap<String, Object>();
    		m.put("foo", "test");
    		GenericMessage<String> msg = new GenericMessage<String>("<xml>NST description</xml>", m);
    		
    		channel.send(msg);
    		System.out.println("sent message: " + msg.toString());
    When I run the code, I see that the header is added because I see this in the log:

    sent message: [Payload=<xml>NST description</xml>][Headers={timestamp=1346981165529, id=6f965773-48a9-4bc3-970d-352de19bbb06, foo=test}]

    However, when I go to RabbitMQ console and look at the message, my foo header does not show up ( I can see the payload though). Any advice?
    thank you

  • #2
    Well, you need to show us the configuration for your application context but, essentially, you need to tell the outbound endpoint to map your custom header (foo).

    See attribute mapped-request-headers.

    Comment


    • #3
      Thank you for quick responses.

      Comment

      Working...
      X