Results 1 to 4 of 4

Thread: Setting message priority via @Header annotation

  1. #1
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    19

    Default Setting message priority via @Header annotation

    Just need to verify whether this is true: if one attempts to set a message priority via @Header annotation, such as:

    Code:
    @Gateway(requestChannel="fooChannel")
    public abstract void bar(String msg, @Header(MessageHeaders.PRIORITY) MessagePriority priority);
    They will get an IllegalArgumentException from this line:

    Code:
    public class ArgumentArrayMessageMapper implements InboundMessageMapper<Object[]> {
    [...]
    	@SuppressWarnings("unchecked")
    	private Message<?> mapArgumentsToMessage(Object[] arguments) {
            [...]
    				else if (annotation.annotationType().equals(Header.class)) {
    					Header headerAnnotation = (Header) annotation;
    					String headerName = this.determineHeaderName(headerAnnotation, methodParameter);
    					if (headerName.startsWith(MessageHeaders.PREFIX)){
    						throw new IllegalArgumentException("Attempting to set header: " + headerName + ". Prefix: '" 
    								+ MessageHeaders.PREFIX + "' is reservered for SI internal use");
    					}
            [...]
            }
    [...]
    }
    Anyway around this by still using @Gateway or do I have to resort to a MessageBuilder or a MessageChannelTemplate?

    Thank you in advance.

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    I just created an issue in JIRA for this:
    https://jira.springsource.org/browse/INT-1205

  3. #3
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    19

    Default

    Thanks Mark. As a workaround, I wrapped my gateway bean with another one that sets the headers using the @Headers annotation. ArgumentArrayMessageMapper does not check for prefixes there.

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    That issue has been fixed. Please try again with either the trunk build or the M5 release (which should be out tomorrow).

    Thanks for catching that issue!
    -Mark

Posting Permissions

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