Skip to content

Instantly share code, notes, and snippets.

@brunoborges
Created June 11, 2012 05:12
Show Gist options
  • Save brunoborges/2908606 to your computer and use it in GitHub Desktop.
Save brunoborges/2908606 to your computer and use it in GitHub Desktop.
No #TDC2012 vc talvez aprenda a usar Scala, Apache Camel e o Twitter :-)
class MyRouteBuilder extends RouteBuilder {
val tweetMsg = (e: Exchange) ⇒ {
val tweet = new StatusUpdate("@%s ei, se minha palestra for aceita, voce vai aprender como usar Scala, Apache Camel e Twitter!".format(status.getFromUser()))
tweet.setInReplyToStatusId(e.getIn.getBody.asInstanceOf[Tweet].getId())
e.getIn().setBody(tweet)
}
"twitter://search?delay=10&type=polling&keywords=%23TDC2012%20scala%20camel%20twitter" ==> {
when(_.in.asInstanceOf[Tweet].getFromUser() != "brunoborges") {
process(tweetMsg)
to("twitter://timeline/user")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment