polishing
This commit is contained in:
@@ -258,24 +258,26 @@ received.
|
||||
The only extra configuration that is required for this adapter is the <code>twitter-template</code> reference.
|
||||
</para>
|
||||
<para>
|
||||
When it comes to Twitter Direct Message you must specify who you sending this message to - <emphasis>target userid</emphasis>.
|
||||
Twitter Outbound Direct Message Channel Adapter provides several ways you can specify target user.
|
||||
By default it will look for target userid in the Message headers under the name <code>twitter_dmTargetUserId</code> which
|
||||
is also identified by the following constant - <classname>TwitterHeaders.DM_TARGET_USER_ID</classname>.
|
||||
So when creating a Message all you need to do is add this header:
|
||||
When it comes to Twitter Direct Messages, you must specify who you are sending the message to - the <emphasis>target userid</emphasis>.
|
||||
The Twitter Outbound Direct Message Channel Adapter provides two ways you can specify that target user.
|
||||
</para>
|
||||
<para>
|
||||
The first (and default) way is that it will look for a target userid in the Message headers under the name <code>twitter_dmTargetUserId</code> which
|
||||
is also identified by the following constant: <classname>TwitterHeaders.DM_TARGET_USER_ID</classname>.
|
||||
So when creating a Message all you need to do is add a value for that header.
|
||||
|
||||
<programlisting language="java"><![CDATA[Message message = MessageBuilder.withPayload("hello")
|
||||
.setHeader(TwitterHeaders.DM_TARGET_USER_ID, "z_oleg").build();]]></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
The above approach works well if you know the target userid in advance. However there are times when such
|
||||
value must be determined dynamically. For those cases you can utilize SpEL support by providing valid SpEL
|
||||
expression via <code>target-user-expression</code> attribute.
|
||||
The above approach works well if you know the target userid in advance. However there are times when that
|
||||
value must be determined dynamically. For those cases you can utilize the second approach: SpEL support.
|
||||
Simply provide a valid SpEL expression via the <code>target-user-expression</code> attribute.
|
||||
|
||||
<programlisting language="xml"><![CDATA[<twitter:dm-outbound-channel-adapter id="dmAdapter"
|
||||
twitter-template="twitter"
|
||||
channel="inputChannel"
|
||||
target-user-expression="'z' + '_oleg'"/>]]></programlisting>
|
||||
target-user-expression="payload.user.twitterId"/>]]></programlisting>
|
||||
</para>
|
||||
</section>
|
||||
<para>
|
||||
|
||||
Reference in New Issue
Block a user