You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Rafael Cordones Marcos <ra...@gmail.com> on 2012/07/31 14:54:17 UTC

Twitter component: Obtaining the unique identifier of the published tweet

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

Re: Twitter component: Obtaining the unique identifier of the published tweet

Posted by Brett Meyer <br...@3riverdev.com>.
+1

Good catch!  Odds are, other Twitter consumers are missing that as 
well.  I'll take a look and update the patch if needed.  Thanks!

Brett Meyer
3RiverDev.com
brett@3riverdev.com
260-349-5732


On 07/31/2012 08:54 AM, Rafael Cordones Marcos wrote:
> 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
>