Question

Can I use Twitter Spring Integration as a gateway (or even splitter) instead of a polling consumer? The idea will be to use the payload as a query so I can do multiple twitter custom searches. That payload will come from another chain.

One way will be to use the http outbound gateway, but I will not go into this, because then I will have to implement the entire Twitter API (authentication - twitter template, tweet duplication - metadata store).

Was it helpful?

Solution

The proper Spring Integration endpoint for that would be a <si-twitter:outbound-gateway/> for a request/response scenario; but we don't currently have that; feel free to open a new feature JIRA Issue for that.

However, under the covers, we use a TwitterTemplate; you can invoke it directly; something like...

TwitterTemplate tt = new TwitterTemplate(consumerKey, consumerSecret, accessToken,  accessTokenSecret);
SearchParameters searchParameters = new SearchParameters(query).count(20).sinceId(sinceId);
SearchResults results = tt.searchOperations().search(searchParameters);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top