Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x f70e1e30e -> 1c07ce242
  refs/heads/master 7a9dcfd17 -> 20faeb0ae


CAMEL-10271: Fixed camel-jt400 consumer as its not polling based.


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

Branch: refs/heads/master
Commit: 20faeb0ae248870874daf4c46da9df38bc3df497
Parents: 7a9dcfd
Author: Claus Ibsen <[email protected]>
Authored: Sun Aug 28 09:38:48 2016 +0200
Committer: Claus Ibsen <[email protected]>
Committed: Sun Aug 28 09:40:34 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/jt400-component.adoc          | 29 +-------------------
 .../component/jt400/Jt400DataQueueConsumer.java |  7 ++---
 .../camel/component/jt400/Jt400Endpoint.java    |  4 +--
 3 files changed, 5 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/20faeb0a/components/camel-jt400/src/main/docs/jt400-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jt400/src/main/docs/jt400-component.adoc 
b/components/camel-jt400/src/main/docs/jt400-component.adoc
index b501d52..0c42a03 100644
--- a/components/camel-jt400/src/main/docs/jt400-component.adoc
+++ b/components/camel-jt400/src/main/docs/jt400-component.adoc
@@ -41,9 +41,6 @@ You can append query options to the URI in the following 
format,
 JT400 options
 ^^^^^^^^^^^^^
 
-
-
-
 // component options: START
 The JT400 component supports 1 options which are listed below.
 
@@ -59,14 +56,8 @@ The JT400 component supports 1 options which are listed 
below.
 // component options: END
 
 
-
-
-
-
-
-
 // endpoint options: START
-The JT400 component supports 33 endpoint options which are listed below:
+The JT400 component supports 18 endpoint options which are listed below:
 
 {% raw %}
 [width="100%",cols="2,1,1m,1m,5",options="header"]
@@ -87,32 +78,14 @@ The JT400 component supports 33 endpoint options which are 
listed below:
 | searchType | common | EQ | SearchType | Search type such as EQ for equal etc.
 | secured | common | false | boolean | Whether connections to AS/400 are 
secured with SSL.
 | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the 
consumer to the Camel routing Error Handler which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages or the likes will now 
be processed as a message and handled by the routing Error Handler. By default 
the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions that will be logged at WARN/ERROR level and ignored.
-| sendEmptyMessageWhenIdle | consumer | false | boolean | If the polling 
consumer did not poll any files you can enable this option to send an empty 
message (no body) instead.
 | exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the 
consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler 
is enabled then this options is not in use. By default the consumer will deal 
with exceptions that will be logged at WARN/ERROR level and ignored.
-| pollStrategy | consumer (advanced) |  | PollingConsumerPollStrategy | A 
pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to 
provide your custom implementation to control error handling usually occurred 
during the poll operation before an Exchange have been created and being routed 
in Camel.
 | exchangePattern | advanced | InOnly | ExchangePattern | Sets the default 
exchange pattern when creating an exchange
 | synchronous | advanced | false | boolean | Sets whether synchronous 
