INT-2412
removed priority enumeration from the 2.0 and 2.1 schema fixed documentation, added tests
This commit is contained in:
committed by
Mark Fisher
parent
8789d850b3
commit
76f6c0877e
@@ -596,7 +596,7 @@ payload to an Integer.
|
||||
<programlisting language="xml"><![CDATA[<int:channel id="priorityChannel">
|
||||
<int:priority-queue capacity="20"/>
|
||||
</int:channel>]]></programlisting>
|
||||
By default, the channel will consult the <classname>MessagePriority</classname> header of the
|
||||
By default, the channel will consult the <code>priority</code> header of the
|
||||
message. However, a custom <interfacename>Comparator</interfacename> reference may be
|
||||
provided instead. Also, note that the <classname>PriorityChannel</classname> (like the other types)
|
||||
does support the <code>datatype</code> attribute. As with the QueueChannel, it also supports a <code>capacity</code> attribute.
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
</row>
|
||||
<row>
|
||||
<entry>PRIORITY</entry>
|
||||
<entry>MessagePriority (an <emphasis>enum</emphasis>)</entry>
|
||||
<entry>java.lang.Integer</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
@@ -190,28 +190,21 @@ assertEquals(123, message4.getHeaders().get("foo"));</programlisting>
|
||||
Finally, there are set methods available for the predefined headers as well as a non-destructive method for
|
||||
setting any header (MessageHeaders also defines constants for the pre-defined header names).
|
||||
<programlisting language="java">Message<Integer> importantMessage = MessageBuilder.withPayload(99)
|
||||
.setPriority(MessagePriority.HIGHEST)
|
||||
.setPriority(5)
|
||||
.build();
|
||||
|
||||
assertEquals(MessagePriority.HIGHEST, importantMessage.getHeaders().getPriority());
|
||||
assertEquals(5, importantMessage.getHeaders().getPriority());
|
||||
|
||||
Message<Integer> anotherMessage = MessageBuilder.fromMessage(importantMessage)
|
||||
.setHeaderIfAbsent(MessageHeaders.PRIORITY, MessagePriority.LOW)
|
||||
Message<Integer> lessImportantMessage = MessageBuilder.fromMessage(importantMessage)
|
||||
.setHeaderIfAbsent(MessageHeaders.PRIORITY, 2)
|
||||
.build();
|
||||
|
||||
assertEquals(MessagePriority.LOW, anotherMessage.getHeaders().getPriority());
|
||||
assertEquals(2, lessImportantMessage.getHeaders().getPriority());
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
The <classname>MessagePriority</classname> is only considered when using a <classname>PriorityChannel</classname>
|
||||
(as described in the next chapter). It is defined as an <emphasis>enum</emphasis> with five possible values:
|
||||
<programlisting language="java">public enum MessagePriority {
|
||||
HIGHEST,
|
||||
HIGH,
|
||||
NORMAL,
|
||||
LOW,
|
||||
LOWEST
|
||||
}</programlisting>
|
||||
The <code>priority</code> header is only considered when using a <classname>PriorityChannel</classname>
|
||||
(as described in the next chapter). It is defined as <emphasis>java.lang.Integer</emphasis>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user