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/8bc42394 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8bc42394 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8bc42394 Branch: refs/heads/camel-2.11.x Commit: 8bc42394fcbe05c0f8fc530b5584258871ac048b Parents: 6c38b90 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:44 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/8bc42394/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; + } }
