camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafael Cordones Marcos <rafael.cordo...@gmail.com>
Subject Twitter component: Obtaining the unique identifier of the published tweet
Date Tue, 31 Jul 2012 12:54:17 GMT
Hi,

When sending a request to publish a tweet to the Twitter API, the
response will contain the "the unique identifier of the published
tweet" (tweet id). Our application needs to store such tweet IDs and
associate them with application-specific entities.

We are fairly new with Apache Camel but as far as we have been to find
out, the current "twitter://timeline/user" endpoint implementation (in
the UserProducer class, see [1]) disregards the response object
received from the Twitter4J library which contains (among others) the
unique status update id (tweet id).

We have implemented support for the InOut message exchange pattern
which allows to process the response object received from the Twitter
API when publishing a tweet and created a JIRA issue with the patch
and unit tests:

CAMEL-5479: Add support for the InOut Message Exchange Pattern to the
twitter UserProducer in order to be able to retrieve the unique
identifier for the published tweet
https://issues.apache.org/jira/browse/CAMEL-5479

This allows access to the Twitter API response object when using the
InOut MEP in a route:

from("direct:tweets")
  ...
  .inOut("twitter://timeline/user")
  .transform().simple("The tweet '${body.text}' was published with the
tweet id '${body.id}'")
  ...

Regards,

/rafa

[1] org.apache.camel.component.twitter.producer.UserProducer.java:
http://svn.apache.org/viewvc/camel/trunk/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/producer/UserProducer.java?view=markup

Mime
View raw message