INT-3065: Add tweet-data-expression for Update
JIRA: https://jira.spring.io/browse/INT-3065 Improve `TwitterSearchOutboundGateway` to use an expression to build the tweet instead of just using the payload (which remains the default).
This commit is contained in:
committed by
Gary Russell
parent
9052377bf5
commit
97d1d389a9
@@ -253,7 +253,24 @@ twitter.oauth.accessTokenSecret=AbRxUAvyNCtqQtxFK8w5ZMtMj20KFhB6o]]></programlis
|
||||
channel="twitterChannel"/>]]></programlisting>
|
||||
The only extra configuration that is required for this adapter is the <code>twitter-template</code> reference.
|
||||
</para>
|
||||
</section>
|
||||
<para>
|
||||
Starting with <emphasis>version 4.0</emphasis> the <code><int-twitter:outbound-channel-adapter></code>
|
||||
supports a <code>tweet-data-expression</code> to populate the <classname>TweetData</classname> argument
|
||||
(<ulink url="http://projects.spring.io/spring-social-twitter/">Spring Social Twitter</ulink>) using the
|
||||
message as the root object of the expression evaluation context. The result can be a <classname>String</classname>,
|
||||
which will be used for the <classname>TweetData</classname> message; a <classname>Tweet</classname> object, the
|
||||
<code>text</code> of which will be used for the <classname>TweetData</classname> message; or an entire
|
||||
<classname>TweetData</classname> object. For convenience, the <classname>TweetData</classname> can be built
|
||||
from the expression directly without needing a fully qualified class name:
|
||||
<programlisting language="xml"><![CDATA[<int-twitter:outbound-channel-adapter
|
||||
twitter-template="twitterTemplate"
|
||||
channel="twitterChannel"
|
||||
tweet-data-expression="new TweetData(payload).withMedia(headers.media).displayCoordinates(true)/>]]></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
This allows, for example, attaching an image to the tweet.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="outbound-twitter-direct">
|
||||
<title>Twitter Outbound Direct Message Channel Adapter</title>
|
||||
|
||||
@@ -322,5 +322,15 @@
|
||||
advanced configuration. See <xref linkend="ftp-session-factory"/> for more information.
|
||||
</para>
|
||||
</section>
|
||||
<section id="4.0-twitter-status-updating">
|
||||
<title>Twitter: StatusUpdatingMessageHandler</title>
|
||||
<para>
|
||||
The <classname>StatusUpdatingMessageHandler</classname> (<code><int-twitter:outbound-channel-adapter></code>)
|
||||
now supports the <code>tweet-data-expression</code> attribute to build a
|
||||
<classname>org.springframework.social.twitter.api.TweetData</classname> object for updating the
|
||||
timeline status allowing, for example, attaching an image.
|
||||
See <xref linkend="outbound-twitter-update"/> for more information.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
Reference in New Issue
Block a user