From a97d5f46e68b762aa9b745bf913f0b4e89796003 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 19 Nov 2010 04:29:10 -0500 Subject: [PATCH] INT-1552 polished twitter docs to reflect the changes for Rate Limiting and provided more details around metadatastore, few minor polishing changes to HVR --- docs/src/reference/docbook/router.xml | 3 +-- docs/src/reference/docbook/twitter.xml | 30 +++++++++++++++----------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/src/reference/docbook/router.xml b/docs/src/reference/docbook/router.xml index 656cc0e971..ff6c96cd3b 100644 --- a/docs/src/reference/docbook/router.xml +++ b/docs/src/reference/docbook/router.xml @@ -54,8 +54,7 @@ If arbitrary then additional mapping of these header values to channel names is required, otherwise no additional configuration is needed. - Similar to the PayloadTypeRouter, configuration of HeaderValueRouter is - also supported with the simple namespace-based XML configuration. + Spring Integration provides a simple namespace-based XML configuration to configure HeaderValueRouter. The example below demonstrates two types of namespace-based configuration of HeaderValueRouter. 1. Configuration where mapping of header values to channels is required diff --git a/docs/src/reference/docbook/twitter.xml b/docs/src/reference/docbook/twitter.xml index 5d0461d9c5..4f832993c4 100644 --- a/docs/src/reference/docbook/twitter.xml +++ b/docs/src/reference/docbook/twitter.xml @@ -69,7 +69,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/twitter Spring Integration uses the same familiar template pattern to interact with Twitter. Since current Twitter support - is based on Twitter4J API and we provide Twiter4JTemplate. + is based on Twitter4J API we provide Twiter4JTemplate. For anonymous operation (e.g., search) you don't have to define Twitter4JTemplate explicitly, since the default instance of it will be created and injected into the endpoint. However, for authenticated operation (e.g., update status, send direct message etc.) you must configure Twitter4JTemplate as a bean and @@ -77,10 +77,10 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/twitter - - - - + + + + ]]> The values above are not real @@ -94,10 +94,10 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/twitter However a more practical way to manage OAuth connection attributes would be via Spring's placeholder support by simply creating a property file (e.g., oauth.properties): - + and configuring a property-placeholder pointing to he above property file: @@ -129,9 +129,15 @@ and configuring a property-placeholder pointing to he above propert different then any other poling consumer. Twitter defines a concept of Rate Limiting. You can read more about it here: Rate Limiting . In the nutshell Rate Limiting is the way Twitter manages how often an application can poll for updates. Luckily for you you don't have to worry about it - since the special Rate limit aware polling thread is created when any Twitter adapter is started. This thread will - poll Messages (Tweets) from the Twitter account at the rate allowed by Twitter at the time (it may change after every poll). The latest Tweet timestamp - will be stored in the instance of the org.springframework.integration.store.MetadataStore which is a + since we are handling it internally polling for Messages (Tweets) from the Twitter account at the rate allowed by Twitter. + + + Another issue that we need to worry about is handling of the duplicates. The same adapter (e.g., Search or Timeline Update) + while polling on Twitter may receive the same values back. For example if you keep searching on Twitter with the same search + criteria you'll end up with the same set of tweets unless some other new tweet that matches your search criteria was posted + in between your searches. In that situation you'll get all the tweets you had before plus the new one. But what you really + want is only the new tweet. Spring Integration provides an elegant mechanism for handling these situations. + The latest Tweet timestamp will be stored in the instance of the org.springframework.integration.store.MetadataStore which is a strategy interface designed for storing various types of metadata (e.g., last retrieved tweet) to help components such as Twitter to deal with duplicates. By default, Spring Integration will look for a bean of type org.springframework.integration.store.MetadataStore in the ApplicationContext. If one found then it will be used, otherwise it will create a new instance of SimpleMetadataStore