[jira] [Commented] (CAMEL-12807) Avoid to use endpoint attribute when MqttConnectOptions is declared once

2018-09-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16614857#comment-16614857
 ] 

ASF GitHub Bot commented on CAMEL-12807:


oscerd closed pull request #2521: CAMEL-12807 Avoid to use endpoint attribute 
when MqttConnectOptions i…
URL: https://github.com/apache/camel/pull/2521
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/components/camel-paho/src/main/docs/paho-component.adoc 
b/components/camel-paho/src/main/docs/paho-component.adoc
index 723f883d736..0514235ac55 100644
--- a/components/camel-paho/src/main/docs/paho-component.adoc
+++ b/components/camel-paho/src/main/docs/paho-component.adoc
@@ -95,6 +95,7 @@ with the following path and query parameters:
 | *brokerUrl* (common) | The URL of the MQTT broker. | tcp://localhost:1883 | 
String
 | *clientId* (common) | MQTT client identifier. |  | String
 | *connectOptions* (common) | Client connection options |  | MqttConnectOptions
+| *resolveMqttConnectOptions* (common) | Auto Resolve Client connection 
options | true | boolean
 | *filePersistenceDirectory* (common) | Base directory used by the file 
persistence provider. |  | String
 | *password* (common) | Password to be used for authentication against the 
MQTT broker |  | String
 | *persistence* (common) | Client persistence to be used - memory or file. | 
MEMORY | PahoPersistence
diff --git 
a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
 
b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
index 8d858d5c6a5..6d58751d56c 100644
--- 
a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
+++ 
b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
@@ -68,7 +68,8 @@
 private String userName; 
 @UriParam @Metadata(secret = true)
 private String password; 
-
+@UriParam(defaultValue = "true")
+private boolean resolveMqttConnectOptions = true; 
 
 // Collaboration members
 @UriParam
@@ -135,13 +136,16 @@ protected MqttConnectOptions resolveMqttConnectOptions() {
 if (connectOptions != null) {
 return connectOptions;
 }
-Set connectOptions = 
getCamelContext().getRegistry().findByType(MqttConnectOptions.class);
-if (connectOptions.size() == 1) {
-LOG.info("Single MqttConnectOptions instance found in the 
registry. It will be used by the endpoint.");
-return connectOptions.iterator().next();
-} else if (connectOptions.size() > 1) {
-LOG.warn("Found {} instances of the MqttConnectOptions in the 
registry. None of these will be used by the endpoint. "
- + "Please use 'connectOptions' endpoint option to select 
one.", connectOptions.size());
+
+if(resolveMqttConnectOptions) {
+Set connectOptions = 
getCamelContext().getRegistry().findByType(MqttConnectOptions.class);
+if (connectOptions.size() == 1) {
+LOG.info("Single MqttConnectOptions instance found in the 
registry. It will be used by the endpoint.");
+return connectOptions.iterator().next();
+} else if (connectOptions.size() > 1) {
+LOG.warn("Found {} instances of the MqttConnectOptions in the 
registry. None of these will be used by the endpoint. "
+ + "Please use 'connectOptions' endpoint option to 
select one.", connectOptions.size());
+}
 }
 
 MqttConnectOptions options = new MqttConnectOptions();
@@ -306,4 +310,12 @@ public void setPassword(String password) {
 this.password = password;
 }
 
+public synchronized boolean isResolveMqttConnectOptions() {
+return resolveMqttConnectOptions;
+}
+
+public synchronized void setResolveMqttConnectOptions(boolean 
resolveMqttConnectOptions) {
+this.resolveMqttConnectOptions = resolveMqttConnectOptions;
+}
+
 }


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Avoid to use endpoint attribute when MqttConnectOptions is declared once
> 
>
> Key: CAMEL-12807
> URL: https://issues.apache.org/jira/browse/CAMEL-12807
> Project: Camel
>  Issue Type: Bug
>  Components: camel-paho
>Affects 

[jira] [Commented] (CAMEL-12807) Avoid to use endpoint attribute when MqttConnectOptions is declared once

2018-09-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16614858#comment-16614858
 ] 

ASF GitHub Bot commented on CAMEL-12807:


Github user oscerd closed the pull request at:

https://github.com/apache/camel/pull/2521


> Avoid to use endpoint attribute when MqttConnectOptions is declared once
> 
>
> Key: CAMEL-12807
> URL: https://issues.apache.org/jira/browse/CAMEL-12807
> Project: Camel
>  Issue Type: Bug
>  Components: camel-paho
>Affects Versions: 2.22.2
>Reporter: Fabrizio Spataro
>Assignee: Fabrizio Spataro
>Priority: Major
> Fix For: 2.23.0
>
>
> Hello,
> In my system i have a default MqttConnectOptions declared into spring context 
> and some other camel consumers/producers connected to others mqtt servers.
> So today i cannot use endpoint parameters without declare an another 
> mqttConnectOptions class because the endpoint code suppose that use ALWAYS 
> MqttConnectOptions (if it is declared once)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12807) Avoid to use endpoint attribute when MqttConnectOptions is declared once

2018-09-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16614856#comment-16614856
 ] 

ASF GitHub Bot commented on CAMEL-12807:


oscerd commented on issue #2521: CAMEL-12807 Avoid to use endpoint attribute 
when MqttConnectOptions i…
URL: https://github.com/apache/camel/pull/2521#issuecomment-421361753
 
 
   Merged on master. Thanks @Fabryprog 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Avoid to use endpoint attribute when MqttConnectOptions is declared once
> 
>
> Key: CAMEL-12807
> URL: https://issues.apache.org/jira/browse/CAMEL-12807
> Project: Camel
>  Issue Type: Bug
>  Components: camel-paho
>Affects Versions: 2.22.2
>Reporter: Fabrizio Spataro
>Assignee: Fabrizio Spataro
>Priority: Major
> Fix For: 2.23.0
>
>
> Hello,
> In my system i have a default MqttConnectOptions declared into spring context 
> and some other camel consumers/producers connected to others mqtt servers.
> So today i cannot use endpoint parameters without declare an another 
> mqttConnectOptions class because the endpoint code suppose that use ALWAYS 
> MqttConnectOptions (if it is declared once)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12807) Avoid to use endpoint attribute when MqttConnectOptions is declared once

2018-09-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16613510#comment-16613510
 ] 

