Repository: camel Updated Branches: refs/heads/master bcf662da1 -> d4e2e0ad1
CAMEL-10827: camel-twitter should use polling mode by default for consumers. The direct makes less sence as its only run once. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d4e2e0ad Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d4e2e0ad Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d4e2e0ad Branch: refs/heads/master Commit: d4e2e0ad1b366cb8c0c1db3a1d87be887bb4f83e Parents: bcf662d Author: Claus Ibsen <davscl...@apache.org> Authored: Wed Feb 15 11:51:00 2017 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Feb 15 11:51:00 2017 +0100 ---------------------------------------------------------------------- .../camel-twitter/src/main/docs/twitter-component.adoc | 8 ++++---- .../apache/camel/component/twitter/TwitterConfiguration.java | 4 ++-- .../camel/example/websocket/TwitterWebSocketRoute.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/d4e2e0ad/components/camel-twitter/src/main/docs/twitter-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/main/docs/twitter-component.adoc b/components/camel-twitter/src/main/docs/twitter-component.adoc index 938eb08..f50f427 100644 --- a/components/camel-twitter/src/main/docs/twitter-component.adoc +++ b/components/camel-twitter/src/main/docs/twitter-component.adoc @@ -141,7 +141,7 @@ The Twitter component supports 43 endpoint options which are listed below: | user | common | | String | Username used for user timeline consumption direct message production etc. | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN or ERROR level and ignored. | sendEmptyMessageWhenIdle | consumer | false | boolean | If the polling consumer did not poll any files you can enable this option to send an empty message (no body) instead. -| type | consumer | direct | EndpointType | Endpoint type to use. Only streaming supports event type. +| type | consumer | polling | EndpointType | Endpoint type to use. Only streaming supports event type. | distanceMetric | consumer (advanced) | km | String | Used by the non-stream geography search to search by radius using the configured metrics. The unit can either be mi for miles or km for kilometers. You need to configure all the following options: longitude latitude radius and distanceMetric. | exceptionHandler | consumer (advanced) | | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN or ERROR level and ignored. | exchangePattern | consumer (advanced) | | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange. @@ -239,11 +239,11 @@ from("twitter://timeline/home?type=polling&delay=60&consumerKey=[s]&consumerSecr .to("bean:blah"); ---- -#### To search for all statuses with the keyword 'camel': +#### To search for all statuses with the keyword 'camel' only once: [source,java] ---- -from("twitter://search?type=direct&keywords=camel&consumerKey=[s]&consumerSecret=[s]&accessToken=[s]&accessTokenSecret=[s]") +from("twitter://search?type=polling&keywords=camel&consumerKey=[s]&consumerSecret=[s]&accessToken=[s]&accessTokenSecret=[s]") .to("bean:blah"); ---- @@ -279,4 +279,4 @@ Example]. * link:endpoint.html[Endpoint] * link:getting-started.html[Getting Started] -* link:twitter-websocket-example.html[Twitter Websocket Example] \ No newline at end of file +* link:twitter-websocket-example.html[Twitter Websocket Example] http://git-wip-us.apache.org/repos/asf/camel/blob/d4e2e0ad/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java index f184739..f2ce700 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java @@ -34,8 +34,8 @@ public class TwitterConfiguration { @UriPath(description = "The kind of endpoint", enums = "directmessage,search,streaming/filter,streaming/sample,streaming/user" + ",timeline/home,timeline/mentions,timeline/retweetsofme,timeline/user") @Metadata(required = "true") private String kind; - @UriParam(label = "consumer", defaultValue = "direct", enums = "polling,direct,event") - private EndpointType type = EndpointType.DIRECT; + @UriParam(label = "consumer", defaultValue = "polling", enums = "polling,direct,event") + private EndpointType type = EndpointType.POLLING; @UriParam(label = "security", secret = true) private String accessToken; @UriParam(label = "security", secret = true) http://git-wip-us.apache.org/repos/asf/camel/blob/d4e2e0ad/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java b/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java index 8e67150..bcb9ae5 100644 --- a/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java +++ b/examples/camel-example-twitter-websocket/src/main/java/org/apache/camel/example/websocket/TwitterWebSocketRoute.java @@ -106,7 +106,7 @@ public class TwitterWebSocketRoute extends RouteBuilder { tc.setConsumerSecret(consumerSecret); // poll twitter search for new tweets - fromF("twitter://search?type=polling&delay=%s&keywords=%s", delay, searchTerm) + fromF("twitter://search?delay=%s&keywords=%s", delay, searchTerm) .to("log:tweet") // and push tweets to all web socket subscribers on camel-tweet .to("websocket:camel-tweet?sendToAll=true");