[jira] [Commented] (CAMEL-10820) DefaultFluentProducerTemplate mixes up data when sending asynchronously

2017-03-07 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-10820:
-

Luca this looks fine

> DefaultFluentProducerTemplate mixes up data when sending asynchronously
> ---
>
> Key: CAMEL-10820
> URL: https://issues.apache.org/jira/browse/CAMEL-10820
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.18.2
> Environment: eclipse, win7, gradle
>Reporter: Jakub Cernohorsky
>Assignee: Luca Burgazzoli
> Fix For: 2.18.4, 2.19.0
>
> Attachments: default_fluent_producer_template.diff
>
>
> DefaultFluentProducerTemplate
> code:
> producer = context.createFluentProducerTemplate();
> future1 = producer.withHeader("action", 
> "register").withBody(body1).asyncSend();
> future2 = producer.withHeader("action", 
> "register").withBody(body2).asyncSend();
> These two subsequent calls produces with the default creation two calls with 
> the same body - body2.
> The cause is that it uses default processor supplier () -> 
> this::populateExchange which is call lazily at the time of send and at that 
> time the body property of DefaultFluentProducerTemplate is body2.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (CAMEL-10820) DefaultFluentProducerTemplate mixes up data when sending asynchronously

2017-03-06 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli commented on CAMEL-10820:
-

I changed a little bit producer template so that it copies the body and headers 
when doing async stuffs, the changes are there: 
https://github.com/lburgazzoli/apache-camel/commit/8480f88ea3795bb024fb4b0c9646c9a10cff42c8.


[~jub] do you mind having a look ?

> DefaultFluentProducerTemplate mixes up data when sending asynchronously
> ---
>
> Key: CAMEL-10820
> URL: https://issues.apache.org/jira/browse/CAMEL-10820
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.18.2
> Environment: eclipse, win7, gradle
>Reporter: Jakub Cernohorsky
> Fix For: 2.18.4, 2.19.0
>
> Attachments: default_fluent_producer_template.diff
>
>
> DefaultFluentProducerTemplate
> code:
> producer = context.createFluentProducerTemplate();
> future1 = producer.withHeader("action", 
> "register").withBody(body1).asyncSend();
> future2 = producer.withHeader("action", 
> "register").withBody(body2).asyncSend();
> These two subsequent calls produces with the default creation two calls with 
> the same body - body2.
> The cause is that it uses default processor supplier () -> 
> this::populateExchange which is call lazily at the time of send and at that 
> time the body property of DefaultFluentProducerTemplate is body2.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (CAMEL-10820) DefaultFluentProducerTemplate mixes up data when sending asynchronously

2017-03-06 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli commented on CAMEL-10820:
-

We may also delay the creation of default exchangeSupplier/processorSupplier so 
that for async* operation we can make a copy of the values only if needed

> DefaultFluentProducerTemplate mixes up data when sending asynchronously
> ---
>
> Key: CAMEL-10820
> URL: https://issues.apache.org/jira/browse/CAMEL-10820
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.18.2
> Environment: eclipse, win7, gradle
>Reporter: Jakub Cernohorsky
> Fix For: 2.18.4, 2.19.0
>
> Attachments: default_fluent_producer_template.diff
>
>
> DefaultFluentProducerTemplate
> code:
> producer = context.createFluentProducerTemplate();
> future1 = producer.withHeader("action", 
> "register").withBody(body1).asyncSend();
> future2 = producer.withHeader("action", 
> "register").withBody(body2).asyncSend();
> These two subsequent calls produces with the default creation two calls with 
> the same body - body2.
> The cause is that it uses default processor supplier () -> 
> this::populateExchange which is call lazily at the time of send and at that 
> time the body property of DefaultFluentProducerTemplate is body2.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (CAMEL-10820) DefaultFluentProducerTemplate mixes up data when sending asynchronously

2017-03-05 Thread Jakub Cernohorsky (JIRA)

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

Jakub Cernohorsky commented on CAMEL-10820:
---

The easiest solution would be to always create copy of headers and keep actual 
reference to body. It is not the most efficient way, because the copy of 
headers is also done for synchronuous calls.

> DefaultFluentProducerTemplate mixes up data when sending asynchronously
> ---
>
> Key: CAMEL-10820
> URL: https://issues.apache.org/jira/browse/CAMEL-10820
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.18.2
> Environment: eclipse, win7, gradle
>Reporter: Jakub Cernohorsky
> Fix For: 2.18.4, 2.19.0
>
> Attachments: default_fluent_producer_template.diff
>
>
> DefaultFluentProducerTemplate
> code:
> producer = context.createFluentProducerTemplate();
> future1 = producer.withHeader("action", 
> "register").withBody(body1).asyncSend();
> future2 = producer.withHeader("action", 
> "register").withBody(body2).asyncSend();
> These two subsequent calls produces with the default creation two calls with 
> the same body - body2.
> The cause is that it uses default processor supplier () -> 
> this::populateExchange which is call lazily at the time of send and at that 
> time the body property of DefaultFluentProducerTemplate is body2.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (CAMEL-10820) DefaultFluentProducerTemplate mixes up data when sending asynchronously

2017-03-01 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-10820:
-

Ah well spotted.

I wonder if you fancy taking a stab at trying to implement a fix for this? Not 
sure on top of my head how to do this, but maybe somehow with async send the 
state of the template must be computed and send asap. Or you need some kind of 
Stack to push/pop when doing multiple sends or something.



> DefaultFluentProducerTemplate mixes up data when sending asynchronously
> ---
>
> Key: CAMEL-10820
> URL: https://issues.apache.org/jira/browse/CAMEL-10820
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.18.2
> Environment: eclipse, win7, gradle
>Reporter: Jakub Cernohorsky
> Fix For: 2.18.3, 2.19.0
>
>
> DefaultFluentProducerTemplate
> code:
> producer = context.createFluentProducerTemplate();
> future1 = producer.withHeader("action", 
> "register").withBody(body1).asyncSend();
> future2 = producer.withHeader("action", 
> "register").withBody(body2).asyncSend();
> These two subsequent calls produces with the default creation two calls with 
> the same body - body2.
> The cause is that it uses default processor supplier () -> 
> this::populateExchange which is call lazily at the time of send and at that 
> time the body property of DefaultFluentProducerTemplate is body2.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)