processing should be strictly used or Camel is allowed to use asynchronous 
processing (if supported).
-| backoffErrorThreshold | scheduler |  | int | The number of subsequent error 
polls (failed due some error) that should happen before the backoffMultipler 
should kick-in.
-| backoffIdleThreshold | scheduler |  | int | The number of subsequent idle 
polls that should happen before the backoffMultipler should kick-in.
-| backoffMultiplier | scheduler |  | int | To let the scheduled polling 
consumer backoff if there has been a number of subsequent idles/errors in a 
row. The multiplier is then the number of polls that will be skipped before the 
next actual attempt is happening again. When this option is in use then 
backoffIdleThreshold and/or backoffErrorThreshold must also be configured.
-| delay | scheduler | 500 | long | Milliseconds before the next poll. You can 
also specify time values using units such as 60s (60 seconds) 5m30s (5 minutes 
and 30 seconds) and 1h (1 hour).
-| greedy | scheduler | false | boolean | If greedy is enabled then the 
ScheduledPollConsumer will run immediately again if the previous run polled 1 
or more messages.
-| initialDelay | scheduler | 1000 | long | Milliseconds before the first poll 
starts. You can also specify time values using units such as 60s (60 seconds) 
5m30s (5 minutes and 30 seconds) and 1h (1 hour).
-| runLoggingLevel | scheduler | TRACE | LoggingLevel | The consumer logs a 
start/complete log line when it polls. This option allows you to configure the 
logging level for that.
-| scheduledExecutorService | scheduler |  | ScheduledExecutorService | Allows 
for configuring a custom/shared thread pool to use for the consumer. By default 
each consumer has its own single threaded thread pool.
-| scheduler | scheduler | none | ScheduledPollConsumerScheduler | To use a 
cron scheduler from either camel-spring or camel-quartz2 component
-| schedulerProperties | scheduler |  | Map | To configure additional 
properties when using a custom scheduler or any of the Quartz2 Spring based 
scheduler.
-| startScheduler | scheduler | true | boolean | Whether the scheduler should 
be auto started.
-| timeUnit | scheduler | MILLISECONDS | TimeUnit | Time unit for initialDelay 
and delay options.
-| useFixedDelay | scheduler | true | boolean | Controls if fixed delay or 
fixed rate is used. See ScheduledExecutorService in JDK for details.
 |=======================================================================
 {% endraw %}
 // endpoint options: END
 
 
-
-
-
 [[JT400-Usage]]
 Usage
 ^^^^^

http://git-wip-us.apache.org/repos/asf/camel/blob/20faeb0a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java
 
b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java
index 825af3c..c3ff46e 100644
--- 
a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java
+++ 
b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java
@@ -23,7 +23,6 @@ import com.ibm.as400.access.KeyedDataQueue;
 import com.ibm.as400.access.KeyedDataQueueEntry;
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.PollingConsumerSupport;
 
 /**
@@ -107,8 +106,7 @@ public class Jt400DataQueueConsumer extends 
PollingConsumerSupport {
             entry = queue.read(-1);
         }
 
-        Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
-        exchange.setFromEndpoint(endpoint);
+        Exchange exchange = getEndpoint().createExchange();
         if (entry != null) {
             exchange.getIn().setHeader(Jt400Endpoint.SENDER_INFORMATION, 
entry.getSenderInformation());
             if (endpoint.getFormat() == Jt400Configuration.Format.binary) {
@@ -134,8 +132,7 @@ public class Jt400DataQueueConsumer extends 
PollingConsumerSupport {
             entry = queue.read(key, -1, searchType);
         }
 
-        Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
-        exchange.setFromEndpoint(endpoint);
+        Exchange exchange = getEndpoint().createExchange();
         if (entry != null) {
             exchange.getIn().setHeader(Jt400Endpoint.SENDER_INFORMATION, 
entry.getSenderInformation());
             if (endpoint.getFormat() == Jt400Configuration.Format.binary) {

http://git-wip-us.apache.org/repos/asf/camel/blob/20faeb0a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400Endpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400Endpoint.java
 
b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400Endpoint.java
index 7f6ae43..849e683 100644
--- 
a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400Endpoint.java
+++ 
b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400Endpoint.java
@@ -27,7 +27,7 @@ import org.apache.camel.Consumer;
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.impl.DefaultPollingEndpoint;
+import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
@@ -37,7 +37,7 @@ import org.apache.camel.util.URISupport;
  * The jt400 component allows you to exchanges messages with an AS/400 system 
using data queues or program call.
  */
 @UriEndpoint(scheme = "jt400", title = "JT400", syntax = 
"jt400:userID:password/systemName/objectPath.type", consumerClass = 
Jt400DataQueueConsumer.class, label = "messaging")
-public class Jt400Endpoint extends DefaultPollingEndpoint {
+public class Jt400Endpoint extends DefaultEndpoint {
 
     public static final String KEY = "KEY";
     public static final String SENDER_INFORMATION = "SENDER_INFORMATION";

Reply via email to