ASF GitHub Bot commented on CAMEL-12807:


Fabryprog opened a new pull request #2521: CAMEL-12807 Avoid to use endpoint 
attribute when MqttConnectOptions i…
URL: https://github.com/apache/camel/pull/2521
 
 
   …s declared once
   
   Hello, this is my propose patch to camel-paho endpoint
   
   Note is backward compatible!


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Avoid to use endpoint attribute when MqttConnectOptions is declared once
> 
>
> Key: CAMEL-12807
> URL: https://issues.apache.org/jira/browse/CAMEL-12807
> Project: Camel
>  Issue Type: Bug
>  Components: camel-paho
>Affects Versions: 2.22.2
>Reporter: Fabrizio Spataro
>Assignee: Fabrizio Spataro
>Priority: Major
>
> Hello,
> In my system i have a default MqttConnectOptions declared into spring context 
> and some other camel consumers/producers connected to others mqtt servers.
> So today i cannot use endpoint parameters without declare an another 
> mqttConnectOptions class because the endpoint code suppose that use ALWAYS 
> MqttConnectOptions (if it is declared once)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12807) Avoid to use endpoint attribute when MqttConnectOptions is declared once

2018-09-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16613511#comment-16613511
 ] 

ASF GitHub Bot commented on CAMEL-12807:


GitHub user Fabryprog opened a pull request:

https://github.com/apache/camel/pull/2521

CAMEL-12807 Avoid to use endpoint attribute when MqttConnectOptions i…

…s declared once

Hello, this is my propose patch to camel-paho endpoint

Note is backward compatible!

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Fabryprog/camel CAMEL-12807

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/camel/pull/2521.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2521


commit a962be45274d37d7610c6dd3bdfb90365b4a0d42
Author: Fabrizio Spataro 
Date:   2018-09-13T13:37:45Z

CAMEL-12807 Avoid to use endpoint attribute when MqttConnectOptions is 
declared once




> Avoid to use endpoint attribute when MqttConnectOptions is declared once
> 
>
> Key: CAMEL-12807
> URL: https://issues.apache.org/jira/browse/CAMEL-12807
> Project: Camel
>  Issue Type: Bug
>  Components: camel-paho
>Affects Versions: 2.22.2
>Reporter: Fabrizio Spataro
>Assignee: Fabrizio Spataro
>Priority: Major
>
> Hello,
> In my system i have a default MqttConnectOptions declared into spring context 
> and some other camel consumers/producers connected to others mqtt servers.
> So today i cannot use endpoint parameters without declare an another 
> mqttConnectOptions class because the endpoint code suppose that use ALWAYS 
> MqttConnectOptions (if it is declared once)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)