[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2020-02-25 Thread Steffen Eitelmann (Jira)


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

Steffen Eitelmann edited comment on CAMEL-12638 at 2/25/20 1:42 PM:


We are using Camel 2.24.2 and the FluentProducerTemplate is definitely still 
not thread-safe (using withExchange()). Should I create a new bug ticket?


was (Author: neffez):
We are using Camel 2.24.2 and the FluentProducerTemplate is definitely still 
not thread-safe. Should I create a new bug ticket?

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Assignee: Claus Ibsen
>Priority: Major
> Fix For: 2.21.3, 2.22.1, 2.23.0
>
> Attachments: image-2018-07-12-17-58-09-225.png
>
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-13 Thread Mario Papandrea (JIRA)


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

Mario Papandrea edited comment on CAMEL-12638 at 7/13/18 7:33 PM:
--

Ah yes sure, sorry! I was hoping exists some scope crating a new instance for 
each call, but is not like this. Anyway my suggestion to remove from the 
camel-spring-boot-starter configuration as a singleton is still valid. It 
shouldn't be used that way and the fact that you can find it in the spring 
context available for injection is error prone. This class must be instantiated 
each time is used so there is no need to be provided by the container


was (Author: mario.papandrea):
Ah yes sure, sorry! I was hoping exists some scope crating a new instance for 
each call, but is not like this. Anyway my suggestion to remove from the 
camel-spring-boot-starter confoguration is still valid. It shouldn't be used 
that way. 

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
> Attachments: image-2018-07-12-17-58-09-225.png
>
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-13 Thread Mario Papandrea (JIRA)


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

Mario Papandrea edited comment on CAMEL-12638 at 7/13/18 4:03 PM:
--

i suggest also to remove the singleton from the camel-spring-boot-starter cause 
is misleading. 

Or maybe  the scope of the bean can be changed to be Request Scoped
{code:java}
@Scope("request") 
{code}
. But I 'm not sure it will do the job..


was (Author: mario.papandrea):
i suggest also to remove the singleton from the camel-spring-boot-starter cause 
is misleading. 

Or maybe  the scope of the bean can be changed to be Request Scoped
{code:java}
@Scope("prototype")
{code}
.  

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
> Attachments: image-2018-07-12-17-58-09-225.png
>
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-13 Thread Mario Papandrea (JIRA)


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

Mario Papandrea edited comment on CAMEL-12638 at 7/13/18 3:59 PM:
--

i suggest also to remove the singleton from the camel-spring-boot-starter cause 
is misleading. 

Or maybe  the scope of the bean can be changed to be Request Scoped
{code:java}
@Scope("prototype")
{code}
.  


was (Author: mario.papandrea):
i suggest also to remove the singleton from the camel-spring-boot-starter cause 
is misleading. 

Or maybe  the scope of the bean can be changed to be RequestScope.

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
> Attachments: image-2018-07-12-17-58-09-225.png
>
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-13 Thread Mario Papandrea (JIRA)


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

Mario Papandrea edited comment on CAMEL-12638 at 7/13/18 3:57 PM:
--

i suggest also to remove the singleton from the camel-spring-boot-starter cause 
is misleading. 

Or maybe  the scope of the bean can be changed to be RequestScope.


was (Author: mario.papandrea):
i suggest also to remove the singleton from spring-boot-starter cause is 
misleading. 

Or maybe  the scope of the bean can be changed to be RequestScope.

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
> Attachments: image-2018-07-12-17-58-09-225.png
>
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-12 Thread Mario Papandrea (JIRA)


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

Mario Papandrea edited comment on CAMEL-12638 at 7/12/18 3:58 PM:
--

Moreover the api doc clearly state  that this object is "thread safe" 

[http://static.javadoc.io/org.apache.camel/camel-core/2.19.3/org/apache/camel/FluentProducerTemplate.html]
 

  !image-2018-07-12-17-58-09-225.png!


was (Author: mario.papandrea):
Moreover the api doc clearly state  that this object is "thread safe" 

[http://static.javadoc.io/org.apache.camel/camel-core/2.19.3/org/apache/camel/FluentProducerTemplate.html]
 

 

!image-2018-07-12-17-57-11-867.png!

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
> Attachments: image-2018-07-12-17-56-23-086.png, 
> image-2018-07-12-17-57-11-867.png, image-2018-07-12-17-58-09-225.png
>
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-12 Thread Lukasz (JIRA)


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

Lukasz edited comment on CAMEL-12638 at 7/12/18 3:52 PM:
-

I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ book, [~davsclaus] and [~janstey] use it as a standard bean 
that can be called to execute a service, not as a builder (see _Listing 7.12 
JAX-RS_ _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 


was (Author: lucas_):
I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ book, [~cib...@e-ma.net] and [~janstey] use it as a standard 
bean that can be called to execute a service, not as a builder (see _Listing 
7.12 JAX-RS_ _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-12 Thread Lukasz (JIRA)


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

Lukasz edited comment on CAMEL-12638 at 7/12/18 2:56 PM:
-

I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ book, [~cib...@e-ma.net] and [~janstey] use it as a standard 
bean that can be called to execute a service, not as a builder (see _Listing 
7.12 JAX-RS_
 _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 


was (Author: lucas_):
I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ book, Claus and Jonathan use it a standard bean that can be 
called to execute a service not a builder (see _Listing 7.12 JAX-RS_
 _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-12 Thread Lukasz (JIRA)


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

Lukasz edited comment on CAMEL-12638 at 7/12/18 2:56 PM:
-

I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ book, [~cib...@e-ma.net] and [~janstey] use it as a standard 
bean that can be called to execute a service, not as a builder (see _Listing 
7.12 JAX-RS_ _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 


was (Author: lucas_):
I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ book, [~cib...@e-ma.net] and [~janstey] use it as a standard 
bean that can be called to execute a service, not as a builder (see _Listing 
7.12 JAX-RS_
 _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-12 Thread Lukasz (JIRA)


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

Lukasz edited comment on CAMEL-12638 at 7/12/18 12:40 PM:
--

I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ book, Claus and Jonathan use it a standard bean that can be 
called to execute a service not a builder (see _Listing 7.12 JAX-RS_
 _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 


was (Author: lucas_):
I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ **book, Claus and Jonathan use it a standard bean that can be 
called to execute a service not a builder (see _Listing 7.12 JAX-RS_
 _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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


[jira] [Comment Edited] (CAMEL-12638) DefaultFluentProducerTemplate is not thread safe

2018-07-12 Thread Lukasz (JIRA)


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

Lukasz edited comment on CAMEL-12638 at 7/12/18 12:39 PM:
--

I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ **book, Claus and Jonathan use it a standard bean that can be 
called to execute a service not a builder (see _Listing 7.12 JAX-RS_
 _REST implementation_)_:_
{code:java}
@ApplicationScoped
@Path ( "/api" )
public class RulesController {
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) {
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}{code}
 Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 


was (Author: lucas_):
I'm not really convinced by that [~njiang]. Even in the _Camel in Action 
(Second Edition)_ **book, Claus and Jonathan use it a standard bean that can be 
called to execute a service not a builder (see _Listing 7.12 JAX-RS_
_REST implementation_)_:_

 

_@ApplicationScoped
@Path("/api")
public class RulesController \{
   @Inject
   @Uri ( "direct:inventory" )
   private FluentProducerTemplate producer;

   @GET
   @Produces ( MediaType.APPLICATION_JSON )
   @Path ( "/rules/{cartIds}" )
   public List rules( @PathParam ( "cartIds" ) String cartIds ) \{
  List answer = new ArrayList<>();
  ItemsDto inventory = producer.request( ItemsDto.class );
  [...]
   }
}_

 

Obviously they don't refer to a specific implementation but we can all imagine 
which implementation is provided by default. Also if it was supposed to be 
*just* a builder I find it misleading that the class actually implements a 
_Service_ interface.

 

> DefaultFluentProducerTemplate is not thread safe
> 
>
> Key: CAMEL-12638
> URL: https://issues.apache.org/jira/browse/CAMEL-12638
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.20.2
>Reporter: Lukasz
>Priority: Major
>
> I think we have rediscovered the CAMEL-10820 bug. A body of one request gets 
> replaced with a body of proceeding request, in our case we use *request()* 
> method instead of *asyncSend()*.
> We use camel together with spring-boot. Consider following code:
>  
> {code:java}
> @Service
> public class UseCamelService {
>private FluentProducerTemplate producer;
>@Autowired
>public UseCamelService(FluentProducerTemplate producer) {
>   this.producer = producer;
>}
>public String getValueFromCamel(String body) {
>   return producer.to("route").withBody(body).request(String.class);
>}
> }
> {code}
> If *UseCamelService.getValueFromCamel()* gets called from two different 
> threads it is possible for the latter one to override the body of the first 
> one.



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