Repository: camel Updated Branches: refs/heads/master 35cc8902b -> 77f829471
CAMEL-8023: Model and component javadoc documentation Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e7f0126a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e7f0126a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e7f0126a Branch: refs/heads/master Commit: e7f0126ae90870bbc14804baf3391c70ec5ebc0d Parents: 35cc890 Author: Claus Ibsen <davscl...@apache.org> Authored: Mon Feb 9 08:08:47 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon Feb 9 08:08:47 2015 +0100 ---------------------------------------------------------------------- .../camel/component/seda/SedaComponent.java | 19 ++++++--- .../camel/component/seda/SedaEndpoint.java | 43 ++++++++++++++++++++ 2 files changed, 57 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/e7f0126a/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java index a0f4269..9163c74 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java @@ -36,7 +36,7 @@ public class SedaComponent extends UriEndpointComponent { protected final Logger log = LoggerFactory.getLogger(getClass()); protected final int maxConcurrentConsumers = 500; protected int queueSize; - protected int defaultConcurrentConsumers = 1; + protected int concurrentConsumers = 1; private final Map<String, QueueReference> queues = new HashMap<String, QueueReference>(); private BlockingQueueFactory<Exchange> defaultQueueFactory = new LinkedBlockingQueueFactory<Exchange>(); @@ -48,6 +48,9 @@ public class SedaComponent extends UriEndpointComponent { super(endpointClass); } + /** + * Sets the default maximum capacity of the SEDA queue (i.e., the number of messages it can hold). + */ public void setQueueSize(int size) { queueSize = size; } @@ -55,19 +58,25 @@ public class SedaComponent extends UriEndpointComponent { public int getQueueSize() { return queueSize; } - + + /** + * Sets the default number of concurrent threads processing exchanges. + */ public void setConcurrentConsumers(int size) { - defaultConcurrentConsumers = size; + concurrentConsumers = size; } public int getConcurrentConsumers() { - return defaultConcurrentConsumers; + return concurrentConsumers; } public BlockingQueueFactory<Exchange> getDefaultQueueFactory() { return defaultQueueFactory; } + /** + * Sets the default queue factory. + */ public void setDefaultQueueFactory(BlockingQueueFactory<Exchange> defaultQueueFactory) { this.defaultQueueFactory = defaultQueueFactory; } @@ -155,7 +164,7 @@ public class SedaComponent extends UriEndpointComponent { @Override @SuppressWarnings("unchecked") protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - int consumers = getAndRemoveParameter(parameters, "concurrentConsumers", Integer.class, defaultConcurrentConsumers); + int consumers = getAndRemoveParameter(parameters, "concurrentConsumers", Integer.class, concurrentConsumers); boolean limitConcurrentConsumers = getAndRemoveParameter(parameters, "limitConcurrentConsumers", Boolean.class, true); if (limitConcurrentConsumers && consumers > maxConcurrentConsumers) { throw new IllegalArgumentException("The limitConcurrentConsumers flag in set to true. ConcurrentConsumers cannot be set at a value greater than " http://git-wip-us.apache.org/repos/asf/camel/blob/e7f0126a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java index 74dbfa1..6262bff 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java @@ -236,6 +236,11 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, } } + /** + * Define the queue instance which will be used by seda endpoint. + * <p/> + * This option is only for rare use-cases where you want to use a custom queue instance. + */ public void setQueue(BlockingQueue<Exchange> queue) { this.queue = queue; this.size = queue.remainingCapacity(); @@ -246,6 +251,9 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return size; } + /** + * The maximum capacity of the SEDA queue (i.e., the number of messages it can hold). + */ public void setSize(int size) { this.size = size; } @@ -255,6 +263,11 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return queue.size(); } + /** + * Whether a thread that sends messages to a full SEDA queue will block until the queue's capacity is no longer exhausted. + * By default, an exception will be thrown stating that the queue is full. + * By enabling this option, the calling thread will instead block and wait until the message can be accepted. + */ public void setBlockWhenFull(boolean blockWhenFull) { this.blockWhenFull = blockWhenFull; } @@ -264,6 +277,9 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return blockWhenFull; } + /** + * Number of concurrent threads processing exchanges. + */ public void setConcurrentConsumers(int concurrentConsumers) { this.concurrentConsumers = concurrentConsumers; } @@ -277,6 +293,13 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return waitForTaskToComplete; } + /** + * Option to specify whether the caller should wait for the async task to complete or not before continuing. + * The following three options are supported: Always, Never or IfReplyExpected. + * The first two values are self-explanatory. + * The last value, IfReplyExpected, will only wait if the message is Request Reply based. + * The default option is IfReplyExpected. + */ public void setWaitForTaskToComplete(WaitForTaskToComplete waitForTaskToComplete) { this.waitForTaskToComplete = waitForTaskToComplete; } @@ -286,6 +309,10 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return timeout; } + /** + * Timeout (in milliseconds) before a SEDA producer will stop waiting for an asynchronous task to complete. + * You can disable timeout by using 0 or a negative value. + */ public void setTimeout(long timeout) { this.timeout = timeout; } @@ -295,6 +322,9 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return failIfNoConsumers; } + /** + * Whether the producer should fail by throwing an exception, when sending to a SEDA queue with no active consumers. + */ public void setFailIfNoConsumers(boolean failIfNoConsumers) { this.failIfNoConsumers = failIfNoConsumers; } @@ -304,6 +334,11 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return multipleConsumers; } + /** + * Specifies whether multiple consumers are allowed. If enabled, you can use SEDA for Publish-Subscribe messaging. + * That is, you can send a message to the SEDA queue and have each consumer receive a copy of the message. + * When enabled, this option should be specified on every consumer endpoint. + */ public void setMultipleConsumers(boolean multipleConsumers) { this.multipleConsumers = multipleConsumers; } @@ -313,6 +348,10 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return pollTimeout; } + /** + * The timeout used when polling. 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 setPollTimeout(int pollTimeout) { this.pollTimeout = pollTimeout; } @@ -322,6 +361,10 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, return purgeWhenStopping; } + /** + * Whether to purge the task queue when stopping the consumer/route. + * This allows to stop faster, as any pending messages on the queue is discarded. + */ public void setPurgeWhenStopping(boolean purgeWhenStopping) { this.purgeWhenStopping = purgeWhenStopping; }