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 2017/03/01 09:39:27 UTC
camel git commit: CAMEL-10587: camel-aws sqs consumer should start
background thread before consumer.
Repository: camel
Updated Branches:
refs/heads/camel-2.18.x 44e2aa04f -> 3a2e9dac2
CAMEL-10587: camel-aws sqs consumer should start background thread before consumer.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3a2e9dac
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3a2e9dac
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3a2e9dac
Branch: refs/heads/camel-2.18.x
Commit: 3a2e9dac22b85c5cd76efb99ae3644e1fc7ad3a9
Parents: 44e2aa0
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Mar 1 10:38:37 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Mar 1 10:39:11 2017 +0100
----------------------------------------------------------------------
.../org/apache/camel/component/aws/sqs/SqsConsumer.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3a2e9dac/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
index c34035d..ed2e53b 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
@@ -49,12 +49,9 @@ import org.apache.camel.util.URISupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-
/**
* A Consumer of messages from the Amazon Web Service Simple Queue Service
* <a href="http://aws.amazon.com/sqs/">AWS SQS</a>
- *
*/
public class SqsConsumer extends ScheduledBatchPollingConsumer {
@@ -189,7 +186,6 @@ public class SqsConsumer extends ScheduledBatchPollingConsumer {
});
}
-
// add on completion to handle after work when the exchange is done
exchange.addOnCompletion(new Synchronization() {
public void onComplete(Exchange exchange) {
@@ -206,7 +202,6 @@ public class SqsConsumer extends ScheduledBatchPollingConsumer {
}
});
-
LOG.trace("Processing exchange [{}]...", exchange);
getAsyncProcessor().process(exchange, new AsyncCallback() {
@Override
@@ -294,19 +289,22 @@ public class SqsConsumer extends ScheduledBatchPollingConsumer {
@Override
protected void doStart() throws Exception {
- super.doStart();
+ // start scheduler first
if (getConfiguration().isExtendMessageVisibility() && scheduledExecutor == null) {
this.scheduledExecutor = getEndpoint().getCamelContext().getExecutorServiceManager().newSingleThreadScheduledExecutor(this, "SqsTimeoutExtender");
}
+
+ super.doStart();
}
@Override
protected void doShutdown() throws Exception {
- super.doShutdown();
if (scheduledExecutor != null) {
getEndpoint().getCamelContext().getExecutorServiceManager().shutdownNow(scheduledExecutor);
scheduledExecutor = null;
}
+
+ super.doShutdown();
}
private class TimeoutExtender implements Runnable {