Skip to content

Instantly share code, notes, and snippets.

@bibryam
Created August 2, 2012 11:41
Show Gist options
  • Select an option

  • Save bibryam/3236471 to your computer and use it in GitHub Desktop.

Select an option

Save bibryam/3236471 to your computer and use it in GitHub Desktop.
Camel Olympics Image Loader Route
public void configure() throws Exception {
from("twitter://streaming/filter?type=event&keywords=" + searchTerm)
.to("log:tweetStream?level=INFO&groupInterval=60000&groupDelay=60000&groupActiveOnly=false")
.process(new ImageExtractor())
.process(new Statistics())
.filter(body().isInstanceOf(Tweet.class))
.idempotentConsumer(header(UNIQUE_IMAGE_URL), MemoryIdempotentRepository.memoryIdempotentRepository(10000))
.to("log:imageStream?level=INFO&groupInterval=60000&groupDelay=60000&groupActiveOnly=false")
.throttle(1).timePeriodMillis(5000).asyncDelayed().callerRunsWhenRejected(false)
.marshal().json(JsonLibrary.Jackson)
.to("websocket:camelympics?sendToAll=true");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment