[jira] [Commented] (CAMEL-9245) camel-paho - Endpoint should allow a flexible naming.

2015-10-25 Thread Henryk Konsek (JIRA)

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

Henryk Konsek commented on CAMEL-9245:
--

Oh shit! Did I really commit that? What was on my mind to assume fixed 
component name? :|

Anyway - I have fixed that in 2.17.0 (1) and 2.16.1 (2).

Thanks for reporting (and sorry for a stupid mistake)! 

(1) 14e9236aca9e1cd93f180158767d7e102257f1b6
(2) e791fc27756fddce2eaa759c86250c8c5e7f9a0f

> camel-paho - Endpoint should allow a flexible naming.
> -
>
> Key: CAMEL-9245
> URL: https://issues.apache.org/jira/browse/CAMEL-9245
> Project: Camel
>  Issue Type: Bug
>  Components: camel-paho
>Affects Versions: 2.16.0
>Reporter: Jaume Teixi
>Priority: Minor
> Fix For: 2.17.0, 2.16.1
>
>
> If endpoint doesn't match exactly paho: it fails to publish to the correct 
> topic.
> Once should be able in Spring to @Autowired two different PahoComponent 
> pointing to different Application Context defined PahoComponent bean id'S.
> Currently if bean id is not named exactly paho it fails to publish to the 
> correct topic and for example instead of input/1 publishes to t://input/1 
> when id is mypaho instead of paho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-9245) camel-paho - Endpoint should allow a flexible naming.

2015-10-25 Thread Henryk Konsek (JIRA)

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

Henryk Konsek commented on CAMEL-9245:
--

As a workaround hack for the older versions you can also use the component name 
with the length == 4.

> camel-paho - Endpoint should allow a flexible naming.
> -
>
> Key: CAMEL-9245
> URL: https://issues.apache.org/jira/browse/CAMEL-9245
> Project: Camel
>  Issue Type: Bug
>  Components: camel-paho
>Affects Versions: 2.16.0
>Reporter: Jaume Teixi
>Priority: Minor
> Fix For: 2.17.0, 2.16.1
>
>
> If endpoint doesn't match exactly paho: it fails to publish to the correct 
> topic.
> Once should be able in Spring to @Autowired two different PahoComponent 
> pointing to different Application Context defined PahoComponent bean id'S.
> Currently if bean id is not named exactly paho it fails to publish to the 
> correct topic and for example instead of input/1 publishes to t://input/1 
> when id is mypaho instead of paho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-9245) camel-paho - Endpoint should allow a flexible naming.

2015-10-23 Thread Jaume Teixi (JIRA)

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

Jaume Teixi commented on CAMEL-9245:


When the *PahoComponent* is named *paho2* it is wrong because it is posting to 
the topic {noformat}/input/2{noformat} (note the first slash) instead of 
{noformat}input/2{noformat} 
And if you name the *PahoComponent* to *mypaho* it will post to the wrong topic 
{noformat}t://input/2{noformat}
This does not happens with other components like *camel-jms* or *camel-mqtt* 
only with *camel-paho* so it seems not related to the Camel Core and maybe to 
the Endpoint format definition or to the handling of it.

> camel-paho - Endpoint should allow a flexible naming.
> -
>
> Key: CAMEL-9245
> URL: https://issues.apache.org/jira/browse/CAMEL-9245
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-paho
>Reporter: Jaume Teixi
>Priority: Minor
>
> If endpoint doesn't match exactly paho: it fails to publish to the correct 
> topic.
> Once should be able in Spring to @Autowired two different PahoComponent 
> pointing to different Application Context defined PahoComponent bean id'S.
> Currently if bean id is not named exactly paho it fails to publish to the 
> correct topic and for example instead of input/1 publishes to t://input/1 
> when id is mypaho instead of paho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-9245) camel-paho - Endpoint should allow a flexible naming.

2015-10-23 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-9245:


The bug is here
https://github.com/apache/camel/blob/master/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java#L79
eg the hardcoded 7 index which is wrong.

The topic is really the remainder parameter in the component which it should 
use to set as topic.


> camel-paho - Endpoint should allow a flexible naming.
> -
>
> Key: CAMEL-9245
> URL: https://issues.apache.org/jira/browse/CAMEL-9245
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-paho
>Reporter: Jaume Teixi
>Priority: Minor
>
> If endpoint doesn't match exactly paho: it fails to publish to the correct 
> topic.
> Once should be able in Spring to @Autowired two different PahoComponent 
> pointing to different Application Context defined PahoComponent bean id'S.
> Currently if bean id is not named exactly paho it fails to publish to the 
> correct topic and for example instead of input/1 publishes to t://input/1 
> when id is mypaho instead of paho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-9245) camel-paho - Endpoint should allow a flexible naming.

2015-10-23 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-9245:


Here
https://github.com/apache/camel/blob/master/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java#L36

you grab the remainder and use that as the topic

endpoint.setTopic(remainder);

and then you dont need that other logic.

> camel-paho - Endpoint should allow a flexible naming.
> -
>
> Key: CAMEL-9245
> URL: https://issues.apache.org/jira/browse/CAMEL-9245
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-paho
>Reporter: Jaume Teixi
>Priority: Minor
> Fix For: 2.17.0, 2.16.1
>
>
> If endpoint doesn't match exactly paho: it fails to publish to the correct 
> topic.
> Once should be able in Spring to @Autowired two different PahoComponent 
> pointing to different Application Context defined PahoComponent bean id'S.
> Currently if bean id is not named exactly paho it fails to publish to the 
> correct topic and for example instead of input/1 publishes to t://input/1 
> when id is mypaho instead of paho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-9245) camel-paho - Endpoint should allow a flexible naming.

2015-10-23 Thread Henryk Konsek (JIRA)

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

Henryk Konsek commented on CAMEL-9245:
--

Actually publishing to {{input/2}} is what I would expect to happen. You are 
sending a message to the {{input/2}}, so this is published to {{input/2}} :) . 
BTW a component naming is handled by the Camel Core and is outside of the scope 
of the component.

Are you sure it behaves wrong?

> camel-paho - Endpoint should allow a flexible naming.
> -
>
> Key: CAMEL-9245
> URL: https://issues.apache.org/jira/browse/CAMEL-9245
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-paho
>Reporter: Jaume Teixi
>Priority: Minor
>
> If endpoint doesn't match exactly paho: it fails to publish to the correct 
> topic.
> Once should be able in Spring to @Autowired two different PahoComponent 
> pointing to different Application Context defined PahoComponent bean id'S.
> Currently if bean id is not named exactly paho it fails to publish to the 
> correct topic and for example instead of input/1 publishes to t://input/1 
> when id is mypaho instead of paho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-9245) camel-paho - Endpoint should allow a flexible naming.

2015-10-23 Thread Jaume Teixi (JIRA)

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

Jaume Teixi commented on CAMEL-9245:


Define two broker connections with PahoComponent bean id's in your Spring's 
Application Context
{code:xml}

   






 



  






 
 
{code}

Autowire the PahoComponent in your Java class. 
And implement two different methods for publishing to different topics for each 
one.

{code:java}
@Autowired
private ApplicationContext appContext;

@Autowired
private PahoComponent paho;

@Autowired
private PahoComponent paho2;

public void publish() {
try {
CamelContext camelContext = new 
SpringCamelContext(appContext);
camelContext.setAllowUseOriginalMessage(false);
camelContext.addComponent("paho", paho);
camelContext.start();
ProducerTemplate producer = 
camelContext.createProducerTemplate();
String payload = "just a message";
String clientId = "pub-paho-" + System.nanoTime();

producer.sendBodyAndHeaders("paho:input/1?qos=1=" + clientId, 
payload.toString(), null);
camelContext.stop();
} catch (Exception e) {
LOG.error("publish exception: {}", e.getMessage());
}
}

public void publish2() {
try {
CamelContext camelContext = new 
SpringCamelContext(appContext);
camelContext.setAllowUseOriginalMessage(false);
camelContext.addComponent("paho2", paho2);
camelContext.start();
ProducerTemplate producer = 
camelContext.createProducerTemplate();
String payload = "just a message 2";
String clientId = "pub-paho2-" + System.nanoTime();

producer.sendBodyAndHeaders("paho2:input/2?qos=1=" + clientId, 
payload.toString(), null);
camelContext.stop();
} catch (Exception e) {
LOG.error("publish2 exception: {}", e.getMessage());
}   
}
{code}

First method message: *just a message*
Is published +correctly+ into topic: *input/1*

Second method message: *just a message 2* 
Is published _wrongly_ into topic: */input/2*

> camel-paho - Endpoint should allow a flexible naming.
> -
>
> Key: CAMEL-9245
> URL: https://issues.apache.org/jira/browse/CAMEL-9245
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-paho
>Reporter: Jaume Teixi
>Priority: Minor
>
> If endpoint doesn't match exactly paho: it fails to publish to the correct 
> topic.
> Once should be able in Spring to @Autowired two different PahoComponent 
> pointing to different Application Context defined PahoComponent bean id'S.
> Currently if bean id is not named exactly paho it fails to publish to the 
> correct topic and for example instead of input/1 publishes to t://input/1 
> when id is mypaho instead of paho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-9245) camel-paho - Endpoint should allow a flexible naming.

2015-10-22 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-9245:


Can you explain this in more details what you mean?

> camel-paho - Endpoint should allow a flexible naming.
> -
>
> Key: CAMEL-9245
> URL: https://issues.apache.org/jira/browse/CAMEL-9245
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-paho
>Reporter: Jaume Teixi
>Priority: Minor
>
> If endpoint doesn't match exactly paho: it fails to publish to the correct 
> topic.
> Once should be able in Spring to @Autowired two different PahoComponent 
> pointing to different Application Context defined PahoComponent bean id'S.
> Currently if bean id is not named exactly paho it fails to publish to the 
> correct topic and for example instead of input/1 publishes to t://input/1 
> when id is mypaho instead of paho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)