Announcement Announcement Module
Collapse
No announcement yet.
Setting message priority via @Header annotation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    I just created an issue in JIRA for this:
    https://jira.springsource.org/browse/INT-1205

    Comment


    • #3
      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.

      Comment


      • #4
        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

        Comment

        Working...
        X