[2/2] camel git commit: CAMEL-10242 - added support for connection timeout
CAMEL-10242 - added support for connection timeout Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4b545ae7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4b545ae7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4b545ae7 Branch: refs/heads/master Commit: 4b545ae7fd407f0df755e6ea40d9657f705b8ad0 Parents: 9a5778b Author: Quinn StevensonAuthored: Tue Sep 6 12:11:05 2016 -0600 Committer: Claus Ibsen Committed: Tue Sep 6 21:22:33 2016 +0200 -- .../src/main/docs/mllp-component.adoc | 5 +- .../camel/component/mllp/MllpEndpoint.java | 49 ++ .../component/mllp/MllpTcpClientProducer.java | 4 +- .../component/mllp/MllpTcpServerConsumer.java | 31 +++- .../camel/component/mllp/impl/MllpUtil.java | 13 +- .../MllpTcpServerConsumerConnectionTest.java| 104 ...MllpTcpServerConsumerMessageHeadersTest.java | 158 +++ .../src/test/resources/log4j2.properties| 4 + 8 files changed, 327 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4b545ae7/components/camel-mllp/src/main/docs/mllp-component.adoc -- diff --git a/components/camel-mllp/src/main/docs/mllp-component.adoc b/components/camel-mllp/src/main/docs/mllp-component.adoc index a96184c..2c776b1 100644 --- a/components/camel-mllp/src/main/docs/mllp-component.adoc +++ b/components/camel-mllp/src/main/docs/mllp-component.adoc @@ -55,7 +55,7 @@ The MLLP component has no options. // endpoint options: START -The MLLP component supports 19 endpoint options which are listed below: +The MLLP component supports 22 endpoint options which are listed below: {% raw %} [width="100%",cols="2,1,1m,1m,5",options="header"] @@ -64,6 +64,7 @@ The MLLP component supports 19 endpoint options which are listed below: | hostname | common | | String | *Required* Hostname or IP for connection for the TCP connection. The default value is null which means any local IP address | port | common | | int | *Required* Port number for the TCP connection | autoAck | common | true | boolean | Enable/Disable the automatic generation of a MLLP Acknowledgement MLLP Consumers only +| hl7Headers | common | true | boolean | Enable/Disable the automatic generation of message headers from the HL7 Message MLLP Consumers only | keepAlive | common | true | boolean | Enable/disable the SO_KEEPALIVE socket option. | reuseAddress | common | false | boolean | Enable/disable the SO_REUSEADDR socket option. | tcpNoDelay | common | true | boolean | Enable/disable the TCP_NODELAY socket option. @@ -79,6 +80,8 @@ The MLLP component supports 19 endpoint options which are listed below: | bindRetryInterval | timeout | 5000 | int | TCP Server Only - The number of milliseconds to wait between bind attempts | bindTimeout | timeout | 3 | int | TCP Server Only - The number of milliseconds to retry binding to a server port | connectTimeout | timeout | 3 | int | Timeout value for establishing for a TCP connection TCP Client only +| maxReceiveTimeouts | timeout | -1 | int | The maximum number of timeouts (specified by receiveTimeout) allowed before the TCP Connection will be reset. +| readTimeout | timeout | 500 | int | The SO_TIMEOUT value used after the start of an MLLP frame has been received | receiveTimeout | timeout | 1 | int | The SO_TIMEOUT value used when waiting for the start of an MLLP frame |=== {% endraw %} http://git-wip-us.apache.org/repos/asf/camel/blob/4b545ae7/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java -- diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java index 6a85b9c..7a3c195 100644 --- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java +++ b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java @@ -72,6 +72,12 @@ public class MllpEndpoint extends DefaultEndpoint { @UriParam(label = "timeout", defaultValue = "1") int receiveTimeout = 1; +@UriParam(label = "timeout", defaultValue = "-1") +int maxReceiveTimeouts = -1; + +@UriParam(label = "timeout", defaultValue = "500") +int readTimeout = 500; + @UriParam(defaultValue = "true") boolean keepAlive = true; @@ -90,6 +96,9 @@ public class MllpEndpoint extends DefaultEndpoint { @UriParam(defaultValue = "true") boolean autoAck =
[1/2] camel git commit: CAMEL-10242 - added units to javadoc for timeouts and buffer sizes
Repository: camel Updated Branches: refs/heads/master 9a5778bb6 -> 52db6bc88 CAMEL-10242 - added units to javadoc for timeouts and buffer sizes Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/52db6bc8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/52db6bc8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/52db6bc8 Branch: refs/heads/master Commit: 52db6bc8843946fc17c9696f6885f2a1494275e1 Parents: 4b545ae Author: Quinn StevensonAuthored: Tue Sep 6 13:11:29 2016 -0600 Committer: Claus Ibsen Committed: Tue Sep 6 21:22:33 2016 +0200 -- components/camel-mllp/src/main/docs/mllp-component.adoc | 12 ++-- .../org/apache/camel/component/mllp/MllpEndpoint.java | 12 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/52db6bc8/components/camel-mllp/src/main/docs/mllp-component.adoc -- diff --git a/components/camel-mllp/src/main/docs/mllp-component.adoc b/components/camel-mllp/src/main/docs/mllp-component.adoc index 2c776b1..ef7e904 100644 --- a/components/camel-mllp/src/main/docs/mllp-component.adoc +++ b/components/camel-mllp/src/main/docs/mllp-component.adoc @@ -72,17 +72,17 @@ The MLLP component supports 22 endpoint options which are listed below: | 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. | backlog | advanced | 5 | int | The maximum queue length for incoming connection indications (a request to connect) is set to the backlog parameter. If a connection indication arrives when the queue is full the connection is refused. | exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange -| receiveBufferSize | advanced | | Integer | Sets the SO_RCVBUF option to the specified value -| sendBufferSize | advanced | | Integer | Sets the SO_SNDBUF option to the specified value +| receiveBufferSize | advanced | | Integer | Sets the SO_RCVBUF option to the specified value (in bytes) +| sendBufferSize | advanced | | Integer | Sets the SO_SNDBUF option to the specified value (in bytes) | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | charsetName | codec | | String | Set the CamelCharsetName property on the exchange -| acceptTimeout | timeout | 6 | int | Timeout value while waiting for a TCP connection TCP Server Only +| acceptTimeout | timeout | 6 | int | Timeout (in milliseconds) while waiting for a TCP connection TCP Server Only | bindRetryInterval | timeout | 5000 | int | TCP Server Only - The number of milliseconds to wait between bind attempts | bindTimeout | timeout | 3 | int | TCP Server Only - The number of milliseconds to retry binding to a server port -| connectTimeout | timeout | 3 | int | Timeout value for establishing for a TCP connection TCP Client only +| connectTimeout | timeout | 3 | int | Timeout (in milliseconds) for establishing for a TCP connection TCP Client only | maxReceiveTimeouts | timeout | -1 | int | The maximum number of timeouts (specified by receiveTimeout) allowed before the TCP Connection will be reset. -| readTimeout | timeout | 500 | int | The SO_TIMEOUT value used after the start of an MLLP frame has been received -| receiveTimeout | timeout | 1 | int | The SO_TIMEOUT value used when waiting for the start of an MLLP frame +| readTimeout | timeout | 500 | int | The SO_TIMEOUT value (in milliseconds) used after the start of an MLLP frame has been received +| receiveTimeout | timeout | 1 | int | The SO_TIMEOUT value (in milliseconds) used when waiting for the start of an MLLP frame |=== {% endraw %} // endpoint options: END http://git-wip-us.apache.org/repos/asf/camel/blob/52db6bc8/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java -- diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java index 7a3c195..1fc0ec7 100644 --- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java +++
camel git commit: Components/dataformats/languages docs update
Repository: camel Updated Branches: refs/heads/master 0be929fe8 -> 9a5778bb6 Components/dataformats/languages docs update Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9a5778bb Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9a5778bb Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9a5778bb Branch: refs/heads/master Commit: 9a5778bb6751b46ccf197840bde19e0d98a73153 Parents: 0be929f Author: Andrea CosentinoAuthored: Tue Sep 6 15:56:01 2016 +0200 Committer: Andrea Cosentino Committed: Tue Sep 6 16:06:05 2016 +0200 -- .../src/main/docs/dropbox-component.adoc| 37 +++-- .../src/main/docs/elsql-component.adoc | 152 +-- .../src/main/docs/eventadmin-component.adoc | 31 +++- .../src/main/docs/exec-component.adoc | 53 +++ .../src/main/docs/flatpack-component.adoc | 55 --- .../src/main/docs/flatpack-dataformat.adoc | 38 ++--- .../src/main/docs/hessian-dataformat.adoc | 7 + .../src/main/docs/ical-dataformat.adoc | 18 +++ .../src/main/docs/jibx-dataformat.adoc | 20 +++ .../camel-jmx/src/main/docs/jmx-component.adoc | 50 ++ .../camel-lzf/src/main/docs/lzf-dataformat.adoc | 18 ++- .../src/main/docs/quickfix-component.adoc | 40 + .../src/main/docs/syslog-dataformat.adoc| 12 +- .../src/main/docs/zookeeper-component.adoc | 22 +++ 14 files changed, 377 insertions(+), 176 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/9a5778bb/components/camel-dropbox/src/main/docs/dropbox-component.adoc -- diff --git a/components/camel-dropbox/src/main/docs/dropbox-component.adoc b/components/camel-dropbox/src/main/docs/dropbox-component.adoc index 84c4a50..6fc5d04 100644 --- a/components/camel-dropbox/src/main/docs/dropbox-component.adoc +++ b/components/camel-dropbox/src/main/docs/dropbox-component.adoc @@ -72,16 +72,33 @@ You can refer to the https://www.dropbox.com/developers/core/start/java[Dropbox documentation] that expalins how to get them.  -Below are listed the mandatory options for all operations: - -[width="100%",cols="20%,20%,60%",options="header",] -|=== -|Property |Mandatory |Description - -|`accessToken` |`true` |The access token to make API requests for a specific Dropbox user - -|`clientIdentifier` |`true` |Name of the app registered to make API requests -|=== +// component options: START +The Dropbox component has no options. +// component options: END + +// endpoint options: START +The Dropbox component supports 13 endpoint options which are listed below: + +{% raw %} +[width="100%",cols="2,1,1m,1m,5",options="header"] +|=== +| Name | Group | Default | Java Type | Description +| operation | common | | DropboxOperation | *Required* The specific action (typically is a CRUD action) to perform on Dropbox remote folder. +| accessToken | common | | String | *Required* The access token to make API requests for a specific Dropbox user +| client | common | | DbxClient | To use an existing DbxClient instance as DropBox client. +| clientIdentifier | common | | String | *Required* Name of the app registered to make API requests +| localPath | common | | String | Folder or file to upload on Dropbox from the local filesystem. +| newRemotePath | common | | String | Destination file or folder +| query | common | | String | A space-separated list of substrings to search for. A file matches only if it contains all the substrings. If this option is not set all files will be matched. +| remotePath | common | | String | Original file or folder to move +| uploadMode | common | | DropboxUploadMode | Which mode to upload. in case of add the new file will be renamed if a file with the same name already exists on dropbox. in case of force if a file with the same name already exists on dropbox this will be overwritten. +| 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. +| exceptionHandler | consumer (advanced) | | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option
camel git commit: Component docs. Allow to make build fail fast so we can easier see which components have adoc problems.
Repository: camel Updated Branches: refs/heads/master d6bcef78a -> 0be929fe8 Component docs. Allow to make build fail fast so we can easier see which components have adoc problems. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0be929fe Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0be929fe Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0be929fe Branch: refs/heads/master Commit: 0be929fe890f8593cb6a59a9bb2ae48ba4de8cd8 Parents: d6bcef7 Author: Claus IbsenAuthored: Tue Sep 6 14:44:32 2016 +0200 Committer: Claus Ibsen Committed: Tue Sep 6 14:44:32 2016 +0200 -- .../src/main/docs/base64-dataformat.adoc| 18 +- .../src/main/docs/castor-dataformat.adoc| 22 +- .../src/main/docs/crypto-dataformat.adoc| 295 +++ .../src/main/docs/pgp-dataformat.adoc | 13 +- .../camel-csv/src/main/docs/csv-dataformat.adoc | 148 +++--- .../src/main/docs/docker-component.adoc | 221 +- .../src/main/docs/dozer-component.adoc | 46 ++- .../src/main/docs/jaxb-dataformat.adoc | 33 +++ .../src/main/docs/servlet-component.adoc| 62 ++-- components/pom.xml | 4 + .../maven/packaging/PrepareCatalogMojo.java | 2 - .../maven/packaging/ReadmeComponentMojo.java| 32 ++ 12 files changed, 575 insertions(+), 321 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/0be929fe/components/camel-base64/src/main/docs/base64-dataformat.adoc -- diff --git a/components/camel-base64/src/main/docs/base64-dataformat.adoc b/components/camel-base64/src/main/docs/base64-dataformat.adoc index dec53c5..f0d76cd 100644 --- a/components/camel-base64/src/main/docs/base64-dataformat.adoc +++ b/components/camel-base64/src/main/docs/base64-dataformat.adoc @@ -10,11 +10,21 @@ http://en.wikipedia.org/wiki/Base64[base64 encoding and decoding]. Options ^^^ -// component options: START -// component options: END +// dataformat options: START +The Base64 dataformat supports 3 options which are listed below. -// endpoint options: START -// endpoint options: END + + +{% raw %} +[width="100%",cols="2s,1m,1m,6",options="header"] +|=== +| Name | Default | Java Type | Description +| lineLength | 76 | Integer | To specific a maximum line length for the encoded data. By default 76 is used. +| lineSeparator | \r\n | String | The line separators to use. By default \r\n is used. +| urlSafe | false | Boolean | Instead of emitting '' and '/' we emit '-' and '_' respectively. urlSafe is only applied to encode operations. Decoding seamlessly handles both modes. Is by default false. +|=== +{% endraw %} +// dataformat options: END In Spring DSL, you configure the data format using this tag: http://git-wip-us.apache.org/repos/asf/camel/blob/0be929fe/components/camel-castor/src/main/docs/castor-dataformat.adoc -- diff --git a/components/camel-castor/src/main/docs/castor-dataformat.adoc b/components/camel-castor/src/main/docs/castor-dataformat.adoc index f09723d..f649094 100644 --- a/components/camel-castor/src/main/docs/castor-dataformat.adoc +++ b/components/camel-castor/src/main/docs/castor-dataformat.adoc @@ -112,11 +112,23 @@ on multiple routes. You have to set the element directly in Options ^^^ -// component options: START -// component options: END - -// endpoint options: START -// endpoint options: END +// dataformat options: START +The Castor dataformat supports 5 options which are listed below. + + + +{% raw %} +[width="100%",cols="2s,1m,1m,6",options="header"] +|=== +| Name | Default | Java Type | Description +| mappingFile | | String | Path to a Castor mapping file to load from the classpath. +| validation | true | Boolean | Whether validation is turned on or off. Is by default true. +| encoding | UTF-8 | String | Encoding to use when marshalling an Object to XML. Is by default UTF-8 +| packages | | String[] | Add additional packages to Castor XmlContext +| classes | | String[] | Add additional class names to Castor XmlContext +|=== +{% endraw %} +// dataformat options: END [[Castor-Dependencies]] Dependencies http://git-wip-us.apache.org/repos/asf/camel/blob/0be929fe/components/camel-crypto/src/main/docs/crypto-dataformat.adoc --
camel git commit: Upgrade flink
Repository: camel Updated Branches: refs/heads/master 9025b8c32 -> d6bcef78a Upgrade flink Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d6bcef78 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d6bcef78 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d6bcef78 Branch: refs/heads/master Commit: d6bcef78ade9c92c371ae9301302df3afdb6e746 Parents: 9025b8c Author: Claus IbsenAuthored: Tue Sep 6 12:16:56 2016 +0200 Committer: Claus Ibsen Committed: Tue Sep 6 12:16:56 2016 +0200 -- parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d6bcef78/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 7e2e061..388ab64 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -188,7 +188,7 @@ 1.9.12 2.5.2 3.4.3 -1.1.0 +1.1.2 2.1_1 2.1 1.0.6
[2/2] camel git commit: CAMEL-10271: Fixed camel-jt400 consumer to be scheduled so it reads from the queue as the jt400 library is not event based.
CAMEL-10271: Fixed camel-jt400 consumer to be scheduled so it reads from the queue as the jt400 library is not event based. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a5ae45e7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a5ae45e7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a5ae45e7 Branch: refs/heads/camel-2.17.x Commit: a5ae45e7673f916961dd946485926618386e Parents: b6424e7 Author: Claus IbsenAuthored: Tue Sep 6 12:12:47 2016 +0200 Committer: Claus Ibsen Committed: Tue Sep 6 12:13:18 2016 +0200 -- .../org/apache/camel/component/jt400/Jt400DataQueueConsumer.java | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a5ae45e7/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 6bf9788..e86008e 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 @@ -63,10 +63,12 @@ public class Jt400DataQueueConsumer extends ScheduledPollConsumer { @Override protected void doStart() throws Exception { queueService.start(); +super.doStart(); } @Override protected void doStop() throws Exception { +super.doStop(); queueService.stop(); }
[1/2] camel git commit: CAMEL-10271: Fixed camel-jt400 consumer to be scheduled so it reads from the queue as the jt400 library is not event based.
Repository: camel Updated Branches: refs/heads/camel-2.17.x b6424e7b0 -> a5ae45e76 refs/heads/master b7857a965 -> 9025b8c32 CAMEL-10271: Fixed camel-jt400 consumer to be scheduled so it reads from the queue as the jt400 library is not event based. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9025b8c3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9025b8c3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9025b8c3 Branch: refs/heads/master Commit: 9025b8c32489ac078aa59a2687e4ac7b7d2cf928 Parents: b7857a9 Author: Claus IbsenAuthored: Tue Sep 6 12:12:47 2016 +0200 Committer: Claus Ibsen Committed: Tue Sep 6 12:12:47 2016 +0200 -- .../org/apache/camel/component/jt400/Jt400DataQueueConsumer.java | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/9025b8c3/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 6bf9788..e86008e 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 @@ -63,10 +63,12 @@ public class Jt400DataQueueConsumer extends ScheduledPollConsumer { @Override protected void doStart() throws Exception { queueService.start(); +super.doStart(); } @Override protected void doStop() throws Exception { +super.doStop(); queueService.stop(); }
[1/2] camel git commit: Added automatic dataformat options docs generation for xmlBeans dataformat
Repository: camel Updated Branches: refs/heads/master 6024c9f27 -> b7857a965 Added automatic dataformat options docs generation for xmlBeans dataformat Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b7857a96 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b7857a96 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b7857a96 Branch: refs/heads/master Commit: b7857a965fbe73e207dd4b106aac22ad2bd9d73d Parents: a652af3 Author: Andrea CosentinoAuthored: Tue Sep 6 10:55:11 2016 +0200 Committer: Andrea Cosentino Committed: Tue Sep 6 10:56:57 2016 +0200 -- .../src/main/docs/xmlBeans-dataformat.adoc| 18 ++ 1 file changed, 18 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b7857a96/components/camel-xmlbeans/src/main/docs/xmlBeans-dataformat.adoc -- diff --git a/components/camel-xmlbeans/src/main/docs/xmlBeans-dataformat.adoc b/components/camel-xmlbeans/src/main/docs/xmlBeans-dataformat.adoc index 1b960c6..612ac26 100644 --- a/components/camel-xmlbeans/src/main/docs/xmlBeans-dataformat.adoc +++ b/components/camel-xmlbeans/src/main/docs/xmlBeans-dataformat.adoc @@ -14,6 +14,24 @@ from("activemq:My.Queue"). to("mqseries:Another.Queue"); --- +[[XmlBeans-Options]] +Options +^^^ + +// dataformat options: START +The XML Beans dataformat supports 1 options which are listed below. + + + +{% raw %} +[width="100%",cols="2s,1m,1m,6",options="header"] +|=== +| Name | Default | Java Type | Description +| prettyPrint | false | Boolean | To enable pretty printing output nicely formatted. Is by default false. +|=== +{% endraw %} +// dataformat options: END + [[XmlBeans-Dependencies]] Dependencies
[2/2] camel git commit: Added automatic dataformat options docs generation to xmljson dataformat
Added automatic dataformat options docs generation to xmljson dataformat Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a652af31 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a652af31 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a652af31 Branch: refs/heads/master Commit: a652af315e0be974621b4301c5182f20c8f6511a Parents: 6024c9f Author: Andrea CosentinoAuthored: Tue Sep 6 10:54:03 2016 +0200 Committer: Andrea Cosentino Committed: Tue Sep 6 10:56:57 2016 +0200 -- .../src/main/docs/xmljson-dataformat.adoc | 121 --- 1 file changed, 21 insertions(+), 100 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a652af31/components/camel-xmljson/src/main/docs/xmljson-dataformat.adoc -- diff --git a/components/camel-xmljson/src/main/docs/xmljson-dataformat.adoc b/components/camel-xmljson/src/main/docs/xmljson-dataformat.adoc index c5fc195..9a9528b 100644 --- a/components/camel-xmljson/src/main/docs/xmljson-dataformat.adoc +++ b/components/camel-xmljson/src/main/docs/xmljson-dataformat.adoc @@ -23,109 +23,30 @@ semantics are assigned as follows: Options ^^^ -This data format supports the following options. You can set them via -all DSLs. The defaults marked with (*) are determined by json-lib, -rather than the code of the data format itself. They are reflected here -for convenience so that you don't have to dot back and forth with the -json-lib docs. +// dataformat options: START +The XML JSon dataformat supports 12 options which are listed below. -[width="100%",cols="1s,1m,1m,4",options="header",] + + +{% raw %} +[width="100%",cols="2s,1m,1m,6",options="header"] |=== -|Name |Type |Default |Description -|`encoding` |`String` |UTF-8 (*) |*Used when* *unmarshalling* *(JSON to -XML conversion).* Sets the encoding for the call to -http://json-lib.sourceforge.net/apidocs/net/sf/json/xml/XMLSerializer.html#write(net.sf.json.JSON,%20java.lang.String)[`XMLSerializer.write()`] -method, hence it is only used when producing XML. + -When producing JSON, the encoding is determined by the input String -being processed. If the conversion is performed on an InputStream, -json-lib uses the platform's default encoding (e.g. determined by the -`file.encoding` system property). - -|`elementName` |`String` |'e' (*) |*Used when* *unmarshalling*** (JSON -to XML conversion).** Specifies the name of the XML elements -representing each array element. See -http://json-lib.sourceforge.net/snippets.html#JSONObject_to_XML_change_node_names[json-lib -doc]. - -|`arrayName` |`String` |'a' (*) |*Used when* *unmarshalling*** (JSON to -XML conversion).** Specifies the name of the top-level XML element. + -For example, when converting `[1, 2, 3]`, it will be output by default -as `123`. By setting this option or -rootName, you can alter the name of element 'a'. - -|`rootName` |`String` |none (*) |*Used when* *unmarshalling*** (JSON to -XML conversion).** When converting any JSON construct (object, array, -null) to XML (unmarshalling), it specifies the name of the top-level -element. + -If not set, json-lib will use `arrayName` or `objectName` (default -value: 'o', at the current time it is not configurable in this data -format). If set to 'root', the JSON string `{ 'x': 'value1', 'y' : -'value2' }` would turn into `value1value2`, -otherwise the 'root' element would be named 'o'. - -|`namespaceLenient` |`Boolean` |false (*) |*Used when* -*unmarshalling*** (JSON to XML conversion).** According to the json-lib -docs: "Flag to be tolerant to incomplete namespace prefixes." In most -cases, json-lib automatically changes this flag at runtime to match the -processing. - -|`namespaceMappings` |`List` |none |*Used -when* *unmarshalling*** (JSON to XML conversion).** Binds namespace -prefixes and URIs to specific JSON -elements. `NamespacesPerElementMapping` is a wrapper around an element -name + a Map of prefixes against URIs. - -|`expandableProperties` |`List` |none |*Used when* -*unmarshalling*** (JSON to XML conversion).** With expandable -properties, JSON array elements are converted to XML as a sequence of -repetitive XML elements with the local name equal to the JSON key, for -example: `{ number: 1,2,3 }`, normally converted to: -`123` (where e can be modified by -setting `elementName`), would instead translate to -`123`, if `number` is -set as an expandable property - -|`typeHints` |`TypeHintsEnum` |YES a| -*Used when* *unmarshalling*** (JSON to XML conversion).** Adds type -hints to the resulting XML to aid conversion back to JSON. See -documentation
[1/2] camel git commit: CAMEL-10064: Extra request parameter sent by the camel-jetty component when using bridge mode.
Repository: camel Updated Branches: refs/heads/camel-2.17.x 77e417c27 -> b6424e7b0 refs/heads/master 8129b1a78 -> 6024c9f27 CAMEL-10064: Extra request parameter sent by the camel-jetty component when using bridge mode. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6024c9f2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6024c9f2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6024c9f2 Branch: refs/heads/master Commit: 6024c9f2740a1b2e8277a4a3d25510ef9ee9946d Parents: 8129b1a Author: Claus IbsenAuthored: Tue Sep 6 10:48:20 2016 +0200 Committer: Claus Ibsen Committed: Tue Sep 6 10:48:20 2016 +0200 -- .../component/jetty/JettyHttpComponent.java | 5 +++ .../JettyHttpProducerBridgeTest.java| 39 2 files changed, 44 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/6024c9f2/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java -- diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java index 9da1ffe..70583c8 100644 --- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java +++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java @@ -298,6 +298,11 @@ public abstract class JettyHttpComponent extends HttpCommonComponent implements endpoint.setSendServerVersion(isSendServerVersion()); setProperties(endpoint, parameters); + +// re-create http uri after all parameters has been set on the endpoint, as the remainders are for http uri +httpUri = URISupport.createRemainingURI(addressUri, parameters); +endpoint.setHttpUri(httpUri); + return endpoint; } http://git-wip-us.apache.org/repos/asf/camel/blob/6024c9f2/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java -- diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java index 8c784e4..64e592e 100644 --- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java +++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java @@ -33,8 +33,46 @@ public class JettyHttpProducerBridgeTest extends BaseJettyTest { // give Jetty time to startup properly Thread.sleep(2000); +getMockEndpoint("mock:bar").expectedMessageCount(1); + getMockEndpoint("mock:bar").message(0).header("bridgeEndpoint").isNull(); + getMockEndpoint("mock:bar").message(0).header("throwExceptionOnFailure").isNull(); + String reply = template.requestBody("jetty:http://127.0.0.1:; + port1 + "/foo", "World", String.class); assertEquals("Bye World", reply); + +assertMockEndpointsSatisfied(); +} + +@Test +public void testProxyWithHeader() throws Exception { +// give Jetty time to startup properly +Thread.sleep(2000); + +getMockEndpoint("mock:bar").expectedMessageCount(1); +getMockEndpoint("mock:bar").expectedHeaderReceived("beer", "Carlsberg"); + getMockEndpoint("mock:bar").message(0).header("bridgeEndpoint").isNull(); + getMockEndpoint("mock:bar").message(0).header("throwExceptionOnFailure").isNull(); + +String reply = template.requestBodyAndHeader("jetty:http://127.0.0.1:; + port1 + "/foo", "Camel", "beer", "Carlsberg", String.class); +assertEquals("Bye Camel", reply); + +assertMockEndpointsSatisfied(); +} + +@Test +public void testProxyWithQueryParameter() throws Exception { +// give Jetty time to startup properly +Thread.sleep(2000); + +getMockEndpoint("mock:bar").expectedMessageCount(1); +getMockEndpoint("mock:bar").expectedHeaderReceived("beer", "Carlsberg"); + getMockEndpoint("mock:bar").message(0).header("bridgeEndpoint").isNull(); + getMockEndpoint("mock:bar").message(0).header("throwExceptionOnFailure").isNull(); + +String reply = template.requestBody("jetty:http://127.0.0.1:; + port1 + "/foo?beer=Carlsberg", "Apache", String.class); +assertEquals("Bye Apache",
[2/2] camel git commit: CAMEL-10064: Extra request parameter sent by the camel-jetty component when using bridge mode.
CAMEL-10064: Extra request parameter sent by the camel-jetty component when using bridge mode. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b6424e7b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b6424e7b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b6424e7b Branch: refs/heads/camel-2.17.x Commit: b6424e7b04f51b52d3eadd12c9adc446686ed463 Parents: 77e417c Author: Claus IbsenAuthored: Tue Sep 6 10:48:20 2016 +0200 Committer: Claus Ibsen Committed: Tue Sep 6 10:48:50 2016 +0200 -- .../component/jetty/JettyHttpComponent.java | 5 +++ .../JettyHttpProducerBridgeTest.java| 39 2 files changed, 44 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b6424e7b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java -- diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java index b222d1c..33fe88c 100644 --- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java +++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java @@ -287,6 +287,11 @@ public abstract class JettyHttpComponent extends HttpCommonComponent implements } setProperties(endpoint, parameters); + +// re-create http uri after all parameters has been set on the endpoint, as the remainders are for http uri +httpUri = URISupport.createRemainingURI(addressUri, parameters); +endpoint.setHttpUri(httpUri); + return endpoint; } http://git-wip-us.apache.org/repos/asf/camel/blob/b6424e7b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java -- diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java index 8c784e4..64e592e 100644 --- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java +++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerBridgeTest.java @@ -33,8 +33,46 @@ public class JettyHttpProducerBridgeTest extends BaseJettyTest { // give Jetty time to startup properly Thread.sleep(2000); +getMockEndpoint("mock:bar").expectedMessageCount(1); + getMockEndpoint("mock:bar").message(0).header("bridgeEndpoint").isNull(); + getMockEndpoint("mock:bar").message(0).header("throwExceptionOnFailure").isNull(); + String reply = template.requestBody("jetty:http://127.0.0.1:; + port1 + "/foo", "World", String.class); assertEquals("Bye World", reply); + +assertMockEndpointsSatisfied(); +} + +@Test +public void testProxyWithHeader() throws Exception { +// give Jetty time to startup properly +Thread.sleep(2000); + +getMockEndpoint("mock:bar").expectedMessageCount(1); +getMockEndpoint("mock:bar").expectedHeaderReceived("beer", "Carlsberg"); + getMockEndpoint("mock:bar").message(0).header("bridgeEndpoint").isNull(); + getMockEndpoint("mock:bar").message(0).header("throwExceptionOnFailure").isNull(); + +String reply = template.requestBodyAndHeader("jetty:http://127.0.0.1:; + port1 + "/foo", "Camel", "beer", "Carlsberg", String.class); +assertEquals("Bye Camel", reply); + +assertMockEndpointsSatisfied(); +} + +@Test +public void testProxyWithQueryParameter() throws Exception { +// give Jetty time to startup properly +Thread.sleep(2000); + +getMockEndpoint("mock:bar").expectedMessageCount(1); +getMockEndpoint("mock:bar").expectedHeaderReceived("beer", "Carlsberg"); + getMockEndpoint("mock:bar").message(0).header("bridgeEndpoint").isNull(); + getMockEndpoint("mock:bar").message(0).header("throwExceptionOnFailure").isNull(); + +String reply = template.requestBody("jetty:http://127.0.0.1:; + port1 + "/foo?beer=Carlsberg", "Apache", String.class); +assertEquals("Bye Apache", reply); + +assertMockEndpointsSatisfied(); } @Override @@ -49,6 +87,7 @@ public class JettyHttpProducerBridgeTest extends BaseJettyTest {
camel git commit: CAMEL-10164: Add support for binding in rest to
Repository: camel Updated Branches: refs/heads/master 7f7ce39d2 -> 8129b1a78 CAMEL-10164: Add support for binding in rest to Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8129b1a7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8129b1a7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8129b1a7 Branch: refs/heads/master Commit: 8129b1a784b307d2a0b576c8f46c046c7739d762 Parents: 7f7ce39 Author: Claus IbsenAuthored: Tue Sep 6 10:07:53 2016 +0200 Committer: Claus Ibsen Committed: Tue Sep 6 10:07:53 2016 +0200 -- .../rest/RestProducerBindingProcessor.java | 36 1 file changed, 22 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/8129b1a7/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java b/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java index b1d879e..db838a1 100644 --- a/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java +++ b/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java @@ -62,28 +62,24 @@ public class RestProducerBindingProcessor extends DelegateAsyncProcessor { this.camelContext = camelContext; -if (jsonDataFormat != null) { +if (outJsonDataFormat != null) { this.jsonUnmarshal = new UnmarshalProcessor(outJsonDataFormat); } else { this.jsonUnmarshal = null; } -if (outJsonDataFormat != null) { +if (jsonDataFormat != null) { this.jsonMarshal = new MarshalProcessor(jsonDataFormat); -} else if (jsonDataFormat != null) { -this.jsonMarshal = new MarshalProcessor(outJsonDataFormat); } else { this.jsonMarshal = null; } -if (xmlDataFormat != null) { +if (outXmlDataFormat != null) { this.xmlUnmarshal = new UnmarshalProcessor(outXmlDataFormat); } else { this.xmlUnmarshal = null; } -if (outXmlDataFormat != null) { +if (xmlDataFormat != null) { this.xmlMarshal = new MarshalProcessor(xmlDataFormat); -} else if (xmlDataFormat != null) { -this.xmlMarshal = new MarshalProcessor(outXmlDataFormat); } else { this.xmlMarshal = null; } @@ -139,18 +135,30 @@ public class RestProducerBindingProcessor extends DelegateAsyncProcessor { } // we only need to perform before binding if the message body is POJO based -// if its convertable to stream based then its not POJO based -InputStream is = camelContext.getTypeConverter().tryConvertTo(InputStream.class, exchange, body); -if (is != null) { -exchange.getIn().setBody(is); +if (body instanceof String || body instanceof byte[]) { +// the body is text based and thus not POJO so no binding needed if (outType != null) { // wrap callback to add reverse operation if we know the output type from the REST service callback = new RestProducerBindingUnmarshalCallback(exchange, callback, jsonMarshal, xmlMarshal, false); } // okay now we can continue routing to the producer return getProcessor().process(exchange, callback); +} else { +// if its convertable to stream based then its not POJO based +InputStream is = camelContext.getTypeConverter().tryConvertTo(InputStream.class, exchange, body); +if (is != null) { +exchange.getIn().setBody(is); +if (outType != null) { +// wrap callback to add reverse operation if we know the output type from the REST service +callback = new RestProducerBindingUnmarshalCallback(exchange, callback, jsonMarshal, xmlMarshal, false); +} +// okay now we can continue routing to the producer +return getProcessor().process(exchange, callback); +} } +// assume body is POJO based and binding needed + String contentType = ExchangeHelper.getContentType(exchange); if (contentType != null) { isXml = contentType.toLowerCase(Locale.ENGLISH).contains("xml"); @@ -306,8 +314,8 @@ public class RestProducerBindingProcessor extends DelegateAsyncProcessor { return; } -// is there any
[2/3] camel git commit: CAMEL-10291: add test case timestamp as date value for producer
CAMEL-10291: add test case timestamp as date value for producer Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9c278bb3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9c278bb3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9c278bb3 Branch: refs/heads/master Commit: 9c278bb33ee7e4424034c570d41fb9fa2991dc07 Parents: 65d372f Author: Florian GessnerAuthored: Tue Sep 6 07:30:50 2016 +0200 Committer: Florian Gessner Committed: Tue Sep 6 07:30:50 2016 +0200 -- .../camel/component/rabbitmq/RabbitMQProducerTest.java | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/9c278bb3/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java -- diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java index ee72d8a..523e5c7 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java @@ -152,7 +152,7 @@ public class RabbitMQProducerTest { } @Test -public void testPropertiesUsesTimestampHeader() throws IOException { +public void testPropertiesUsesTimestampHeaderAsLongValue() throws IOException { RabbitMQProducer producer = new RabbitMQProducer(endpoint); message.setHeader(RabbitMQConstants.TIMESTAMP, "12345123"); AMQP.BasicProperties props = producer.buildProperties(exchange).build(); @@ -160,6 +160,15 @@ public class RabbitMQProducerTest { } @Test +public void testPropertiesUsesTimestampHeaderAsDateValue() throws IOException { +Date timestamp = new Date(); +RabbitMQProducer producer = new RabbitMQProducer(endpoint); +message.setHeader(RabbitMQConstants.TIMESTAMP, timestamp); +AMQP.BasicProperties props = producer.buildProperties(exchange).build(); +assertEquals(timestamp, props.getTimestamp()); +} + +@Test public void testPropertiesUsesCustomHeaders() throws IOException { RabbitMQProducer producer = new RabbitMQProducer(endpoint); Map customHeaders = new HashMap ();
[1/3] camel git commit: CAMEL-10291: support java.util.date for timestamps in rabbitmq messages
Repository: camel Updated Branches: refs/heads/master 4a5d8297e -> 7f7ce39d2 CAMEL-10291: support java.util.date for timestamps in rabbitmq messages Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/65d372f5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/65d372f5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/65d372f5 Branch: refs/heads/master Commit: 65d372f587aa79479753068533fd8b4aa52671ec Parents: 4a5d829 Author: Florian GessnerAuthored: Mon Sep 5 21:38:08 2016 +0200 Committer: Florian Gessner Committed: Mon Sep 5 21:38:08 2016 +0200 -- .../rabbitmq/RabbitMQMessageConverter.java | 9 +- .../rabbitmq/RabbitMQConsumerIntTest.java | 32 2 files changed, 40 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/65d372f5/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java -- diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java index 1873674..b29b3cf 100644 --- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java +++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java @@ -152,7 +152,7 @@ public class RabbitMQMessageConverter { final Object timestamp = msg.removeHeader(RabbitMQConstants.TIMESTAMP); if (timestamp != null) { -properties.timestamp(new Date(Long.parseLong(timestamp.toString(; +properties.timestamp(convertTimestamp(timestamp)); } final Map headers = msg.getHeaders(); @@ -179,6 +179,13 @@ public class RabbitMQMessageConverter { return properties; } +private Date convertTimestamp(Object timestamp) { +if(timestamp instanceof Date){ +return (Date)timestamp; +} +return new Date(Long.parseLong(timestamp.toString())); +} + /** * Strategy to test if the given header is valid. Without this, the * com.rabbitmq.client.impl.Frame.java class will throw an http://git-wip-us.apache.org/repos/asf/camel/blob/65d372f5/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java -- diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java index 2066380..91cefb2 100644 --- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java +++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java @@ -17,6 +17,8 @@ package org.apache.camel.component.rabbitmq; import java.io.IOException; +import java.util.Calendar; +import java.util.Date; import java.util.concurrent.TimeoutException; import com.rabbitmq.client.AMQP; @@ -74,5 +76,35 @@ public class RabbitMQConsumerIntTest extends CamelTestSupport { to.assertIsSatisfied(); } + +@Test +public void sentMessageWithTimestampIsReceived() throws InterruptedException, IOException, TimeoutException { +Date timestamp = currentTimestampWithoutMillis(); + +to.expectedMessageCount(1); +to.expectedHeaderReceived(RabbitMQConstants.TIMESTAMP, timestamp); + +ConnectionFactory factory = new ConnectionFactory(); +factory.setHost("localhost"); +factory.setPort(5672); +factory.setUsername("cameltest"); +factory.setPassword("cameltest"); +factory.setVirtualHost("/"); +Connection conn = factory.newConnection(); + +AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder(); +properties.timestamp(timestamp); + +Channel channel = conn.createChannel(); +channel.basicPublish(EXCHANGE, "", properties.build(), "hello world".getBytes()); + +to.assertIsSatisfied(); +} + +private Date currentTimestampWithoutMillis() { +Calendar calendar = Calendar.getInstance(); +calendar.set(Calendar.MILLISECOND, 0); +return calendar.getTime(); +} }
[3/3] camel git commit: Fixed CS
Fixed CS Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7f7ce39d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7f7ce39d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7f7ce39d Branch: refs/heads/master Commit: 7f7ce39d2dd5b4242854d0a923a0aacc7d01a029 Parents: 9c278bb Author: Andrea CosentinoAuthored: Tue Sep 6 08:03:23 2016 +0200 Committer: Andrea Cosentino Committed: Tue Sep 6 08:03:23 2016 +0200 -- .../java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java | 2 +- .../apache/camel/component/rabbitmq/RabbitMQMessageConverter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/7f7ce39d/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java -- diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java index b503326..c5ef6c5 100644 --- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java +++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java @@ -71,7 +71,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint { @UriParam(label = "common", defaultValue = "true") private boolean durable = true; @UriParam(label = "common", defaultValue = "false") -private boolean exclusive = false; +private boolean exclusive; @UriParam(label = "producer") private boolean bridgeEndpoint; @UriParam(label = "common") http://git-wip-us.apache.org/repos/asf/camel/blob/7f7ce39d/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java -- diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java index b29b3cf..b0d72d9 100644 --- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java +++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java @@ -180,7 +180,7 @@ public class RabbitMQMessageConverter { } private Date convertTimestamp(Object timestamp) { -if(timestamp instanceof Date){ +if (timestamp instanceof Date) { return (Date)timestamp; } return new Date(Long.parseLong(timestamp.toString()));