Updated Branches: refs/heads/camel-2.11.x 6c38b9036 -> 8bc42394f refs/heads/master 4684225fd -> 5b942e3e4
CAMEL-6151: Added support for blocking direct producers. Thanks to Aaron Whiteside for partial patch. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b942e3e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5b942e3e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5b942e3e Branch: refs/heads/master Commit: 5b942e3e45bbb7a3bf5956ce62c5487460a951ef Parents: 4684225 Author: Claus Ibsen <[email protected]> Authored: Mon Jun 3 18:45:21 2013 +0200 Committer: Claus Ibsen <[email protected]> Committed: Mon Jun 3 18:45:21 2013 +0200 ---------------------------------------------------------------------- .../camel/component/direct/DirectComponent.java | 22 ++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5b942e3e/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java b/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java index 3f1c5f7..2f89a6a 100644 --- a/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java @@ -35,9 +35,13 @@ public class DirectComponent extends DefaultComponent { // later in case the DirectEndpoint was re-created due the old was evicted from the endpoints LRUCache // on DefaultCamelContext private final Map<String, DirectConsumer> consumers = new HashMap<String, DirectConsumer>(); + private boolean block; + private long timeout = 30000L; protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - Endpoint endpoint = new DirectEndpoint(uri, this, consumers); + DirectEndpoint endpoint = new DirectEndpoint(uri, this, consumers); + endpoint.setBlock(block); + endpoint.setTimeout(timeout); setProperties(endpoint, parameters); return endpoint; } @@ -48,4 +52,20 @@ public class DirectComponent extends DefaultComponent { consumers.clear(); super.doStop(); } + + public boolean isBlock() { + return block; + } + + public void setBlock(boolean block) { + this.block = block; + } + + public long getTimeout() { + return timeout; + } + + public void setTimeout(long timeout) { + this.timeout = timeout; + } }
