Spring Integration
  1. Spring Integration
  2. INT-2412

We must ensure that 'priority' header can only have value of type Integer

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 2.1 GA
    • Fix Version/s: 2.0.6, 2.1.1, 2.2 M1
    • Component/s: Core
    • Labels:
      None

      Description

      Currently we allow 'priority' header to be set as String. We also have a leftover enumeration in XSD which is no longer valid

      <xsd:simpleType name="priorityEnumeration">
      	<xsd:restriction base="xsd:token">
      		<xsd:enumeration value="HIGHEST" />
      		<xsd:enumeration value="HIGH" />
      		<xsd:enumeration value="NORMAL" />
      		<xsd:enumeration value="LOW" />
      		<xsd:enumeration value="LOWEST" />
      	</xsd:restriction>
      </xsd:simpleType>
      

      If one of these values are used the exception is thrown. For example, the following configuration"

      <int:header-enricher input-channel="inputChannel" output-channel="priorityChannel">
      		<int:header name="priority" value="HIGHEST"/>
      	</int:header-enricher>
      	
      	<int:channel id="priorityChannel">
      		<int:priority-queue/>
      	</int:channel>
      	
      	<int:logging-channel-adapter channel="priorityChannel" level="WARN" log-full-message="true">
      		<int:poller fixed-rate="1000" max-messages-per-poll="1"/>
      	</int:logging-channel-adapter>
      

      ... results in

      Caused by: java.lang.IllegalArgumentException: Incorrect type specified for header 'priority'. Expected [class java.lang.Integer] but actual type is [class java.lang.String]
      	at org.springframework.integration.MessageHeaders.get(MessageHeaders.java:150)
      	at org.springframework.integration.MessageHeaders.getPriority(MessageHeaders.java:140)
      

        Activity

        Oleg Zhurakousky created issue -
        Hide
        Oleg Zhurakousky added a comment -

        As I commented out in eh Forum the value of the priority header is set as Integer with 'value' and/or 'expression' attribute, and can only be retrieved as Integer with MessageHeaders.getPriority() so the real issue/confusion is schema which I am about to fix.

        Show
        Oleg Zhurakousky added a comment - As I commented out in eh Forum the value of the priority header is set as Integer with 'value' and/or 'expression' attribute, and can only be retrieved as Integer with MessageHeaders.getPriority() so the real issue/confusion is schema which I am about to fix.
        Show
        Oleg Zhurakousky added a comment - 2.0.6 PR https://github.com/SpringSource/spring-integration/pull/347 2.1 PR https://github.com/SpringSource/spring-integration/pull/346
        Oleg Zhurakousky made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Mark Fisher added a comment -

        merged for 2.1.1/2.2-M1

        Show
        Mark Fisher added a comment - merged for 2.1.1/2.2-M1
        Hide
        Mark Fisher added a comment -

        merged for 2.0.6

        Show
        Mark Fisher added a comment - merged for 2.0.6
        Mark Fisher made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Complete [ 8 ]
        Oleg Zhurakousky made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        11d 22h 4m 1 Oleg Zhurakousky 01/Feb/12 8:21 AM
        In Progress In Progress Resolved Resolved
        12d 50m 1 Mark Fisher 13/Feb/12 9:11 AM
        Resolved Resolved Closed Closed
        92d 5h 2m 1 Oleg Zhurakousky 15/May/12 3:13 PM

          People

          • Assignee:
            Oleg Zhurakousky
            Reporter:
            Oleg Zhurakousky
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: