FAQ
Component docs


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

Branch: refs/heads/master
Commit: 6b15b6536cae330b5a2bcadecaf1003bec27852b
Parents: 1cfbe4a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Jun 12 09:00:34 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Jun 12 09:00:34 2016 +0200

----------------------------------------------------------------------
  components/camel-jms/src/main/docs/jms.adoc | 14 +++++-
  .../camel/component/jms/JmsComponent.java | 46 ++++++++++++++++----
  .../camel/component/jms/JmsConfiguration.java | 36 ++++++++++++++-
  .../springboot/JmsComponentConfiguration.java | 26 +++++++++++
  4 files changed, 109 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6b15b653/components/camel-jms/src/main/docs/jms.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/docs/jms.adoc b/components/camel-jms/src/main/docs/jms.adoc
index 672d208..147c4ea 100644
--- a/components/camel-jms/src/main/docs/jms.adoc
+++ b/components/camel-jms/src/main/docs/jms.adoc
@@ -211,8 +211,9 @@ Component options



+
  // component options: START
-The JMS component supports 72 options which are listed below.
+The JMS component supports 74 options which are listed below.



@@ -234,6 +235,8 @@ The JMS component supports 72 options which are listed below.
concurrentConsumers | int | Specifies the default number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToConcurrentConsumers is used to control number of concurrent consumers on the reply message listener.
replyToConcurrentConsumers | int | Specifies the default number of concurrent consumers when doing request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads.
connectionFactory | ConnectionFactory | Sets the default connection factory to be use
+| username | String | Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
+| password | String | Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
deliveryPersistent | boolean | Specifies whether persistent delivery is used by default.
deliveryMode | Integer | Specifies the delivery mode to be used. Possible values are Possibles values are those defined by javax.jms.DeliveryMode. NON_PERSISTENT = 1 and PERSISTENT = 2.
durableSubscriptionName | String | The durable subscriber name for specifying durable topic subscriptions. The clientId option must be configured as well.
@@ -301,6 +304,7 @@ The JMS component supports 72 options which are listed below.



+
  [[JMS-Endpointoptions]]
  Endpoint options
  ++++++++++++++++
@@ -311,8 +315,9 @@ Endpoint options



+
  // endpoint options: START
-The JMS component supports 79 endpoint options which are listed below:
+The JMS component supports 83 endpoint options which are listed below:

  {% raw %}
  [width="100%",cols="2s,1,1m,1m,5",options="header"]
@@ -321,6 +326,7 @@ The JMS component supports 79 endpoint options which are listed below:
destinationType | common | queue | String | The kind of destination to use
destinationName | common | | String | *Required* Name of the queue or topic to use as destination
clientId | common | | String | Sets the JMS client ID to use. Note that this value if specified must be unique and can only be used by a single JMS connection instance. It is typically only required for durable topic subscriptions. If using Apache ActiveMQ you may prefer to use Virtual Topics instead.
+| connectionFactory | common | | ConnectionFactory | Sets the default connection factory to be used if a connection factory is not specified for either link setTemplateConnectionFactory(ConnectionFactory) or link setListenerConnectionFactory(ConnectionFactory)
disableReplyTo | common | false | boolean | If true a producer will behave like a InOnly exchange with the exception that JMSReplyTo header is sent out and not be suppressed like in the case of InOnly. Like InOnly the producer will not wait for a reply. A consumer with this flag will behave like InOnly. This feature can be used to bridge InOut requests to another queue so that a route on the other queue will send its response directly back to the original JMSReplyTo.
durableSubscriptionName | common | | String | The durable subscriber name for specifying durable topic subscriptions. The clientId option must be configured as well.
jmsMessageType | common | | JmsMessageType | Allows you to force the use of a specific javax.jms.Message implementation for sending JMS messages. Possible values are: Bytes Map Object Stream Text. By default Camel would determine which JMS message type to use from the In body type. This option allows you to specify it.
@@ -364,6 +370,7 @@ The JMS component supports 79 endpoint options which are listed below:
replyToDestinationSelectorName | producer (advanced) | | String | Sets the JMS Selector using the fixed name to be used so you can filter out your own replies from the others when using a shared queue (that is if you are not using a temporary reply queue).
asyncStartListener | advanced | false | boolean | Whether to startup the JmsConsumer message listener asynchronously when starting a route. For example if a JmsConsumer cannot get a connection to a remote JMS broker then it may block while retrying and/or failover. This will cause Camel to block while starting routes. By setting this option to true you will let routes startup while the JmsConsumer connects to the JMS broker using a dedicated thread in asynchronous mode. If this option is used then beware that if the connection could not be established then an exception is logged at WARN level and the consumer will not be able to receive messages; You can then restart the route to retry.
asyncStopListener | advanced | false | boolean | Whether to stop the JmsConsumer message listener asynchronously when stopping a route.
+| destinationResolver | advanced | | DestinationResolver | A pluggable org.springframework.jms.support.destination.DestinationResolver that allows you to use your own resolver (for example to lookup the real destination in a JNDI registry).
errorHandler | advanced | | ErrorHandler | Specifies a org.springframework.util.ErrorHandler to be invoked in case of any uncaught exceptions thrown while processing a Message. By default these exceptions will be logged at the WARN level if no errorHandler has been configured. You can configure logging level and whether stack traces should be logged using errorHandlerLoggingLevel and errorHandlerLogStackTrace options. This makes it much easier to configure than having to code a custom errorHandler.
errorHandlerLoggingLevel | advanced | WARN | LoggingLevel | Allows to configure the default errorHandler logging level for logging uncaught exceptions.
errorHandlerLogStackTrace | advanced | true | boolean | Allows to control whether stacktraces should be logged or not by the default errorHandler.
@@ -392,6 +399,8 @@ The JMS component supports 79 endpoint options which are listed below:
useMessageIDAsCorrelationID | advanced | false | boolean | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages.
waitForProvisionCorrelationToBeUpdatedCounter | advanced | 50 | int | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled.
waitForProvisionCorrelationToBeUpdatedThreadSleepingTime | advanced | 100 | long | Interval in millis to sleep each time while waiting for provisional correlation id to be updated.
+| password | security | | String | Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
+| username | security | | String | Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
transacted | transaction | false | boolean | Specifies whether to use transacted mode
lazyCreateTransactionManager | transaction (advanced) | true | boolean | If true Camel will create a JmsTransactionManager if there is no transactionManager injected when option transacted=true.
transactionManager | transaction (advanced) | | PlatformTransactionManager | The Spring transaction manager to use.
@@ -407,6 +416,7 @@ The JMS component supports 79 endpoint options which are listed below:



+
  [[JMS-MessageMappingbetweenJMSandCamel]]
  Message Mapping between JMS and Camel
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

http://git-wip-us.apache.org/repos/asf/camel/blob/6b15b653/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
index 9beb9a2..4f5d3bf 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
@@ -28,6 +28,10 @@ import org.apache.camel.LoggingLevel;
  import org.apache.camel.impl.UriEndpointComponent;
  import org.apache.camel.spi.HeaderFilterStrategy;
  import org.apache.camel.spi.HeaderFilterStrategyAware;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  import org.springframework.beans.BeansException;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.ApplicationContextAware;
@@ -49,6 +53,8 @@ import static org.apache.camel.util.ObjectHelper.removeStartingCharacters;
   */
  public class JmsComponent extends UriEndpointComponent implements ApplicationContextAware, HeaderFilterStrategyAware {

+ private static final Logger LOG = LoggerFactory.getLogger(JmsComponent.class);
+
      private static final String KEY_FORMAT_STRATEGY_PARAM = "jmsKeyFormatStrategy";
      private JmsConfiguration configuration;
      private ApplicationContext applicationContext;
@@ -284,6 +290,22 @@ public class JmsComponent extends UriEndpointComponent implements ApplicationCon
      }

      /**
+ * Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
+ */
+ @Metadata(secret = true)
+ public void setUsername(String username) {
+ getConfiguration().setUsername(username);
+ }
+
+ /**
+ * Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
+ */
+ @Metadata(secret = true)
+ public void setPassword(String password) {
+ getConfiguration().setPassword(password);
+ }
+
+ /**
       * Specifies whether persistent delivery is used by default.
       */
      public void setDeliveryPersistent(boolean deliveryPersistent) {
@@ -826,7 +848,6 @@ public class JmsComponent extends UriEndpointComponent implements ApplicationCon
      // Implementation methods
      // -------------------------------------------------------------------------

-
      @Override
      protected void doStart() throws Exception {
          if (headerFilterStrategy == null) {
@@ -901,19 +922,26 @@ public class JmsComponent extends UriEndpointComponent implements ApplicationCon
              endpoint.getConfiguration().setConnectionFactory(cf);
          }

- String username = getAndRemoveParameter(parameters, "username", String.class);
- String password = getAndRemoveParameter(parameters, "password", String.class);
- if (username != null && password != null) {
+ // if username or password provided then wrap the connection factory
+ String cfUsername = getAndRemoveParameter(parameters, "username", String.class, getConfiguration().getUsername());
+ String cfPassword = getAndRemoveParameter(parameters, "password", String.class, getConfiguration().getPassword());
+ if (cfUsername != null && cfPassword != null) {
              cf = endpoint.getConfiguration().getConnectionFactory();
+ ObjectHelper.notNull(cf, "ConnectionFactory");
+ LOG.debug("Wrapping existing ConnectionFactory with UserCredentialsConnectionFactoryAdapter using username: {} and password: ******", cfUsername);
              UserCredentialsConnectionFactoryAdapter ucfa = new UserCredentialsConnectionFactoryAdapter();
              ucfa.setTargetConnectionFactory(cf);
- ucfa.setPassword(password);
- ucfa.setUsername(username);
+ ucfa.setPassword(cfPassword);
+ ucfa.setUsername(cfUsername);
              endpoint.getConfiguration().setConnectionFactory(ucfa);
          } else {
- if (username != null || password != null) {
- // exclude the the saturation of username and password are all empty
- throw new IllegalArgumentException("The JmsComponent's username or password is null");
+ // if only username or password was provided then fail
+ if (cfUsername != null || cfPassword != null) {
+ if (cfUsername == null) {
+ throw new IllegalArgumentException("Password must also be provided when using username/password as credentials.");
+ } else {
+ throw new IllegalArgumentException("Username must also be provided when using username/password as credentials.");
+ }
              }
          }


http://git-wip-us.apache.org/repos/asf/camel/blob/6b15b653/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
index 140982c..2f20568 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
@@ -62,15 +62,25 @@ public class JmsConfiguration implements Cloneable {
      public static final String TEMP_TOPIC_PREFIX = "temp:topic:";

      private static final Logger LOG = LoggerFactory.getLogger(JmsConfiguration.class);
+
+ // these are too advanced and seldom used, we should consider removing those as there is plenty of options already
      private JmsOperations jmsOperations;
- private DestinationResolver destinationResolver;
- private ConnectionFactory connectionFactory;
      private ConnectionFactory templateConnectionFactory;
      private ConnectionFactory listenerConnectionFactory;
+
+ @UriParam(description = "The connection factory to be use. A connection factory must be configured either on the component or endpoint.")
+ private ConnectionFactory connectionFactory;
+ @UriParam(label = "security", secret = true, description = "Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.")
+ private String username;
+ @UriParam(label = "security", secret = true, description = "Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.")
+ private String password;
+
      private int acknowledgementMode = -1;
      @UriParam(defaultValue = "AUTO_ACKNOWLEDGE", enums = "SESSION_TRANSACTED,CLIENT_ACKNOWLEDGE,AUTO_ACKNOWLEDGE,DUPS_OK_ACKNOWLEDGE", label = "consumer",
              description = "The JMS acknowledgement name, which is one of: SESSION_TRANSACTED, CLIENT_ACKNOWLEDGE, AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE")
      private String acknowledgementModeName;
+ @UriParam(label = "advanced")
+ private DestinationResolver destinationResolver;
      // Used to configure the spring Container
      @UriParam(label = "advanced",
              description = "Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions.")
@@ -723,6 +733,28 @@ public class JmsConfiguration implements Cloneable {
          this.connectionFactory = connectionFactory;
      }

+ public String getUsername() {
+ return username;
+ }
+
+ /**
+ * Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
+ */
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory.
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
      public ConnectionFactory getListenerConnectionFactory() {
          if (listenerConnectionFactory == null) {
              listenerConnectionFactory = createListenerConnectionFactory();

http://git-wip-us.apache.org/repos/asf/camel/blob/6b15b653/components/camel-jms/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
index f6ffeb5..284cbb2 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
@@ -141,6 +141,16 @@ public class JmsComponentConfiguration {
       */
      private ConnectionFactory connectionFactory;
      /**
+ * Username to use with the ConnectionFactory. You can also configure
+ * username/password directly on the ConnectionFactory.
+ */
+ private String username;
+ /**
+ * Password to use with the ConnectionFactory. You can also configure
+ * username/password directly on the ConnectionFactory.
+ */
+ private String password;
+ /**
       * Specifies whether persistent delivery is used by default.
       */
      private Boolean deliveryPersistent = false;
@@ -645,6 +655,22 @@ public class JmsComponentConfiguration {
          this.connectionFactory = connectionFactory;
      }

+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
      public Boolean getDeliveryPersistent() {
          return deliveryPersistent;
      }

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 4 | next ›
Discussion Overview
groupcommits @
categoriescamel
postedJun 1, '16 at 7:00a
activeJun 12, '16 at 7:45a
posts4
users1
websitecamel.apache.org

1 user in discussion

Davsclaus: 4 posts

People

Translate

site design / logo © 2017 Grokbase