Twitter Adapter
Spring Integration provides support for interacting with Twitter via Twitter adapters. With Twitter adapters you can both
receive and send Twitter messages.
Twitter Template
Spring Integration uses the same familiar template pattern to interact with Twitter. Since current Twitter support
is based on Twitter4J API and we provide Twiter4JTemplate.
For anonymous operation (e.g., search) you don't have to define Twitter4JTemplate explicitly, since the default
instance of it will be created and injected into the endpoint. However, for authenticated operation
(e.g., update status, send direct message etc.) you must configure Twitter4JTemplate as a bean and
inject it explicitly into the endpoint. Below is a sample configuration of Twitter4JTemplate:
]]>
The values above are not real
As you can see form the configuration above all we need to do is to provide
OAuth attributes as constructor arguments filling them with values you have obtained in the previous step.
The order of constructor arguments is: 1) consumerKey; 2) consumerSecret;
3) accessToken; 4) accessTokenSecret;
However a more practical way to manage OAuth connection attributes would be via Spring's placeholder support by simply
creating a property file (e.g., oauth.properties):
and configuring a property-placeholder pointing to he above property file:
]]>