INT-3338: MongoMS: Add priority and sequence
JIRA: https://jira.spring.io/browse/INT-3338 INT-3338: Add Docs INT-3338: Make `priority` 'smart' Add `Sort` for all group queries dependently of `priorityEnabled`. Avoids the need to configure separate collections for different type of `MessageStore` INT-3338: Add `MongoDbChannelMessageStore` INT-3338: Polishing, Fixes, Improvements Doc Polishing Fix stream test.
This commit is contained in:
committed by
Gary Russell
parent
a7489909d7
commit
2ee179a891
@@ -201,20 +201,20 @@
|
||||
The <classname>DirectChannel</classname> internally delegates to a Message Dispatcher to invoke its
|
||||
subscribed Message Handlers, and that dispatcher can have a load-balancing strategy exposed via
|
||||
<emphasis>load-balancer</emphasis> or <emphasis>load-balancer-ref</emphasis> attributes (mutually exclusive). The load balancing strategy
|
||||
is used by the Message Dispatcher to help determine how Messages are distributed amongst Message Handlers
|
||||
is used by the Message Dispatcher to help determine how Messages are distributed amongst Message Handlers
|
||||
in the case that there are multiple Message Handlers subscribed to the same channel.
|
||||
As a convinience the <emphasis>load-balancer</emphasis> attribute exposes enumeration of values pointing to pre-existing implementations
|
||||
As a convinience the <emphasis>load-balancer</emphasis> attribute exposes enumeration of values pointing to pre-existing implementations
|
||||
of <classname>LoadBalancingStrategy</classname>.
|
||||
The "round-robin" (load-balances across the handlers in rotation) and "none" (for the cases where one wants to explicitely disable load balancing)
|
||||
are the only available values.
|
||||
Other strategy implementations may be added in future versions.
|
||||
The "round-robin" (load-balances across the handlers in rotation) and "none" (for the cases where one wants to explicitely disable load balancing)
|
||||
are the only available values.
|
||||
Other strategy implementations may be added in future versions.
|
||||
However, since version 3.0 you can provide your own implementation of the <classname>LoadBalancingStrategy</classname> and
|
||||
inject it using <emphasis>load-balancer-ref</emphasis> attribute which should point to a bean that implements
|
||||
inject it using <emphasis>load-balancer-ref</emphasis> attribute which should point to a bean that implements
|
||||
<classname>LoadBalancingStrategy</classname>.
|
||||
<programlisting language="xml"><![CDATA[<int:channel id="lbRefChannel">
|
||||
<int:dispatcher load-balancer-ref="lb"/>
|
||||
</int:channel>
|
||||
|
||||
|
||||
<bean id="lb" class="foo.bar.SampleLoadBalancingStrategy"/>]]></programlisting>
|
||||
Note that <emphasis>load-balancer</emphasis> or <emphasis>load-balancer-ref</emphasis> attributes are mutually exclusive.
|
||||
</para>
|
||||
@@ -666,8 +666,8 @@ payload to an Integer.
|
||||
The message store must be a <interfacename>PriorityCapableChannelMessageStore</interfacename> and, in this
|
||||
case, the namespace parser will declare a <classname>QueueChannel</classname> instead of
|
||||
a <classname>PriorityChannel</classname>. Implementations of the
|
||||
<classname>PriorityCapableChannelMessageStore</classname> are currently provided for <code>Redis</code>
|
||||
and <code>JDBC</code>.
|
||||
<classname>PriorityCapableChannelMessageStore</classname> are currently provided for <code>Redis</code>,
|
||||
<code>JDBC</code> and <code>MongoDB</code>.
|
||||
See <xref linkend="channel-configuration-queuechannel"/>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -94,4 +94,17 @@
|
||||
</important>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis>Spring Integration 4.0</emphasis> introduced two new interfaces <interfacename>ChannelMessageStore</interfacename> -
|
||||
to implement operations specific for <classname>QueueChannel</classname>s, <interfacename>PriorityCapableChannelMessageStore</interfacename> -
|
||||
to mark <interfacename>MessageStore</interfacename> implementation to be used for <classname>PriorityChannel</classname>s and to provide
|
||||
<emphasis>priority</emphasis> order for persisted Messages. The real behaviour depends on implementation. The Framework provides these implementations,
|
||||
which can be used as a persistent <interfacename>MessageStore</interfacename> for <classname>PriorityChannel</classname>:
|
||||
<itemizedlist>
|
||||
<listitem><xref linkend="redis-cms"/></listitem>
|
||||
<listitem><xref linkend="mongodb-priority-channel-message-store"/></listitem>
|
||||
<listitem><xref linkend="jdbc-message-store-channels"/></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -142,6 +142,54 @@
|
||||
<code>configurableStoreMessages</code>. It is recommended to use this implementation for robust and flexible solutions
|
||||
when messages contain complex data types.
|
||||
</para>
|
||||
<section id="mongodb-priority-channel-message-store">
|
||||
<title>MongodDB Channel Message Store</title>
|
||||
|
||||
<para>
|
||||
Starting with <emphasis>version 4.0</emphasis>, the new <code>MongoDbChannelMessageStore</code>
|
||||
has been introduced; it is an optimized <interfacename>MessageGroupStore</interfacename> for use
|
||||
in <classname>QueueChannel</classname>s.
|
||||
With <code>priorityEnabled = true</code>, it can be used in
|
||||
<code><int:priority-queue></code>s to achieve <emphasis>priority</emphasis> order polling for
|
||||
persisted messages. The <emphasis>priority</emphasis> MonogDB document field is populated from the
|
||||
<code>IntegrationMessageHeaderAccessor.PRIORITY</code> (<code>priority</code>)
|
||||
message header.
|
||||
</para>
|
||||
<para>
|
||||
In addition, all MongoDB <interfacename>MessageStore</interfacename>s now have a <code>sequence</code>
|
||||
field for MessageGroup
|
||||
documents. The <code>sequence</code> value is the result of an <code>$inc</code> operation for a simple
|
||||
<code>sequence</code>
|
||||
document from the same collection, which is created on demand. The <code>sequence</code> field is used in
|
||||
<code>poll</code> operations to provide first-in-first-out (FIFO) message order
|
||||
(within priority if configured) when messages are stored within the same millisecond.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
It is not recommended to use the same <classname>MongoDbChannelMessageStore</classname> bean
|
||||
for priority and non-priority, because the <code>priorityEnabled</code> option applies to the entire store.
|
||||
However, the same <code>collection</code> can be used for both
|
||||
<classname>MongoDbChannelMessageStore</classname> types, because message polling from the
|
||||
store is sorted and uses indexes. To configure that scenario, simply extend one message store bean
|
||||
from the other:
|
||||
</para>
|
||||
</note>
|
||||
<programlisting language="xml"><![CDATA[<bean id="channelStore" class="o.s.i.mongodb.store.MongoDbChannelMessageStore">
|
||||
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory"/>
|
||||
</bean>
|
||||
|
||||
<int:channel id="queueChannel">
|
||||
<int:queue message-store="store"/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="priorityStore" parent="channelStore">
|
||||
<property name="priorityEnabled" value="true"/>
|
||||
</bean>
|
||||
|
||||
<int:channel id="priorityChannel">
|
||||
<int:priority-queue message-store="priorityStore"/>
|
||||
</int:channel>]]></programlisting>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mongodb-inbound-channel-adapter">
|
||||
|
||||
@@ -110,6 +110,16 @@
|
||||
For more information, see <xref linkend="redis-cms"/>.
|
||||
</para>
|
||||
</section>
|
||||
<section id="4.0-priority-channel-mondodb">
|
||||
<title>MongodDB Channel Message Store</title>
|
||||
<para>
|
||||
MongoDB support now provides the <classname>MongoDbChannelMessageStore</classname> -
|
||||
a <emphasis>channel</emphasis> specific <interfacename>MessageStore</interfacename> implementation.
|
||||
With <code>priorityEnabled = true</code>, it can be used in
|
||||
<code><int:priority-queue></code>s to achieve <emphasis>priority</emphasis> order polling of
|
||||
persisted messages. For more information see <xref linkend="mongodb-priority-channel-message-store"/>.
|
||||
</para>
|
||||
</section>
|
||||
<section id="4.0-MBeanExport-annotation">
|
||||
<title>@EnableIntegrationMBeanExport</title>
|
||||
<para>
|
||||
|
||||
Reference in New Issue
Block a user