Results 1 to 3 of 3

Thread: adding header to GenericMessage

Hybrid View

  1. #1

    Default 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. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,022

    Default

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3

    Default

    Thank you for quick responses.

Posting Permissions

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