camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/3] git commit: camel-beanstalk cleanup the options
Date Sun, 21 Sep 2014 09:06:40 GMT
camel-beanstalk cleanup the options


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/db8dc0cb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/db8dc0cb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/db8dc0cb

Branch: refs/heads/master
Commit: db8dc0cbe6428588f07f3ab8247b484f02965428
Parents: 441311d
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Sep 21 10:53:57 2014 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Sep 21 10:53:57 2014 +0200

----------------------------------------------------------------------
 .../component/beanstalk/BeanstalkConsumer.java  | 18 ++++++------
 .../component/beanstalk/BeanstalkEndpoint.java  | 31 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/db8dc0cb/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkConsumer.java
b/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkConsumer.java
index b55050f..e18fc20 100644
--- a/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkConsumer.java
+++ b/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkConsumer.java
@@ -57,9 +57,9 @@ public class BeanstalkConsumer extends ScheduledPollConsumer {
     private static final String[] STATS_KEY_STR = new String[]{"tube", "state"};
     private static final String[] STATS_KEY_INT = new String[]{"age", "time-left", "timeouts",
"releases", "buries", "kicks"};
 
-    private String onFailure = BeanstalkComponent.COMMAND_BURY;
-    private boolean useBlockIO = true;
-    private boolean deleteImmediately;
+    private String onFailure;
+    private boolean useBlockIO;
+    private boolean awaitJob;
     private Client client;
     private ExecutorService executor;
     private Synchronization sync;
@@ -113,7 +113,7 @@ public class BeanstalkConsumer extends ScheduledPollConsumer {
                     }
                 }
 
-                if (deleteImmediately) {
+                if (!awaitJob) {
                     client.delete(job.getJobId());
                 } else {
                     exchange.addOnCompletion(sync);
@@ -155,7 +155,7 @@ public class BeanstalkConsumer extends ScheduledPollConsumer {
         this.onFailure = onFailure;
     }
 
-    public boolean getUseBlockIO() {
+    public boolean isUseBlockIO() {
         return useBlockIO;
     }
 
@@ -163,12 +163,12 @@ public class BeanstalkConsumer extends ScheduledPollConsumer {
         this.useBlockIO = useBlockIO;
     }
 
-    public boolean getAwaitJob() {
-        return !deleteImmediately;
+    public boolean isAwaitJob() {
+        return awaitJob;
     }
 
-    public void setAwaitJob(boolean awaitingCompletion) {
-        this.deleteImmediately = !awaitingCompletion;
+    public void setAwaitJob(boolean awaitJob) {
+        this.awaitJob = awaitJob;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/db8dc0cb/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkEndpoint.java
b/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkEndpoint.java
index 7437204..f141223 100644
--- a/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkEndpoint.java
+++ b/components/camel-beanstalk/src/main/java/org/apache/camel/component/beanstalk/BeanstalkEndpoint.java
@@ -38,6 +38,10 @@ public class BeanstalkEndpoint extends ScheduledPollEndpoint {
     private int jobDelay = BeanstalkComponent.DEFAULT_DELAY;
     private int jobTimeToRun = BeanstalkComponent.DEFAULT_TIME_TO_RUN;
 
+    private String onFailure = BeanstalkComponent.COMMAND_BURY;
+    private boolean useBlockIO = true;
+    private boolean awaitJob = true;
+
     public BeanstalkEndpoint(final String uri, final Component component, final ConnectionSettings
conn) {
         super(uri, component);
         this.conn = conn;
@@ -83,6 +87,30 @@ public class BeanstalkEndpoint extends ScheduledPollEndpoint {
         this.jobTimeToRun = jobTimeToRun;
     }
 
+    public String getOnFailure() {
+        return onFailure;
+    }
+
+    public void setOnFailure(String onFailure) {
+        this.onFailure = onFailure;
+    }
+
+    public boolean isUseBlockIO() {
+        return useBlockIO;
+    }
+
+    public void setUseBlockIO(boolean useBlockIO) {
+        this.useBlockIO = useBlockIO;
+    }
+
+    public boolean isAwaitJob() {
+        return awaitJob;
+    }
+
+    public void setAwaitJob(boolean awaitJob) {
+        this.awaitJob = awaitJob;
+    }
+
     /**
      * Creates Camel producer.
      * <p/>
@@ -118,6 +146,9 @@ public class BeanstalkEndpoint extends ScheduledPollEndpoint {
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
         BeanstalkConsumer consumer = new BeanstalkConsumer(this, processor);
+        consumer.setAwaitJob(isAwaitJob());
+        consumer.setOnFailure(getOnFailure());
+        consumer.setUseBlockIO(isUseBlockIO());
         configureConsumer(consumer);
         return consumer;
     }


Mime
View raw message