INT-3341: Add Redis Queue Gateways

Add RedisQueueOutboundGateway and RedisQueueInboundGateway

JIRA: https://jira.spring.io/browse/INT-3341

add test

fix format issue

change expectmessage to extractpayload, fix test potential bug

fix copyright year

fix format and naming issue

fix as Artem's comments

fix as Artem's comments

change boolean condition judgement

INT-3341: Polishing

Minor Doc Polishing
This commit is contained in:
David Liu
2014-10-25 18:39:04 +03:00
committed by Gary Russell
parent ff2b15ea9e
commit 1d4785f3d2
17 changed files with 1443 additions and 9 deletions

View File

@@ -143,7 +143,9 @@
<xref linkend="redis-queue-outbound-channel-adapter" /> and
<xref linkend="redis-store-outbound-channel-adapter" /></entry>
<entry>N</entry>
<entry><xref linkend="redis-outbound-gateway" /></entry>
<entry><xref linkend="redis-outbound-gateway" /> and
<xref linkend="redis-queue-outbound-gateway" /> and
<xref linkend="redis-queue-inbound-gateway" /></entry>
</row>
<row>
<entry><emphasis role="bold">Resource</emphasis></entry>

View File

@@ -699,7 +699,7 @@ the serialization of values, you may want to consider providing your own
<callout arearefs="redis-o-g-requires-reply">
<para>
Specify whether this outbound gateway must return a non-null value. This value is
<code>false</code> by default, otherwise a ReplyRequiredException will be thrown when
<code>true</code> by default. A ReplyRequiredException will be thrown when
the Redis returns a <code>null</code> value.
</para>
</callout>
@@ -775,6 +775,165 @@ the serialization of values, you may want to consider providing your own
<ulink url="http://redis.io/commands">Redis Specification</ulink>.
</para>
</section>
<section id="redis-queue-outbound-gateway">
<title>Redis Queue Outbound Gateway</title>
<para>
Since <emphasis>Spring Integration 4.1</emphasis>, the Redis Queue Outbound Gateway is available to
perform request and reply scenarios. It pushes a <emphasis>conversation</emphasis> <code>UUID</code> to the
provided <code>queue</code>, then pushes the value to a Redis List with that <code>UUID</code> as its
key and waits for the reply from a Redis List with a key of <code>UUID + '.reply'</code>. A different
UUID is used for each interaction.
<programlisting language="xml"><![CDATA[<int-redis:queue-outbound-gateway
request-channel="" ]]><co id="redis-q-o-g-request-channel"/><![CDATA[
reply-channel="" ]]><co id="redis-q-o-g-reply-channel"/><![CDATA[
requires-reply="" ]]><co id="redis-q-o-g-requires-reply"/><![CDATA[
reply-timeout="" ]]><co id="redis-q-o-g-reply-timeout"/><![CDATA[
connection-factory="" ]]><co id="redis-q-o-g-connectionFactory"/><![CDATA[
queue="" ]]><co id="redis-q-o-g-queue"/><![CDATA[
order="" ]]><co id="redis-q-o-g-order"/><![CDATA[
serializer="" ]]><co id="redis-q-o-g-serializer"/><![CDATA[
extract-payload="" ]]><co id="redis-q-o-g-extract-payload"/>
</programlisting>
<calloutlist>
<callout arearefs="redis-q-o-g-request-channel">
<para>
The <interfacename>MessageChannel</interfacename> from which this Endpoint receives<interfacename>Message</interfacename>s.
</para>
</callout>
<callout arearefs="redis-q-o-g-reply-channel">
<para>
The <interfacename>MessageChannel</interfacename> where this Endpoint sends reply<interfacename>Message</interfacename>s.
</para>
</callout>
<callout arearefs="redis-q-o-g-requires-reply">
<para>
Specify whether this outbound gateway must return a non-null value. This value is
<code>false</code> by default, otherwise a ReplyRequiredException will be thrown when
the Redis returns a <code>null</code> value.
</para>
</callout>
<callout arearefs="redis-q-o-g-reply-timeout">
<para>
The timeout in milliseconds to wait until the reply message will be sent or not. Typically is
applied for queue-based limited reply-channels.
</para>
</callout>
<callout arearefs="redis-q-o-g-connectionFactory">
<para>
A reference to a <interfacename>RedisConnectionFactory</interfacename>bean.
Defaults to <code>redisConnectionFactory</code>. Mutually exclusive with 'redis-template' attribute.
</para>
</callout>
<callout arearefs="redis-q-o-g-queue">
<para>
The name of the Redis List to which outbound gateway will send a
<emphasis>conversation</emphasis> <code>UUID</code>.
</para>
</callout>
<callout arearefs="redis-q-o-g-order">
<para>
The order for this outbound gateway when multiple gateway are registered thereby
</para>
</callout>
<callout arearefs="redis-q-o-g-serializer">
<para>
The <interfacename>RedisSerializer</interfacename> bean reference. Can be an empty string, which means 'no serializer'.
In this case the raw <code>byte[]</code> from the inbound Redis message is sent to the <code>channel</code> as the
<interfacename>Message</interfacename> payload. By default it is a <classname>JdkSerializationRedisSerializer</classname>.
</para>
</callout>
<callout arearefs="redis-q-o-g-extract-payload">
<para>
Specify if this Endpoint expects data from the Redis queue to contain entire <interfacename>Message</interfacename>s.
If this attribute is set to <code>true</code>, the <code>serializer</code> can't be an empty string because messages
require some form of deserialization (JDK serialization by default).
</para>
</callout>
</calloutlist>
</para>
</section>
<section id="redis-queue-inbound-gateway">
<title>Redis Queue Inbound Gateway</title>
<para>
Since <emphasis>Spring Integration 4.1</emphasis>, the Redis Queue Inbound Gateway is available to
perform request and reply scenarios. It pops a <emphasis>conversation</emphasis> <code>UUID</code> from the
provided <code>queue</code>, then pops the value from the Redis List with that <code>UUID</code> as its
key and pushes the reply to the Redis List with a key of <code>UUID + '.reply'</code>:
<programlisting language="xml"><![CDATA[<int-redis:queue-inbound-gateway
request-channel="" ]]><co id="redis-q-i-g-request-channel"/><![CDATA[
reply-channel="" ]]><co id="redis-q-i-g-reply-channel"/><![CDATA[
executor="" ]]><co id="redis-q-i-g-task-executor"/><![CDATA[
reply-timeout="" ]]><co id="redis-q-i-g-reply-timeout"/><![CDATA[
connection-factory="" ]]><co id="redis-q-i-g-connectionFactory"/><![CDATA[
queue="" ]]><co id="redis-q-i-g-queue"/><![CDATA[
order="" ]]><co id="redis-q-i-g-order"/><![CDATA[
serializer="" ]]><co id="redis-q-i-g-serializer"/><![CDATA[
receive-timeout="" ]]><co id="redis-q-i-g-receive-timeout"/><![CDATA[
expect-message="" ]]><co id="redis-q-i-g-expect-message"/>
</programlisting>
<calloutlist>
<callout arearefs="redis-q-i-g-request-channel">
<para>
The <interfacename>MessageChannel</interfacename> from which this Endpoint receives<interfacename>Message</interfacename>s.
</para>
</callout>
<callout arearefs="redis-q-i-g-reply-channel">
<para>
The <interfacename>MessageChannel</interfacename> where this Endpoint sends reply<interfacename>Message</interfacename>s.
</para>
</callout>
<callout arearefs="redis-q-i-g-task-executor">
<para>
A reference to a Spring <interfacename>TaskExecutor</interfacename> (or standard JDK 1.5+ <interfacename>Executor</interfacename>)
bean. It is used for the underlying listening task. By default a <classname>SimpleAsyncTaskExecutor</classname>
is used.
</para>
</callout>
<callout arearefs="redis-q-i-g-reply-timeout">
<para>
The timeout in milliseconds to wait until the reply message will be sent or not. Typically is
applied for queue-based limited reply-channels.
</para>
</callout>
<callout arearefs="redis-q-i-g-connectionFactory">
<para>
A reference to a <interfacename>RedisConnectionFactory</interfacename>bean.
Defaults to <code>redisConnectionFactory</code>. Mutually exclusive with 'redis-template' attribute.
</para>
</callout>
<callout arearefs="redis-q-i-g-queue">
<para>
The name of the Redis List for the <emphasis>conversation</emphasis> <code>UUID</code>s.
</para>
</callout>
<callout arearefs="redis-q-i-g-order">
<para>
The order for this inbound gateway when multiple gateway are registered thereby
</para>
</callout>
<callout arearefs="redis-q-i-g-serializer">
<para>
The <interfacename>RedisSerializer</interfacename> bean reference. Can be an empty string, which means 'no serializer'.
In this case the raw <code>byte[]</code> from the inbound Redis message is sent to the <code>channel</code> as the
<interfacename>Message</interfacename> payload. By default it is a <classname>StringRedisSerializer</classname>.
</para>
</callout>
<callout arearefs="redis-q-i-g-receive-timeout">
<para>
The timeout in milliseconds to wait until the receive message will be get or not. Typically is
applied for queue-based limited request-channels.
</para>
</callout>
<callout arearefs="redis-q-i-g-expect-message">
<para>
Specify if this Endpoint expects data from the Redis queue to contain entire <interfacename>Message</interfacename>s.
If this attribute is set to <code>true</code>, the <code>serializer</code> can't be an empty string because messages
require some form of deserialization (JDK serialization by default).
</para>
</callout>
</calloutlist>
</para>
</section>
<section id="redis-lock-registry">
<title>Redis Lock Registry</title>
<para>

View File

@@ -59,6 +59,14 @@
for the JSON transformers. See <xref linkend="transformer"/> for more information.
</para>
</section>
<section id="4.1-redis-queue-gateways">
<title>Redis Queue Gateways</title>
<para>
The <code>&lt;redis-queue-inbound-gateway&gt;</code> and
<code>&lt;redis-queue-outbound-gateway&gt;</code> components are now provided.
See <xref linkend="redis-queue-inbound-gateway"/> and <xref linkend="redis-queue-outbound-gateway"/>.
</para>
</section>
<section id="4.1-PollSkipAdvice">
<title>PollSkipAdvice</title>
<para>