Repository: camel Updated Branches: refs/heads/master 194dd3579 -> ef55316f2
Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ef55316f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ef55316f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ef55316f Branch: refs/heads/master Commit: ef55316f270ece05b5df978da43afaa60c66cf6d Parents: 194dd35 Author: Claus Ibsen <davscl...@apache.org> Authored: Mon May 11 13:19:13 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon May 11 13:19:32 2015 +0200 ---------------------------------------------------------------------- .../routebox/RouteboxConfiguration.java | 95 +++++++++++--------- 1 file changed, 53 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/ef55316f/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java index 34c8a23..567a4c3 100644 --- a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java +++ b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java @@ -38,37 +38,33 @@ import org.slf4j.LoggerFactory; @UriParams public class RouteboxConfiguration { private static final Logger LOG = LoggerFactory.getLogger(RouteboxConfiguration.class); + + private CamelContext innerContext; + private List<RouteBuilder> routeBuilders = new ArrayList<RouteBuilder>(); + private Registry innerRegistry; private URI uri; private String authority; + private ProducerTemplate innerProducerTemplate; + @UriPath @Metadata(required = "true") private String routeboxName; @UriParam - private URI consumerUri; - @UriParam - private URI producerUri; - @UriParam private RouteboxDispatchStrategy dispatchStrategy; @UriParam private Map<String, String> dispatchMap; - private CamelContext innerContext; - private List<RouteBuilder> routeBuilders = new ArrayList<RouteBuilder>(); - private Registry innerRegistry; @UriParam(defaultValue = "true") private boolean forkContext = true; - @UriParam(defaultValue = "true") - private boolean local = true; - @UriParam(defaultValue = "20000") + @UriParam(label = "producer", defaultValue = "20000") private long connectionTimeout = 20000; - @UriParam(defaultValue = "1000") + @UriParam(label = "consumer", defaultValue = "1000") private long pollInterval = 1000; - @UriParam(defaultValue = "direct") + @UriParam(defaultValue = "direct", enums = "direct,seda") private String innerProtocol = "direct"; - @UriParam(defaultValue = "20") + @UriParam(label = "consumer", defaultValue = "20") private int threads = 20; @UriParam private int queueSize; - private ProducerTemplate innerProducerTemplate; - @UriParam(defaultValue = "true") + @UriParam(label = "producer", defaultValue = "true") private boolean sendToConsumer = true; public RouteboxConfiguration() { @@ -148,9 +144,7 @@ public class RouteboxConfiguration { innerProducerTemplate = innerContext.createProducerTemplate(); setQueueSize(component.getAndRemoveParameter(parameters, "size", Integer.class, 0)); - consumerUri = component.resolveAndRemoveReferenceParameter(parameters, "consumerUri", URI.class, new URI("routebox:" + getRouteboxName())); - producerUri = component.resolveAndRemoveReferenceParameter(parameters, "producerUri", URI.class, new URI("routebox:" + getRouteboxName())); - + dispatchStrategy = component.resolveAndRemoveReferenceParameter(parameters, "dispatchStrategy", RouteboxDispatchStrategy.class, null); dispatchMap = component.resolveAndRemoveReferenceParameter(parameters, "dispatchMap", HashMap.class, new HashMap<String, String>()); if (dispatchStrategy == null && dispatchMap == null) { @@ -190,6 +184,9 @@ public class RouteboxConfiguration { return routeBuilders; } + /** + * Whether to fork and create a new inner CamelContext instead of reusing the same CamelContext. + */ public void setForkContext(boolean forkContext) { this.forkContext = forkContext; } @@ -198,6 +195,9 @@ public class RouteboxConfiguration { return forkContext; } + /** + * Number of threads to be used by the routebox to receive requests. + */ public void setThreads(int threads) { this.threads = threads; } @@ -206,6 +206,9 @@ public class RouteboxConfiguration { return threads; } + /** + * Logical name for the routebox (eg like a queue name) + */ public void setRouteboxName(String routeboxName) { this.routeboxName = routeboxName; } @@ -214,30 +217,9 @@ public class RouteboxConfiguration { return routeboxName; } - public void setLocal(boolean local) { - this.local = local; - } - - public boolean isLocal() { - return local; - } - - public void setProducerUri(URI producerUri) { - this.producerUri = producerUri; - } - - public URI getProducerUri() { - return producerUri; - } - - public void setConsumerUri(URI consumerUri) { - this.consumerUri = consumerUri; - } - - public URI getConsumerUri() { - return consumerUri; - } - + /** + * To use a custom RouteboxDispatchStrategy which allows to use custom dispatching instead of the default. + */ public void setDispatchStrategy(RouteboxDispatchStrategy dispatchStrategy) { this.dispatchStrategy = dispatchStrategy; } @@ -246,6 +228,9 @@ public class RouteboxConfiguration { return dispatchStrategy; } + /** + * Timeout in millis used by the producer when sending a message. + */ public void setConnectionTimeout(long connectionTimeout) { this.connectionTimeout = connectionTimeout; } @@ -258,10 +243,18 @@ public class RouteboxConfiguration { return pollInterval; } + /** + * The timeout used when polling from seda. + * When a timeout occurs, the consumer can check whether it is allowed to continue running. + * Setting a lower value allows the consumer to react more quickly upon shutdown. + */ public void setPollInterval(long pollInterval) { this.pollInterval = pollInterval; } + /** + * Create a fixed size queue to receive requests. + */ public void setQueueSize(int queueSize) { this.queueSize = queueSize; } @@ -274,10 +267,16 @@ public class RouteboxConfiguration { this.innerProducerTemplate = innerProducerTemplate; } + /** + * The ProducerTemplate to use by the internal embeded CamelContext + */ public ProducerTemplate getInnerProducerTemplate() { return innerProducerTemplate; } + /** + * The Protocol used internally by the Routebox component. Can be Direct or SEDA. The Routebox component currently offers protocols that are JVM bound. + */ public void setInnerProtocol(String innerProtocol) { this.innerProtocol = innerProtocol; } @@ -286,6 +285,9 @@ public class RouteboxConfiguration { return innerProtocol; } + /** + * To use a custom registry for the internal embedded CamelContext. + */ public void setInnerRegistry(Registry innerRegistry) { this.innerRegistry = innerRegistry; } @@ -294,6 +296,10 @@ public class RouteboxConfiguration { return innerRegistry; } + /** + * Dictates whether a Producer endpoint sends a request to an external routebox consumer. + * If the setting is false, the Producer creates an embedded inner context and processes requests internally. + */ public void setSendToConsumer(boolean sendToConsumer) { this.sendToConsumer = sendToConsumer; } @@ -302,6 +308,11 @@ public class RouteboxConfiguration { return sendToConsumer; } + /** + * A string representing a key in the Camel Registry matching an object value of the type HashMap<String, String>. + * The HashMap key should contain strings that can be matched against the value set for the exchange header ROUTE_DISPATCH_KEY. + * The HashMap value should contain inner route consumer URI's to which requests should be directed. + */ public void setDispatchMap(Map<String, String> dispatchMap) { this.dispatchMap = dispatchMap; }