INT-2918: Add Redis Outbound Command Gateway
JIRA: https://jira.springsource.org/browse/INT-2918 INT-2918: Improvement according PR comments INT-2918: Polishing according PR comments Minor Doc Polishing INT-2918: Change `notNull` message Polishing
This commit is contained in:
committed by
Gary Russell
parent
c11e3ba3b5
commit
945455f360
@@ -660,4 +660,114 @@ the serialization of values, you may want to consider providing your own
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="redis-outbound-gateway">
|
||||
<title>Redis Outbound Command Gateway</title>
|
||||
<para>
|
||||
Since <emphasis>Spring Integration 4.0</emphasis>, the Redis Command Gateway is available to
|
||||
perform any standard Redis command using generic
|
||||
<code>RedisConnection#execute</code>
|
||||
method:
|
||||
<programlisting language="xml"><![CDATA[<int-redis:outbound-gateway
|
||||
request-channel="" ]]><co id="redis-o-g-request-channel"/><![CDATA[
|
||||
reply-channel="" ]]><co id="redis-o-g-reply-channel"/><![CDATA[
|
||||
requires-reply="" ]]><co id="redis-o-g-requires-reply"/><![CDATA[
|
||||
reply-timeout="" ]]><co id="redis-o-g-reply-timeout"/><![CDATA[
|
||||
connection-factory="" ]]><co id="redis-o-g-connectionFactory"/><![CDATA[
|
||||
redis-template="" ]]><co id="redis-o-g-template"/><![CDATA[
|
||||
arguments-serializer="" ]]><co id="redis-o-g-arguments-serializer"/><![CDATA[
|
||||
command-expression="" ]]><co id="redis-o-g-command-expression"/><![CDATA[
|
||||
argument-expressions="" ]]><co id="redis-o-g-argument-expressions"/><![CDATA[
|
||||
use-command-variable="" ]]><co id="redis-o-g-use-command-variable"/><![CDATA[
|
||||
arguments-strategy="" />]]><co id="redis-o-g-arguments-strategy"/>
|
||||
</programlisting>
|
||||
<calloutlist>
|
||||
<callout arearefs="redis-o-g-request-channel">
|
||||
<para>
|
||||
The <interfacename>MessageChannel</interfacename> from which this Endpoint receives<interfacename>Message</interfacename>s.
|
||||
</para>
|
||||
</callout>
|
||||
<callout arearefs="redis-o-g-reply-channel">
|
||||
<para>
|
||||
The <interfacename>MessageChannel</interfacename> where this Endpoint sends reply<interfacename>Message</interfacename>s.
|
||||
</para>
|
||||
</callout>
|
||||
<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
|
||||
the Redis returns a <code>null</code> value.
|
||||
</para>
|
||||
</callout>
|
||||
<callout arearefs="redis-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-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-o-g-template">
|
||||
<para>
|
||||
A reference to a <classname>RedisTemplate</classname> bean.
|
||||
Mutually exclusive with 'connection-factory' attribute.
|
||||
</para>
|
||||
</callout>
|
||||
<callout arearefs="redis-o-g-arguments-serializer">
|
||||
<para>
|
||||
Reference to an instance of<interfacename>org.springframework.data.redis.serializer.RedisSerializer</interfacename>.
|
||||
Used to serialize each command argument to byte[] if necessary.
|
||||
</para>
|
||||
</callout>
|
||||
<callout arearefs="redis-o-g-command-expression">
|
||||
<para>
|
||||
The SpEL expression that returns the command key. Default is the <code>redis_command</code> message header.
|
||||
Must not evaluate to <code>null</code>.
|
||||
</para>
|
||||
</callout>
|
||||
<callout arearefs="redis-o-g-argument-expressions">
|
||||
<para>
|
||||
Comma-separate SpEL expressions that will be evaluated as command arguments.
|
||||
Mutually exclusive with the <code>arguments-strategy</code> attribute. If neither of them is provided
|
||||
the <code>payload</code> is used as the command argument(s).
|
||||
Argument expressions may evaluate to 'null', to support a variable number of arguments.
|
||||
</para>
|
||||
</callout>
|
||||
<callout arearefs="redis-o-g-use-command-variable">
|
||||
<para>
|
||||
A <code>boolean</code> flag to specify if the evaluated Redis command string will be
|
||||
made available as the <code>#cmd</code> variable
|
||||
in the expression evaluation context in the
|
||||
<classname>org.springframework.integration.redis.outbound.ExpressionArgumentsStrategy</classname>
|
||||
when <code>argument-expressions</code> is configured, otherwise this attribute is ignored.
|
||||
</para>
|
||||
</callout>
|
||||
<callout arearefs="redis-o-g-arguments-strategy">
|
||||
<para>
|
||||
Reference to an instance of <interfacename>org.springframework.integration.redis.outbound.ArgumentsStrategy</interfacename>.
|
||||
Mutually exclusive with <code>argument-expressions</code> attribute. If neither of them is provided
|
||||
the <code>payload</code> is used as the command argument(s).
|
||||
</para>
|
||||
</callout>
|
||||
</calloutlist>
|
||||
</para>
|
||||
<para>
|
||||
The <code><int-redis:outbound-gateway></code> can be used as a common component to perform any desired
|
||||
Redis operation. For example to get incremented value from Redis Atomic Number:
|
||||
<programlisting language="xml"><![CDATA[<int-redis:outbound-gateway request-channel="requestChannel"
|
||||
reply-channel="replyChannel"
|
||||
command-expression="'INCR'"/>]]></programlisting>
|
||||
where the Message <code>payload</code> should be a name of <code>redisCounter</code>, which may be provided
|
||||
by <classname>org.springframework.data.redis.support.atomic.RedisAtomicInteger</classname> bean definition.
|
||||
</para>
|
||||
<para>
|
||||
The <code>RedisConnection#execute</code> has a generic <classname>Object</classname> as return type and real
|
||||
result depends on command type, for example <code>MGET</code> returns a <code>List<byte[]></code>.
|
||||
For more information about commands, their arguments and result type see
|
||||
<ulink url="http://redis.io/commands">Redis Specification</ulink>.
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
@@ -117,6 +117,14 @@
|
||||
For more information, see <xref linkend="security"/>.
|
||||
</para>
|
||||
</section>
|
||||
<section id="4.0-redis-outbound-gateway">
|
||||
<title>Redis Command Gateway</title>
|
||||
<para>
|
||||
The Redis support now provides the <code><outbound-gateway></code> component
|
||||
to perform generic Redis commands using the <code>RedisConnection#execute</code> method.
|
||||
For more information, see <xref linkend="redis-outbound-gateway"/>.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="4.0-general">
|
||||
|
||||
Reference in New Issue
Block a user