You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/12/08 14:12:39 UTC
[06/16] camel git commit: Fixed invalid component json schema
discovered by mvn camel:validate
Fixed invalid component json schema discovered by mvn camel:validate
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ecb7d5d4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ecb7d5d4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ecb7d5d4
Branch: refs/heads/master
Commit: ecb7d5d4c88cac0d3cd616ddd946579b0a36bf07
Parents: 20f2b97
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Dec 8 14:31:08 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Dec 8 14:31:08 2016 +0100
----------------------------------------------------------------------
.../src/main/docs/etcd-component.adoc | 17 ++++-
.../etcd/AbstractEtcdPollingConsumer.java | 2 +-
.../etcd/AbstractEtcdPollingEndpoint.java | 69 ++++++++++++++++++++
.../component/etcd/AbstractEtcdProducer.java | 3 +-
.../camel/component/etcd/EtcdStatsEndpoint.java | 2 +-
.../camel/component/etcd/EtcdStatsTest.java | 6 +-
.../camel/component/etcd/EtcdWatchTest.java | 2 +-
7 files changed, 93 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ecb7d5d4/components/camel-etcd/src/main/docs/etcd-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/main/docs/etcd-component.adoc b/components/camel-etcd/src/main/docs/etcd-component.adoc
index 6e6a35e..0cbfaf1 100644
--- a/components/camel-etcd/src/main/docs/etcd-component.adoc
+++ b/components/camel-etcd/src/main/docs/etcd-component.adoc
@@ -13,7 +13,7 @@
// endpoint options: START
-The etcd component supports 16 endpoint options which are listed below:
+The etcd component supports 31 endpoint options which are listed below:
{% raw %}
[width="100%",cols="2,1,1m,1m,5",options="header"]
@@ -27,11 +27,26 @@ The etcd component supports 16 endpoint options which are listed below:
| uris | common | http://localhost:2379,http://localhost:4001 | String | To set the URIs the client connects.
| 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/ERROR level and ignored.
| sendEmptyExchangeOnTimeout | consumer | false | boolean | To send an empty message in case of timeout watching for a key.
+| 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.
| 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/ERROR level and ignored.
| exchangePattern | consumer (advanced) | | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange.
| fromIndex | consumer (advanced) | 0 | Long | The index to watch from
+| pollStrategy | consumer (advanced) | | PollingConsumerPollStrategy | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.
| timeToLive | producer | | Integer | To set the lifespan of a key in milliseconds.
| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+| backoffErrorThreshold | scheduler | | int | The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.
+| backoffIdleThreshold | scheduler | | int | The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.
+| backoffMultiplier | scheduler | | int | To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.
+| delay | scheduler | 500 | long | Milliseconds before the next poll. You can also specify time values using units such as 60s (60 seconds) 5m30s (5 minutes and 30 seconds) and 1h (1 hour).
+| greedy | scheduler | false | boolean | If greedy is enabled then the ScheduledPollConsumer will run immediately again if the previous run polled 1 or more messages.
+| initialDelay | scheduler | 1000 | long | Milliseconds before the first poll starts. You can also specify time values using units such as 60s (60 seconds) 5m30s (5 minutes and 30 seconds) and 1h (1 hour).
+| runLoggingLevel | scheduler | TRACE | LoggingLevel | The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.
+| scheduledExecutorService | scheduler | | ScheduledExecutorService | Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool.
+| scheduler | scheduler | none | ScheduledPollConsumerScheduler | To use a cron scheduler from either camel-spring or camel-quartz2 component
+| schedulerProperties | scheduler | | Map | To configure additional properties when using a custom scheduler or any of the Quartz2 Spring based scheduler.
+| startScheduler | scheduler | true | boolean | Whether the scheduler should be auto started.
+| timeUnit | scheduler | MILLISECONDS | TimeUnit | Time unit for initialDelay and delay options.
+| useFixedDelay | scheduler | true | boolean | Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.
| password | security | | String | The password to use for basic authentication.
| sslContextParameters | security | | SSLContextParameters | To configure security using SSLContextParameters.
| userName | security | | String | The user name to use for basic authentication.
http://git-wip-us.apache.org/repos/asf/camel/blob/ecb7d5d4/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java
index 80ba445..b069c63 100644
--- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java
+++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java
@@ -30,7 +30,7 @@ public abstract class AbstractEtcdPollingConsumer extends ScheduledPollConsumer
private EtcdClient client;
- protected AbstractEtcdPollingConsumer(AbstractEtcdEndpoint endpoint, Processor processor, EtcdConfiguration configuration, EtcdNamespace namespace, String path) {
+ protected AbstractEtcdPollingConsumer(AbstractEtcdPollingEndpoint endpoint, Processor processor, EtcdConfiguration configuration, EtcdNamespace namespace, String path) {
super(endpoint, processor);
this.configuration = configuration;
http://git-wip-us.apache.org/repos/asf/camel/blob/ecb7d5d4/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingEndpoint.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingEndpoint.java
new file mode 100644
index 0000000..f00996e
--- /dev/null
+++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingEndpoint.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.etcd;
+
+import mousio.etcd4j.EtcdClient;
+import org.apache.camel.impl.DefaultPollingEndpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+
+/**
+ * The camel etcd component allows you to work with <a href="https://coreos.com/etcd">Etcd</a>, a distributed, A distributed, reliable key-value store.
+ */
+@UriEndpoint(scheme = "etcd", title = "etcd", syntax = "etcd:namespace/path", consumerClass = AbstractEtcdConsumer.class, label = "etcd")
+public abstract class AbstractEtcdPollingEndpoint extends DefaultPollingEndpoint {
+
+ @UriPath(description = "The API namespace to use", enums = "keys,stats,watch")
+ @Metadata(required = "true")
+ private final EtcdNamespace namespace;
+ @UriPath(description = "The path the enpoint refers to")
+ @Metadata(required = "false")
+ private final String path;
+ @UriParam
+ private final EtcdConfiguration configuration;
+
+ protected AbstractEtcdPollingEndpoint(String uri, EtcdComponent component, EtcdConfiguration configuration, EtcdNamespace namespace, String path) {
+ super(uri, component);
+
+ this.configuration = configuration;
+ this.namespace = namespace;
+ this.path = path;
+ }
+
+ @Override
+ public boolean isSingleton() {
+ return true;
+ }
+
+ public EtcdConfiguration getConfiguration() {
+ return this.configuration;
+ }
+
+ public EtcdNamespace getNamespace() {
+ return this.namespace;
+ }
+
+ public String getPath() {
+ return this.path;
+ }
+
+ public EtcdClient createClient() throws Exception {
+ return configuration.createClient();
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/ecb7d5d4/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java
index ab6a4ef..56d80e6 100644
--- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java
+++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.etcd;
import mousio.etcd4j.EtcdClient;
+import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultProducer;
/**
@@ -29,7 +30,7 @@ public abstract class AbstractEtcdProducer extends DefaultProducer {
private EtcdClient client;
- protected AbstractEtcdProducer(AbstractEtcdEndpoint endpoint, EtcdConfiguration configuration, EtcdNamespace namespace, String path) {
+ protected AbstractEtcdProducer(Endpoint endpoint, EtcdConfiguration configuration, EtcdNamespace namespace, String path) {
super(endpoint);
this.configuration = configuration;
http://git-wip-us.apache.org/repos/asf/camel/blob/ecb7d5d4/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java
index a081771..7bb41c2 100644
--- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java
+++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java
@@ -21,7 +21,7 @@ import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
-public class EtcdStatsEndpoint extends AbstractEtcdEndpoint {
+public class EtcdStatsEndpoint extends AbstractEtcdPollingEndpoint {
public EtcdStatsEndpoint(
String uri, EtcdComponent component, EtcdConfiguration configuration, EtcdNamespace namespace, String path) {
http://git-wip-us.apache.org/repos/asf/camel/blob/ecb7d5d4/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdStatsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdStatsTest.java b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdStatsTest.java
index 6af0148..b5dfb83 100644
--- a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdStatsTest.java
+++ b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdStatsTest.java
@@ -64,11 +64,11 @@ public class EtcdStatsTest extends EtcdTestSupport {
return new RouteBuilder() {
public void configure() {
// CONSUMER
- from("etcd:stats/leader?consumer.delay=50&consumer.initialDelay=0")
+ from("etcd:stats/leader?delay=50&initialDelay=0")
.to("mock:stats-leader-consumer");
- from("etcd:stats/self?consumer.delay=50&consumer.initialDelay=0")
+ from("etcd:stats/self?delay=50&initialDelay=0")
.to("mock:stats-self-consumer");
- from("etcd:stats/store?consumer.delay=50&consumer.initialDelay=0")
+ from("etcd:stats/store?delay=50&initialDelay=0")
.to("mock:stats-store-consumer");
// PRODUCER
http://git-wip-us.apache.org/repos/asf/camel/blob/ecb7d5d4/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdWatchTest.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdWatchTest.java b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdWatchTest.java
index fad8687..3707bcf 100644
--- a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdWatchTest.java
+++ b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/EtcdWatchTest.java
@@ -102,7 +102,7 @@ public class EtcdWatchTest extends EtcdTestSupport {
from("etcd:watch/myKey1")
.process(NODE_TO_VALUE_IN)
.to("mock:watch-with-path");
- fromF("etcd:watch/myKeyRecovery?timeout=%d&fromIndex=%d", 1000 * 60 * 5, 1)
+ fromF("etcd:watch/myKeyRecovery?timeout=%s&fromIndex=%s", 1000 * 60 * 5, 1)
.id("watchRecovery")
.autoStartup(false)
.process(NODE_TO_VALUE_IN)