[jira] [Commented] (CAMEL-10491) Spring-LDAP - Add support for authenticate, modify_attributes and function_driven operations

2016-12-01 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CAMEL-10491:


Github user bhaveshdt closed the pull request at:

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


> Spring-LDAP - Add support for authenticate, modify_attributes and 
> function_driven operations
> 
>
> Key: CAMEL-10491
> URL: https://issues.apache.org/jira/browse/CAMEL-10491
> Project: Camel
>  Issue Type: Improvement
>Affects Versions: 2.19.0
>Reporter: Bhavesh
>Assignee: Andrea Cosentino
>Priority: Minor
> Fix For: 2.19.0
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>




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


[jira] [Commented] (CAMEL-10542) DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

2016-12-01 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli commented on CAMEL-10542:
-

I was thinking about a real factory that can create an instance of a 
dataformat, like what you can achieve by annotate a method with prototype scope 
in spring

> DataFormat from registry is used for every dataformat operation 
> (marshal/unmarshal)
> ---
>
> Key: CAMEL-10542
> URL: https://issues.apache.org/jira/browse/CAMEL-10542
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.18.2, 2.19.0
>
>
> While working on an issue related to spring-boot I found out that if a data 
> format is registered in camel registry with the same name as the one camel 
> looks-up with the help of DefaultDataFormatResolver, this object is then 
> re-configured for each data format definition so one definition may override 
> previous configuration with an undefined behavior.
> So assume you have an xml route definitions as:
> {code:xml}
> http://camel.apache.org/schema/spring;>
>   
> 
> 
>   
> 
>   
>   
> 
> 
>   
> 
>   
> 
> {code}
> And some code like:
> {code:java}
> InputStream is = getClass().getResourceAsStream("...");
> SimpleRegistry reg = new SimpleRegistry();
> reg.put("csv-dataformat", new CsvDataFormat());
> DefaultCamelContext ctx = new DefaultCamelContext(reg);
> ctx.addRouteDefinitions(ctx.loadRoutesDefinition(is).getRoutes());
> ctx.start();
> ProducerTemplate template = ctx.createProducerTemplate();
> String result = template.requestBody(
> "direct:marshal",
> Arrays.asList(Arrays.asList( "A1", "B1", "C1" )),
> String.class);
> assertEquals("A1,B1,C1", result);
> ctx.stop
> {code}
> Then this test fails with:
> {code}
> Expected :A1,B1,C1
> Actual   :A1;B1;C1
> {code}
> It fails because the object added to the SimpleRegistry is shared among the 
> two csv dataformats  so it is configured to have delimiter = ';' 
> For spring-boot this causes some issues as it registers data formats beans as 
> part of its auto-configuration magic thus if you do not set your own instance 
> of data format, any data format operation like marshal/unmarshal may not work 
> as expected. 
> - for spring-boot a solution would be to annotate auto configured data format 
> beans with prototype scope.
> - a more generic solution would be to make DataFormat Cloneable and clone the 
> bean found in the registry



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


[jira] [Commented] (CAMEL-10542) DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

2016-12-01 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-10542:
-

By DataFormatFactory do you mean DataFormatResolver?

> DataFormat from registry is used for every dataformat operation 
> (marshal/unmarshal)
> ---
>
> Key: CAMEL-10542
> URL: https://issues.apache.org/jira/browse/CAMEL-10542
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.18.2, 2.19.0
>
>
> While working on an issue related to spring-boot I found out that if a data 
> format is registered in camel registry with the same name as the one camel 
> looks-up with the help of DefaultDataFormatResolver, this object is then 
> re-configured for each data format definition so one definition may override 
> previous configuration with an undefined behavior.
> So assume you have an xml route definitions as:
> {code:xml}
> http://camel.apache.org/schema/spring;>
>   
> 
> 
>   
> 
>   
>   
> 
> 
>   
> 
>   
> 
> {code}
> And some code like:
> {code:java}
> InputStream is = getClass().getResourceAsStream("...");
> SimpleRegistry reg = new SimpleRegistry();
> reg.put("csv-dataformat", new CsvDataFormat());
> DefaultCamelContext ctx = new DefaultCamelContext(reg);
> ctx.addRouteDefinitions(ctx.loadRoutesDefinition(is).getRoutes());
> ctx.start();
> ProducerTemplate template = ctx.createProducerTemplate();
> String result = template.requestBody(
> "direct:marshal",
> Arrays.asList(Arrays.asList( "A1", "B1", "C1" )),
> String.class);
> assertEquals("A1,B1,C1", result);
> ctx.stop
> {code}
> Then this test fails with:
> {code}
> Expected :A1,B1,C1
> Actual   :A1;B1;C1
> {code}
> It fails because the object added to the SimpleRegistry is shared among the 
> two csv dataformats  so it is configured to have delimiter = ';' 
> For spring-boot this causes some issues as it registers data formats beans as 
> part of its auto-configuration magic thus if you do not set your own instance 
> of data format, any data format operation like marshal/unmarshal may not work 
> as expected. 
> - for spring-boot a solution would be to annotate auto configured data format 
> beans with prototype scope.
> - a more generic solution would be to make DataFormat Cloneable and clone the 
> bean found in the registry



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


[jira] [Commented] (CAMEL-10542) DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

2016-12-01 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli commented on CAMEL-10542:
-

Maybe a better way would be:

- if a ref is set, look it up and use it as it is
- if ref is not set, search for a DataFormatFactory instead of DataFormat
- if factory is not found go ahead with standard resolution

So that spring-boot or any other container can safely register its factory as 
i.e. csv-factory or csv-dataformat-factory

> DataFormat from registry is used for every dataformat operation 
> (marshal/unmarshal)
> ---
>
> Key: CAMEL-10542
> URL: https://issues.apache.org/jira/browse/CAMEL-10542
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.18.2, 2.19.0
>
>
> While working on an issue related to spring-boot I found out that if a data 
> format is registered in camel registry with the same name as the one camel 
> looks-up with the help of DefaultDataFormatResolver, this object is then 
> re-configured for each data format definition so one definition may override 
> previous configuration with an undefined behavior.
> So assume you have an xml route definitions as:
> {code:xml}
> http://camel.apache.org/schema/spring;>
>   
> 
> 
>   
> 
>   
>   
> 
> 
>   
> 
>   
> 
> {code}
> And some code like:
> {code:java}
> InputStream is = getClass().getResourceAsStream("...");
> SimpleRegistry reg = new SimpleRegistry();
> reg.put("csv-dataformat", new CsvDataFormat());
> DefaultCamelContext ctx = new DefaultCamelContext(reg);
> ctx.addRouteDefinitions(ctx.loadRoutesDefinition(is).getRoutes());
> ctx.start();
> ProducerTemplate template = ctx.createProducerTemplate();
> String result = template.requestBody(
> "direct:marshal",
> Arrays.asList(Arrays.asList( "A1", "B1", "C1" )),
> String.class);
> assertEquals("A1,B1,C1", result);
> ctx.stop
> {code}
> Then this test fails with:
> {code}
> Expected :A1,B1,C1
> Actual   :A1;B1;C1
> {code}
> It fails because the object added to the SimpleRegistry is shared among the 
> two csv dataformats  so it is configured to have delimiter = ';' 
> For spring-boot this causes some issues as it registers data formats beans as 
> part of its auto-configuration magic thus if you do not set your own instance 
> of data format, any data format operation like marshal/unmarshal may not work 
> as expected. 
> - for spring-boot a solution would be to annotate auto configured data format 
> beans with prototype scope.
> - a more generic solution would be to make DataFormat Cloneable and clone the 
> bean found in the registry



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


[jira] [Commented] (CAMEL-10272) Aggregation is broken due to race condition in ParallelAggregateTask.doAggregateInternal()

2016-12-01 Thread Alex Dettinger (JIRA)

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

Alex Dettinger commented on CAMEL-10272:


Peter, thanks for your inputs.

  As you don't use _parallelAggregate()_, it may not be the cause of this issue.
However, it's interesting to note that I could also produce _oldExchange_ to be 
null more than once with _parallelAggregate()_, even with a thread safe 
aggregation strategy.
It may be an itch to scratch in another ticket.

  Back to this issue, I will propose a PR to log such exceptions in DEBUG level 
so one could have more details when facing such a situation.
We could make a great step forward if you could reproduce the behavior once 
while logging/unwinding throwables from your aggregation strategy.
Or you could also test against master with debug log level if the PR is 
accepted.

> Aggregation is broken due to race condition in 
> ParallelAggregateTask.doAggregateInternal()
> --
>
> Key: CAMEL-10272
> URL: https://issues.apache.org/jira/browse/CAMEL-10272
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.16.3, 2.17.3
> Environment: MacOS 10.11.6, JRE 1.7.0_79
>Reporter: Peter Keller
>
> Unfortunately, I am not able to provide a (simple) unit test for 
> comprehending the problem. Furthermore our (complex) unit tests are not 
> deterministic due to the root cause of the problem.
> However I tried to analyze the Camel Java code, to work out the problem. 
> Please find below my findings.
> h3. Problem
> The {{oldExchange}} is {{null}} more than once in the aggregator if a 
> recipient list is processed in parallel.
> h3. Camel route
> In my Camel route, a recipient list is worked of in parallel:
> {code}
>  from("direct:start")
> .to("direct:pre")
> .recipientList().method(new MyRecipientListBuilder())
> .stopOnException()
> .aggregationStrategy(new MyAggregationStrategy())
> .parallelProcessing()
> .end()
> .bean(new MyPostProcessor());
> {code}
> Snippet of {{MyAggregationStrategy}}:
> {code}
> @Override
> @SuppressWarnings("unchecked")
> public Exchange aggregate(final Exchange oldExchange, final Exchange 
> newExchange) {
> if (oldExchange == null) {
> // this is the case more than once which is not expected!
> }
> // ...
> {code}
> {{oldExchange}} is null more than once which is not expected and which 
> contradicts the contract with Camel.
> h3. Analysis
> During the processing, Camel invokes {{MulticastProcessor.process()}}. Here 
> the result object {{AtomicExchange}} is created which is shared during the 
> whole processing.
> If the processing should be done in parallel (as it is the case for our 
> route) then {{MulticastProcessor.doProcessParallel()}} is invoked. Here one 
> instance of {{AggregateOnTheFlyTask}} is initialized and 
> {{aggregateOnTheFly()}} is invoked -*asynchronously* via {{run()}}  for 
> *every* target in the recipient list-. via 
> {{aggregateExecutorService.submit}} ({{aggregationTaskSubmitted}} guarantees 
> that this is only be done once)
> In {{aggregateOnTheFly()}}, a new instance of {{ParallelAggregateTask}} is 
> generated, and if aggregation is not done in parallel (as it is the case in 
> our route), {{ParallelAggregateTask.run()}}, 
> {{ParallelAggregateTask.doAggregate()}} (this method is synchronized), and 
> {{ParallelAggregateTask.doAggregateInternal()}} is invoked synchronously:
> {code}
> protected void doAggregateInternal(AggregationStrategy strategy, 
> AtomicExchange result, Exchange exchange) {
> if (strategy != null) {
> // prepare the exchanges for aggregation
> Exchange oldExchange = result.get();
> ExchangeHelper.prepareAggregation(oldExchange, exchange);
> result.set(strategy.aggregate(oldExchange, exchange));
> }
> } 
> {code}
> However, in {{ParallelAggregateTask.doAggregateInternal()}} there may occur a 
> race condition as {{result}} is shared -by every instance of 
> {{AggregateOnTheFlyTask}}- such that {{oldExchange = result.get()}} may be 
> {{null}} more than once!
> Note: As a new instance of {{ParallelAggregateTask}} for every target in 
> recipient list is created, the {{synchronized}} method 
> {{ParallelAggregateTask.doAggregate()}} does not prevent the race condition!
> Does this sounds reasonably?



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


[jira] [Commented] (CAMEL-10272) Aggregation is broken due to race condition in ParallelAggregateTask.doAggregateInternal()

2016-12-01 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CAMEL-10272:


GitHub user aldettinger opened a pull request:

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

CAMEL-10272: Added a debug log and completed the javadoc

Please check 
[CAMEL-10272](https://issues.apache.org/jira/browse/CAMEL-10272) out for more 
details.
sourcecheck and tests are ok.

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

$ git pull https://github.com/aldettinger/camel master

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

https://github.com/apache/camel/pull/1326.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 #1326


commit 2e3de5e889241e707054f01f9cf385aea72508fe
Author: aldettinger 
Date:   2016-12-01T15:48:48Z

CAMEL-10272: Added a debug log covering for instance a runtime exception 
thrown from a custom aggregation strategy

commit b522d465467946a2640630e87d0854298c978953
Author: aldettinger 
Date:   2016-12-01T15:57:06Z

CAMEL-10272: Completed the aggregation strategy javadoc




> Aggregation is broken due to race condition in 
> ParallelAggregateTask.doAggregateInternal()
> --
>
> Key: CAMEL-10272
> URL: https://issues.apache.org/jira/browse/CAMEL-10272
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.16.3, 2.17.3
> Environment: MacOS 10.11.6, JRE 1.7.0_79
>Reporter: Peter Keller
>
> Unfortunately, I am not able to provide a (simple) unit test for 
> comprehending the problem. Furthermore our (complex) unit tests are not 
> deterministic due to the root cause of the problem.
> However I tried to analyze the Camel Java code, to work out the problem. 
> Please find below my findings.
> h3. Problem
> The {{oldExchange}} is {{null}} more than once in the aggregator if a 
> recipient list is processed in parallel.
> h3. Camel route
> In my Camel route, a recipient list is worked of in parallel:
> {code}
>  from("direct:start")
> .to("direct:pre")
> .recipientList().method(new MyRecipientListBuilder())
> .stopOnException()
> .aggregationStrategy(new MyAggregationStrategy())
> .parallelProcessing()
> .end()
> .bean(new MyPostProcessor());
> {code}
> Snippet of {{MyAggregationStrategy}}:
> {code}
> @Override
> @SuppressWarnings("unchecked")
> public Exchange aggregate(final Exchange oldExchange, final Exchange 
> newExchange) {
> if (oldExchange == null) {
> // this is the case more than once which is not expected!
> }
> // ...
> {code}
> {{oldExchange}} is null more than once which is not expected and which 
> contradicts the contract with Camel.
> h3. Analysis
> During the processing, Camel invokes {{MulticastProcessor.process()}}. Here 
> the result object {{AtomicExchange}} is created which is shared during the 
> whole processing.
> If the processing should be done in parallel (as it is the case for our 
> route) then {{MulticastProcessor.doProcessParallel()}} is invoked. Here one 
> instance of {{AggregateOnTheFlyTask}} is initialized and 
> {{aggregateOnTheFly()}} is invoked -*asynchronously* via {{run()}}  for 
> *every* target in the recipient list-. via 
> {{aggregateExecutorService.submit}} ({{aggregationTaskSubmitted}} guarantees 
> that this is only be done once)
> In {{aggregateOnTheFly()}}, a new instance of {{ParallelAggregateTask}} is 
> generated, and if aggregation is not done in parallel (as it is the case in 
> our route), {{ParallelAggregateTask.run()}}, 
> {{ParallelAggregateTask.doAggregate()}} (this method is synchronized), and 
> {{ParallelAggregateTask.doAggregateInternal()}} is invoked synchronously:
> {code}
> protected void doAggregateInternal(AggregationStrategy strategy, 
> AtomicExchange result, Exchange exchange) {
> if (strategy != null) {
> // prepare the exchanges for aggregation
> Exchange oldExchange = result.get();
> ExchangeHelper.prepareAggregation(oldExchange, exchange);
> result.set(strategy.aggregate(oldExchange, exchange));
> }
> } 
> {code}
> However, in {{ParallelAggregateTask.doAggregateInternal()}} there may occur a 
> race condition as {{result}} is shared -by every instance of 
> {{AggregateOnTheFlyTask}}- such that {{oldExchange = result.get()}} may be 
> {{null}} more than once!
> Note: As a new instance of {{ParallelAggregateTask}} for every target in 
> recipient list is created, the {{synchronized}} method 
> {{ParallelAggregateTask.doAggregate()}} does not prevent the race 

[jira] [Commented] (CAMEL-10272) Aggregation is broken due to race condition in ParallelAggregateTask.doAggregateInternal()

2016-12-01 Thread Alex Dettinger (JIRA)

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

Alex Dettinger commented on CAMEL-10272:


Peter, thanks for your inputs.

  As you don't use _parallelAggregate()_, it may not be the cause of this issue.
However, it's interesting to note that I could also produce _oldExchange_ to be 
null more than once with _parallelAggregate()_, even with a thread safe 
aggregation strategy.
It may be an itch to scratch in another ticket.

  Back to this issue, I will propose a PR to log such exceptions in DEBUG level 
so one could have more details when facing such a situation.
We could make a great step forward if you could reproduce the behavior once 
while logging/unwinding throwables from your aggregation strategy.
Or you could also test against master with debug log level if the PR is 
accepted.

> Aggregation is broken due to race condition in 
> ParallelAggregateTask.doAggregateInternal()
> --
>
> Key: CAMEL-10272
> URL: https://issues.apache.org/jira/browse/CAMEL-10272
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.16.3, 2.17.3
> Environment: MacOS 10.11.6, JRE 1.7.0_79
>Reporter: Peter Keller
>
> Unfortunately, I am not able to provide a (simple) unit test for 
> comprehending the problem. Furthermore our (complex) unit tests are not 
> deterministic due to the root cause of the problem.
> However I tried to analyze the Camel Java code, to work out the problem. 
> Please find below my findings.
> h3. Problem
> The {{oldExchange}} is {{null}} more than once in the aggregator if a 
> recipient list is processed in parallel.
> h3. Camel route
> In my Camel route, a recipient list is worked of in parallel:
> {code}
>  from("direct:start")
> .to("direct:pre")
> .recipientList().method(new MyRecipientListBuilder())
> .stopOnException()
> .aggregationStrategy(new MyAggregationStrategy())
> .parallelProcessing()
> .end()
> .bean(new MyPostProcessor());
> {code}
> Snippet of {{MyAggregationStrategy}}:
> {code}
> @Override
> @SuppressWarnings("unchecked")
> public Exchange aggregate(final Exchange oldExchange, final Exchange 
> newExchange) {
> if (oldExchange == null) {
> // this is the case more than once which is not expected!
> }
> // ...
> {code}
> {{oldExchange}} is null more than once which is not expected and which 
> contradicts the contract with Camel.
> h3. Analysis
> During the processing, Camel invokes {{MulticastProcessor.process()}}. Here 
> the result object {{AtomicExchange}} is created which is shared during the 
> whole processing.
> If the processing should be done in parallel (as it is the case for our 
> route) then {{MulticastProcessor.doProcessParallel()}} is invoked. Here one 
> instance of {{AggregateOnTheFlyTask}} is initialized and 
> {{aggregateOnTheFly()}} is invoked -*asynchronously* via {{run()}}  for 
> *every* target in the recipient list-. via 
> {{aggregateExecutorService.submit}} ({{aggregationTaskSubmitted}} guarantees 
> that this is only be done once)
> In {{aggregateOnTheFly()}}, a new instance of {{ParallelAggregateTask}} is 
> generated, and if aggregation is not done in parallel (as it is the case in 
> our route), {{ParallelAggregateTask.run()}}, 
> {{ParallelAggregateTask.doAggregate()}} (this method is synchronized), and 
> {{ParallelAggregateTask.doAggregateInternal()}} is invoked synchronously:
> {code}
> protected void doAggregateInternal(AggregationStrategy strategy, 
> AtomicExchange result, Exchange exchange) {
> if (strategy != null) {
> // prepare the exchanges for aggregation
> Exchange oldExchange = result.get();
> ExchangeHelper.prepareAggregation(oldExchange, exchange);
> result.set(strategy.aggregate(oldExchange, exchange));
> }
> } 
> {code}
> However, in {{ParallelAggregateTask.doAggregateInternal()}} there may occur a 
> race condition as {{result}} is shared -by every instance of 
> {{AggregateOnTheFlyTask}}- such that {{oldExchange = result.get()}} may be 
> {{null}} more than once!
> Note: As a new instance of {{ParallelAggregateTask}} for every target in 
> recipient list is created, the {{synchronized}} method 
> {{ParallelAggregateTask.doAggregate()}} does not prevent the race condition!
> Does this sounds reasonably?



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


[jira] [Issue Comment Deleted] (CAMEL-10272) Aggregation is broken due to race condition in ParallelAggregateTask.doAggregateInternal()

2016-12-01 Thread Alex Dettinger (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-10272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alex Dettinger updated CAMEL-10272:
---
Comment: was deleted

(was: Peter, thanks for your inputs.

  As you don't use _parallelAggregate()_, it may not be the cause of this issue.
However, it's interesting to note that I could also produce _oldExchange_ to be 
null more than once with _parallelAggregate()_, even with a thread safe 
aggregation strategy.
It may be an itch to scratch in another ticket.

  Back to this issue, I will propose a PR to log such exceptions in DEBUG level 
so one could have more details when facing such a situation.
We could make a great step forward if you could reproduce the behavior once 
while logging/unwinding throwables from your aggregation strategy.
Or you could also test against master with debug log level if the PR is 
accepted.)

> Aggregation is broken due to race condition in 
> ParallelAggregateTask.doAggregateInternal()
> --
>
> Key: CAMEL-10272
> URL: https://issues.apache.org/jira/browse/CAMEL-10272
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.16.3, 2.17.3
> Environment: MacOS 10.11.6, JRE 1.7.0_79
>Reporter: Peter Keller
>
> Unfortunately, I am not able to provide a (simple) unit test for 
> comprehending the problem. Furthermore our (complex) unit tests are not 
> deterministic due to the root cause of the problem.
> However I tried to analyze the Camel Java code, to work out the problem. 
> Please find below my findings.
> h3. Problem
> The {{oldExchange}} is {{null}} more than once in the aggregator if a 
> recipient list is processed in parallel.
> h3. Camel route
> In my Camel route, a recipient list is worked of in parallel:
> {code}
>  from("direct:start")
> .to("direct:pre")
> .recipientList().method(new MyRecipientListBuilder())
> .stopOnException()
> .aggregationStrategy(new MyAggregationStrategy())
> .parallelProcessing()
> .end()
> .bean(new MyPostProcessor());
> {code}
> Snippet of {{MyAggregationStrategy}}:
> {code}
> @Override
> @SuppressWarnings("unchecked")
> public Exchange aggregate(final Exchange oldExchange, final Exchange 
> newExchange) {
> if (oldExchange == null) {
> // this is the case more than once which is not expected!
> }
> // ...
> {code}
> {{oldExchange}} is null more than once which is not expected and which 
> contradicts the contract with Camel.
> h3. Analysis
> During the processing, Camel invokes {{MulticastProcessor.process()}}. Here 
> the result object {{AtomicExchange}} is created which is shared during the 
> whole processing.
> If the processing should be done in parallel (as it is the case for our 
> route) then {{MulticastProcessor.doProcessParallel()}} is invoked. Here one 
> instance of {{AggregateOnTheFlyTask}} is initialized and 
> {{aggregateOnTheFly()}} is invoked -*asynchronously* via {{run()}}  for 
> *every* target in the recipient list-. via 
> {{aggregateExecutorService.submit}} ({{aggregationTaskSubmitted}} guarantees 
> that this is only be done once)
> In {{aggregateOnTheFly()}}, a new instance of {{ParallelAggregateTask}} is 
> generated, and if aggregation is not done in parallel (as it is the case in 
> our route), {{ParallelAggregateTask.run()}}, 
> {{ParallelAggregateTask.doAggregate()}} (this method is synchronized), and 
> {{ParallelAggregateTask.doAggregateInternal()}} is invoked synchronously:
> {code}
> protected void doAggregateInternal(AggregationStrategy strategy, 
> AtomicExchange result, Exchange exchange) {
> if (strategy != null) {
> // prepare the exchanges for aggregation
> Exchange oldExchange = result.get();
> ExchangeHelper.prepareAggregation(oldExchange, exchange);
> result.set(strategy.aggregate(oldExchange, exchange));
> }
> } 
> {code}
> However, in {{ParallelAggregateTask.doAggregateInternal()}} there may occur a 
> race condition as {{result}} is shared -by every instance of 
> {{AggregateOnTheFlyTask}}- such that {{oldExchange = result.get()}} may be 
> {{null}} more than once!
> Note: As a new instance of {{ParallelAggregateTask}} for every target in 
> recipient list is created, the {{synchronized}} method 
> {{ParallelAggregateTask.doAggregate()}} does not prevent the race condition!
> Does this sounds reasonably?



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


[jira] [Commented] (CAMEL-9047) Replace deprecated boxjavalibv2 with box-java-sdk

2016-12-01 Thread William Collins (JIRA)

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

William Collins commented on CAMEL-9047:


I am working on contributing a new BOX component based on the box-java-sdk.

> Replace deprecated boxjavalibv2 with box-java-sdk
> -
>
> Key: CAMEL-9047
> URL: https://issues.apache.org/jira/browse/CAMEL-9047
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-box
>Affects Versions: 2.15.2
>Reporter: Tomas Rohovsky
>Assignee: Dhiraj Bokde
>
> camel-box component is based on boxjavalibv2 \[1\], which was made deprecated 
> in favour of box-java-sdk \[2\] \[3\]. "The new SDK is not backwards 
> compatible and any code using this SDK will need to be migrated in order to 
> take advantage of any new features and bug fixes."
> \[1\] https://github.com/box/deprecated-box-java-sdk-v2
> \[2\] http://opensource.box.com/box-java-sdk/
> \[3\] https://www.box.com/blog/the-new-box-java-sdk/



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


[jira] [Resolved] (CAMEL-10548) Converter from List to String is not found when @EnableAutoConfiguration is used

2016-12-01 Thread Luca Burgazzoli (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-10548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Luca Burgazzoli resolved CAMEL-10548.
-
Resolution: Fixed

> Converter from List to String is not found when @EnableAutoConfiguration is 
> used
> 
>
> Key: CAMEL-10548
> URL: https://issues.apache.org/jira/browse/CAMEL-10548
> Project: Camel
>  Issue Type: Bug
>  Components: camel-spring-boot
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.18.2, 2.19.0
>
>
> This very simple spring-boot application :
> {code:java}
> @SpringBootApplication
> public class Application {
> public static void main(String[] args) {
> SpringApplication.run(Application.class, args);
> }
> @Component
> public class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("timer:person")
> .setBody().constant(Arrays.asList(
> new Person("Peter", 25),
> new Person("John", 33)
> ))
> .log("Body is ${body}");
> }
> }
> public static class Person {
> private String name;
> private int age;
> public Person(String name, int age) {
> this.name = name;
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> @Override
> public String toString() {
> return "Person{" +
> "name='" + name + '\'' +
> ", age=" + age +
> '}';
> }
> }
> }
> {code}
> Fails to resolve the simple expression ${body} because of the following 
> exception:
> {code}
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.String with value 
> [Person{name='Peter', age=25}, Person{name='John', age=33}] due Failed to 
> convert from type [java.util.Arrays$ArrayList] to type [java.lang.String] 
> for value '[Person{name='Peter', age=25}, Person{name='John', age=33}]'; 
> nested exception is 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:41)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.builder.ExpressionBuilder$75.evaluate(ExpressionBuilder.java:1795)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.LogProcessor.process(LogProcessor.java:53) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:192)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76) 
> [camel-core-2.18.0.jar:2.18.0]
>   at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_112]
>   at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_112]
> Caused by: org.springframework.core.convert.ConversionFailedException: Failed 
> to convert from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String] for value 

[jira] [Updated] (CAMEL-10548) Converter from List to String is not found when @EnableAutoConfiguration is used

2016-12-01 Thread Luca Burgazzoli (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-10548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Luca Burgazzoli updated CAMEL-10548:

Fix Version/s: 2.18.2

> Converter from List to String is not found when @EnableAutoConfiguration is 
> used
> 
>
> Key: CAMEL-10548
> URL: https://issues.apache.org/jira/browse/CAMEL-10548
> Project: Camel
>  Issue Type: Bug
>  Components: camel-spring-boot
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.18.2, 2.19.0
>
>
> This very simple spring-boot application :
> {code:java}
> @SpringBootApplication
> public class Application {
> public static void main(String[] args) {
> SpringApplication.run(Application.class, args);
> }
> @Component
> public class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("timer:person")
> .setBody().constant(Arrays.asList(
> new Person("Peter", 25),
> new Person("John", 33)
> ))
> .log("Body is ${body}");
> }
> }
> public static class Person {
> private String name;
> private int age;
> public Person(String name, int age) {
> this.name = name;
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> @Override
> public String toString() {
> return "Person{" +
> "name='" + name + '\'' +
> ", age=" + age +
> '}';
> }
> }
> }
> {code}
> Fails to resolve the simple expression ${body} because of the following 
> exception:
> {code}
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.String with value 
> [Person{name='Peter', age=25}, Person{name='John', age=33}] due Failed to 
> convert from type [java.util.Arrays$ArrayList] to type [java.lang.String] 
> for value '[Person{name='Peter', age=25}, Person{name='John', age=33}]'; 
> nested exception is 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:41)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.builder.ExpressionBuilder$75.evaluate(ExpressionBuilder.java:1795)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.LogProcessor.process(LogProcessor.java:53) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:192)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76) 
> [camel-core-2.18.0.jar:2.18.0]
>   at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_112]
>   at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_112]
> Caused by: org.springframework.core.convert.ConversionFailedException: Failed 
> to convert from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String] for value 

[jira] [Commented] (CAMEL-10542) DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

2016-12-01 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli commented on CAMEL-10542:
-

Thinking a little bit more if we do so we may have other issues in spring-boot 
as I may want to do:

{code:java}
from(...)
  .marshal()
.csv()
{code}

And have the csv marshal leveraging spring-boot auto configuration but if we 
require to use a reference, the spring-configuration magic won't happen any 
more, am I missing something ?


> DataFormat from registry is used for every dataformat operation 
> (marshal/unmarshal)
> ---
>
> Key: CAMEL-10542
> URL: https://issues.apache.org/jira/browse/CAMEL-10542
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.18.2, 2.19.0
>
>
> While working on an issue related to spring-boot I found out that if a data 
> format is registered in camel registry with the same name as the one camel 
> looks-up with the help of DefaultDataFormatResolver, this object is then 
> re-configured for each data format definition so one definition may override 
> previous configuration with an undefined behavior.
> So assume you have an xml route definitions as:
> {code:xml}
> http://camel.apache.org/schema/spring;>
>   
> 
> 
>   
> 
>   
>   
> 
> 
>   
> 
>   
> 
> {code}
> And some code like:
> {code:java}
> InputStream is = getClass().getResourceAsStream("...");
> SimpleRegistry reg = new SimpleRegistry();
> reg.put("csv-dataformat", new CsvDataFormat());
> DefaultCamelContext ctx = new DefaultCamelContext(reg);
> ctx.addRouteDefinitions(ctx.loadRoutesDefinition(is).getRoutes());
> ctx.start();
> ProducerTemplate template = ctx.createProducerTemplate();
> String result = template.requestBody(
> "direct:marshal",
> Arrays.asList(Arrays.asList( "A1", "B1", "C1" )),
> String.class);
> assertEquals("A1,B1,C1", result);
> ctx.stop
> {code}
> Then this test fails with:
> {code}
> Expected :A1,B1,C1
> Actual   :A1;B1;C1
> {code}
> It fails because the object added to the SimpleRegistry is shared among the 
> two csv dataformats  so it is configured to have delimiter = ';' 
> For spring-boot this causes some issues as it registers data formats beans as 
> part of its auto-configuration magic thus if you do not set your own instance 
> of data format, any data format operation like marshal/unmarshal may not work 
> as expected. 
> - for spring-boot a solution would be to annotate auto configured data format 
> beans with prototype scope.
> - a more generic solution would be to make DataFormat Cloneable and clone the 
> bean found in the registry



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


[jira] [Commented] (CAMEL-10548) Converter from List to String is not found when @EnableAutoConfiguration is used

2016-12-01 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-10548:
-

Yeah that is better than an exception.



> Converter from List to String is not found when @EnableAutoConfiguration is 
> used
> 
>
> Key: CAMEL-10548
> URL: https://issues.apache.org/jira/browse/CAMEL-10548
> Project: Camel
>  Issue Type: Bug
>  Components: camel-spring-boot
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.19.0
>
>
> This very simple spring-boot application :
> {code:java}
> @SpringBootApplication
> public class Application {
> public static void main(String[] args) {
> SpringApplication.run(Application.class, args);
> }
> @Component
> public class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("timer:person")
> .setBody().constant(Arrays.asList(
> new Person("Peter", 25),
> new Person("John", 33)
> ))
> .log("Body is ${body}");
> }
> }
> public static class Person {
> private String name;
> private int age;
> public Person(String name, int age) {
> this.name = name;
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> @Override
> public String toString() {
> return "Person{" +
> "name='" + name + '\'' +
> ", age=" + age +
> '}';
> }
> }
> }
> {code}
> Fails to resolve the simple expression ${body} because of the following 
> exception:
> {code}
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.String with value 
> [Person{name='Peter', age=25}, Person{name='John', age=33}] due Failed to 
> convert from type [java.util.Arrays$ArrayList] to type [java.lang.String] 
> for value '[Person{name='Peter', age=25}, Person{name='John', age=33}]'; 
> nested exception is 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:41)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.builder.ExpressionBuilder$75.evaluate(ExpressionBuilder.java:1795)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.LogProcessor.process(LogProcessor.java:53) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:192)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76) 
> [camel-core-2.18.0.jar:2.18.0]
>   at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_112]
>   at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_112]
> Caused by: org.springframework.core.convert.ConversionFailedException: Failed 
> to convert from type [java.util.Arrays$ArrayList] to type 
> 

[jira] [Comment Edited] (CAMEL-10548) Converter from List to String is not found when @EnableAutoConfiguration is used

2016-12-01 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli edited comment on CAMEL-10548 at 12/1/16 2:13 PM:
--

Yes an not :-)

Spring says that it can convert from List to String and it is true but then 
thing is that Spring can't convert from Person to String as 
FallbackObjectToStringConverter can convert POJO if they have a String 
constructor or they have a valueOf(String) method (yeah, even if we are 
converting in the opposite way). 

What spring does under the hoods is looping over the collection and search a 
converter for the each element which of course may not be present.

I'm going to submit an issue to Spring but in the meantime I have this hack:

  
https://github.com/lburgazzoli/apache-camel/commit/daf9c98f5d344d62cf551084dd4edb99e6509c52

Would it be acceptable ?


was (Author: lb):
Yes an not :-)

Spring says that it can convert from List to String and it is true but then 
thing is that Spring can't convert from Person to String as 
FallbackObjectToStringConverter can convert POJO if they have a String 
constructor or they have a valueOf(String) method (yeah, even if we are 
convertinf the opposite way). 

What spring does under the hoods is looping over the collection and search a 
converter for the each element which of course may not be present.

I'm going to submit an issue to Spring but in the meantime I have this hack:

  
https://github.com/lburgazzoli/apache-camel/commit/daf9c98f5d344d62cf551084dd4edb99e6509c52

Would it be acceptable ?

> Converter from List to String is not found when @EnableAutoConfiguration is 
> used
> 
>
> Key: CAMEL-10548
> URL: https://issues.apache.org/jira/browse/CAMEL-10548
> Project: Camel
>  Issue Type: Bug
>  Components: camel-spring-boot
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.19.0
>
>
> This very simple spring-boot application :
> {code:java}
> @SpringBootApplication
> public class Application {
> public static void main(String[] args) {
> SpringApplication.run(Application.class, args);
> }
> @Component
> public class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("timer:person")
> .setBody().constant(Arrays.asList(
> new Person("Peter", 25),
> new Person("John", 33)
> ))
> .log("Body is ${body}");
> }
> }
> public static class Person {
> private String name;
> private int age;
> public Person(String name, int age) {
> this.name = name;
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> @Override
> public String toString() {
> return "Person{" +
> "name='" + name + '\'' +
> ", age=" + age +
> '}';
> }
> }
> }
> {code}
> Fails to resolve the simple expression ${body} because of the following 
> exception:
> {code}
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.String with value 
> [Person{name='Peter', age=25}, Person{name='John', age=33}] due Failed to 
> convert from type [java.util.Arrays$ArrayList] to type [java.lang.String] 
> for value '[Person{name='Peter', age=25}, Person{name='John', age=33}]'; 
> nested exception is 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:41)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.builder.ExpressionBuilder$75.evaluate(ExpressionBuilder.java:1795)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> 

[jira] [Comment Edited] (CAMEL-10548) Converter from List to String is not found when @EnableAutoConfiguration is used

2016-12-01 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli edited comment on CAMEL-10548 at 12/1/16 2:13 PM:
--

Yes an not :-)

Spring says that it can convert from List to String and it is true but then 
thing is that Spring can't convert from Person to String as 
FallbackObjectToStringConverter can convert POJO if they have a String 
constructor or they have a valueOf(String) method (yeah, even if we are 
convertinf the opposite way). 

What spring does under the hoods is looping over the collection and search a 
converter for the each element which of course may not be present.

I'm going to submit an issue to Spring but in the meantime I have this hack:

  
https://github.com/lburgazzoli/apache-camel/commit/daf9c98f5d344d62cf551084dd4edb99e6509c52

Would it be acceptable ?


was (Author: lb):
Yes an not :-)

Spring says that it can convert from List to String and it is true but then 
thing is that Spring can't convert from Person to String as 
FallbackObjectToStringConverter can convert POJO if they have a String 
constructor or they have a valueOf(String) method. What spring does under the 
hoods is looping over the collection and search a converter for the each 
element which of course may not be present.

I'm going to submit an issue to Spring but in the meantime I have this hack:

  
https://github.com/lburgazzoli/apache-camel/commit/daf9c98f5d344d62cf551084dd4edb99e6509c52

Would it be acceptable ?

> Converter from List to String is not found when @EnableAutoConfiguration is 
> used
> 
>
> Key: CAMEL-10548
> URL: https://issues.apache.org/jira/browse/CAMEL-10548
> Project: Camel
>  Issue Type: Bug
>  Components: camel-spring-boot
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.19.0
>
>
> This very simple spring-boot application :
> {code:java}
> @SpringBootApplication
> public class Application {
> public static void main(String[] args) {
> SpringApplication.run(Application.class, args);
> }
> @Component
> public class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("timer:person")
> .setBody().constant(Arrays.asList(
> new Person("Peter", 25),
> new Person("John", 33)
> ))
> .log("Body is ${body}");
> }
> }
> public static class Person {
> private String name;
> private int age;
> public Person(String name, int age) {
> this.name = name;
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> @Override
> public String toString() {
> return "Person{" +
> "name='" + name + '\'' +
> ", age=" + age +
> '}';
> }
> }
> }
> {code}
> Fails to resolve the simple expression ${body} because of the following 
> exception:
> {code}
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.String with value 
> [Person{name='Peter', age=25}, Person{name='John', age=33}] due Failed to 
> convert from type [java.util.Arrays$ArrayList] to type [java.lang.String] 
> for value '[Person{name='Peter', age=25}, Person{name='John', age=33}]'; 
> nested exception is 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:41)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.builder.ExpressionBuilder$75.evaluate(ExpressionBuilder.java:1795)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.LogProcessor.process(LogProcessor.java:53) 
> 

[jira] [Commented] (CAMEL-10548) Converter from List to String is not found when @EnableAutoConfiguration is used

2016-12-01 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli commented on CAMEL-10548:
-

Yes an not :-)

Spring says that it can convert from List to String and it is true but then 
thing is that Spring can't convert from Person to String as 
FallbackObjectToStringConverter can convert POJO if they have a String 
constructor or they have a valueOf(String) method. What spring does under the 
hoods is looping over the collection and search a converter for the each 
element which of course may not be present.

I'm going to submit an issue to Spring but in the meantime I have this hack:

  
https://github.com/lburgazzoli/apache-camel/commit/daf9c98f5d344d62cf551084dd4edb99e6509c52

Would it be acceptable ?

> Converter from List to String is not found when @EnableAutoConfiguration is 
> used
> 
>
> Key: CAMEL-10548
> URL: https://issues.apache.org/jira/browse/CAMEL-10548
> Project: Camel
>  Issue Type: Bug
>  Components: camel-spring-boot
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.19.0
>
>
> This very simple spring-boot application :
> {code:java}
> @SpringBootApplication
> public class Application {
> public static void main(String[] args) {
> SpringApplication.run(Application.class, args);
> }
> @Component
> public class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("timer:person")
> .setBody().constant(Arrays.asList(
> new Person("Peter", 25),
> new Person("John", 33)
> ))
> .log("Body is ${body}");
> }
> }
> public static class Person {
> private String name;
> private int age;
> public Person(String name, int age) {
> this.name = name;
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> @Override
> public String toString() {
> return "Person{" +
> "name='" + name + '\'' +
> ", age=" + age +
> '}';
> }
> }
> }
> {code}
> Fails to resolve the simple expression ${body} because of the following 
> exception:
> {code}
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.String with value 
> [Person{name='Peter', age=25}, Person{name='John', age=33}] due Failed to 
> convert from type [java.util.Arrays$ArrayList] to type [java.lang.String] 
> for value '[Person{name='Peter', age=25}, Person{name='John', age=33}]'; 
> nested exception is 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:41)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.builder.ExpressionBuilder$75.evaluate(ExpressionBuilder.java:1795)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.LogProcessor.process(LogProcessor.java:53) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> 

[jira] [Work started] (CAMEL-10548) Converter from List to String is not found when @EnableAutoConfiguration is used

2016-12-01 Thread Luca Burgazzoli (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-10548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-10548 started by Luca Burgazzoli.
---
> Converter from List to String is not found when @EnableAutoConfiguration is 
> used
> 
>
> Key: CAMEL-10548
> URL: https://issues.apache.org/jira/browse/CAMEL-10548
> Project: Camel
>  Issue Type: Bug
>  Components: camel-spring-boot
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.19.0
>
>
> This very simple spring-boot application :
> {code:java}
> @SpringBootApplication
> public class Application {
> public static void main(String[] args) {
> SpringApplication.run(Application.class, args);
> }
> @Component
> public class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("timer:person")
> .setBody().constant(Arrays.asList(
> new Person("Peter", 25),
> new Person("John", 33)
> ))
> .log("Body is ${body}");
> }
> }
> public static class Person {
> private String name;
> private int age;
> public Person(String name, int age) {
> this.name = name;
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> @Override
> public String toString() {
> return "Person{" +
> "name='" + name + '\'' +
> ", age=" + age +
> '}';
> }
> }
> }
> {code}
> Fails to resolve the simple expression ${body} because of the following 
> exception:
> {code}
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.String with value 
> [Person{name='Peter', age=25}, Person{name='John', age=33}] due Failed to 
> convert from type [java.util.Arrays$ArrayList] to type [java.lang.String] 
> for value '[Person{name='Peter', age=25}, Person{name='John', age=33}]'; 
> nested exception is 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:41)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.builder.ExpressionBuilder$75.evaluate(ExpressionBuilder.java:1795)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.LogProcessor.process(LogProcessor.java:53) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:192)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76) 
> [camel-core-2.18.0.jar:2.18.0]
>   at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_112]
>   at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_112]
> Caused by: org.springframework.core.convert.ConversionFailedException: Failed 
> to convert from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String] for value '[Person{name='Peter', 

[jira] [Commented] (CAMEL-10542) DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

2016-12-01 Thread Luca Burgazzoli (JIRA)

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

Luca Burgazzoli commented on CAMEL-10542:
-

Going to have a look, thx [~davsclaus]

> DataFormat from registry is used for every dataformat operation 
> (marshal/unmarshal)
> ---
>
> Key: CAMEL-10542
> URL: https://issues.apache.org/jira/browse/CAMEL-10542
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.18.2, 2.19.0
>
>
> While working on an issue related to spring-boot I found out that if a data 
> format is registered in camel registry with the same name as the one camel 
> looks-up with the help of DefaultDataFormatResolver, this object is then 
> re-configured for each data format definition so one definition may override 
> previous configuration with an undefined behavior.
> So assume you have an xml route definitions as:
> {code:xml}
> http://camel.apache.org/schema/spring;>
>   
> 
> 
>   
> 
>   
>   
> 
> 
>   
> 
>   
> 
> {code}
> And some code like:
> {code:java}
> InputStream is = getClass().getResourceAsStream("...");
> SimpleRegistry reg = new SimpleRegistry();
> reg.put("csv-dataformat", new CsvDataFormat());
> DefaultCamelContext ctx = new DefaultCamelContext(reg);
> ctx.addRouteDefinitions(ctx.loadRoutesDefinition(is).getRoutes());
> ctx.start();
> ProducerTemplate template = ctx.createProducerTemplate();
> String result = template.requestBody(
> "direct:marshal",
> Arrays.asList(Arrays.asList( "A1", "B1", "C1" )),
> String.class);
> assertEquals("A1,B1,C1", result);
> ctx.stop
> {code}
> Then this test fails with:
> {code}
> Expected :A1,B1,C1
> Actual   :A1;B1;C1
> {code}
> It fails because the object added to the SimpleRegistry is shared among the 
> two csv dataformats  so it is configured to have delimiter = ';' 
> For spring-boot this causes some issues as it registers data formats beans as 
> part of its auto-configuration magic thus if you do not set your own instance 
> of data format, any data format operation like marshal/unmarshal may not work 
> as expected. 
> - for spring-boot a solution would be to annotate auto configured data format 
> beans with prototype scope.
> - a more generic solution would be to make DataFormat Cloneable and clone the 
> bean found in the registry



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


[jira] [Commented] (CAMEL-10542) DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

2016-12-01 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-10542:
-

You could argue that  ... should use its own instance as there is 
no reference to a named data format, where as using  then you are using that shared your add to the registry.

So its maybe more in how  creates the dataformat that needs to be 
looked at / fixed.

> DataFormat from registry is used for every dataformat operation 
> (marshal/unmarshal)
> ---
>
> Key: CAMEL-10542
> URL: https://issues.apache.org/jira/browse/CAMEL-10542
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.18.2, 2.19.0
>
>
> While working on an issue related to spring-boot I found out that if a data 
> format is registered in camel registry with the same name as the one camel 
> looks-up with the help of DefaultDataFormatResolver, this object is then 
> re-configured for each data format definition so one definition may override 
> previous configuration with an undefined behavior.
> So assume you have an xml route definitions as:
> {code:xml}
> http://camel.apache.org/schema/spring;>
>   
> 
> 
>   
> 
>   
>   
> 
> 
>   
> 
>   
> 
> {code}
> And some code like:
> {code:java}
> InputStream is = getClass().getResourceAsStream("...");
> SimpleRegistry reg = new SimpleRegistry();
> reg.put("csv-dataformat", new CsvDataFormat());
> DefaultCamelContext ctx = new DefaultCamelContext(reg);
> ctx.addRouteDefinitions(ctx.loadRoutesDefinition(is).getRoutes());
> ctx.start();
> ProducerTemplate template = ctx.createProducerTemplate();
> String result = template.requestBody(
> "direct:marshal",
> Arrays.asList(Arrays.asList( "A1", "B1", "C1" )),
> String.class);
> assertEquals("A1,B1,C1", result);
> ctx.stop
> {code}
> Then this test fails with:
> {code}
> Expected :A1,B1,C1
> Actual   :A1;B1;C1
> {code}
> It fails because the object added to the SimpleRegistry is shared among the 
> two csv dataformats  so it is configured to have delimiter = ';' 
> For spring-boot this causes some issues as it registers data formats beans as 
> part of its auto-configuration magic thus if you do not set your own instance 
> of data format, any data format operation like marshal/unmarshal may not work 
> as expected. 
> - for spring-boot a solution would be to annotate auto configured data format 
> beans with prototype scope.
> - a more generic solution would be to make DataFormat Cloneable and clone the 
> bean found in the registry



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


[jira] [Resolved] (CAMEL-10344) RouteIdFactory - That can assign route ids using derived values from uris

2016-12-01 Thread Claus Ibsen (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-10344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-10344.
-
Resolution: Fixed
  Assignee: Claus Ibsen

Thanks for the PRs

> RouteIdFactory - That can assign route ids using derived values from uris
> -
>
> Key: CAMEL-10344
> URL: https://issues.apache.org/jira/browse/CAMEL-10344
> Project: Camel
>  Issue Type: New Feature
>  Components: camel-core
>Reporter: Claus Ibsen
>Assignee: Claus Ibsen
>Priority: Minor
> Fix For: 2.19.0
>
>
> When using routes that uses direct/seda etc as route inputs, then you may 
> want to use their name as the route id, eg
> direct:foo   -> foo
> seda:bar-> bar
> jms:orders -> orders
> Instead of having route1, route2 as auto assigned names. 
> There could be a NodeIdFactory that assign such names for route's. For 
> example it can use the context-path of the route url as the name.



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


[jira] [Commented] (CAMEL-10344) RouteIdFactory - That can assign route ids using derived values from uris

2016-12-01 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CAMEL-10344:


Github user tkopczynski closed the pull request at:

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


> RouteIdFactory - That can assign route ids using derived values from uris
> -
>
> Key: CAMEL-10344
> URL: https://issues.apache.org/jira/browse/CAMEL-10344
> Project: Camel
>  Issue Type: New Feature
>  Components: camel-core
>Reporter: Claus Ibsen
>Priority: Minor
> Fix For: 2.19.0
>
>
> When using routes that uses direct/seda etc as route inputs, then you may 
> want to use their name as the route id, eg
> direct:foo   -> foo
> seda:bar-> bar
> jms:orders -> orders
> Instead of having route1, route2 as auto assigned names. 
> There could be a NodeIdFactory that assign such names for route's. For 
> example it can use the context-path of the route url as the name.



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


[jira] [Commented] (CAMEL-10440) ftp component: Errors during file download bypass redelivery and goes directly to the deadletterchannel

2016-12-01 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-10440:
-

No you can contact commercial support if you need help faster
http://camel.apache.org/support.html

> ftp component: Errors during file download bypass redelivery and goes 
> directly to the deadletterchannel 
> 
>
> Key: CAMEL-10440
> URL: https://issues.apache.org/jira/browse/CAMEL-10440
> Project: Camel
>  Issue Type: Bug
>  Components: camel-ftp
>Affects Versions: 2.17.3, 2.18.0
> Environment: Behavior verified on MS Windows 7 (Spring Boot based 
> application) and MacOS (set based on "camel-example-ftp"). 
>Reporter: Klaus Johansen
>Priority: Minor
> Attachments: ConsumerPollStrategy.java, MyFtpServer.java, 
> MyFtpServerRouteBuilder.java
>
>
> When the FTP consumer is hit by an error during download of a file (eg. 
> socket timeout or because of missing read permission on the file) a 
> GenericFileOperationFailedException is thrown. Unfortunately is impossible to 
> recover from this error using redelivery because the message is forced onto 
> the deadletterchannel (marked exhausted?)
> When using consumer.bridgeErrorHandler=true redelivery works fine when the 
> errors happens during the polling phase (eg. connection timeouts and missing 
> directories).  
> When the error goes directly to the deadletterchannel the rollback method of 
> the PollingConsumerPollStrategy is never called. This makes it difficult to 
> access the consumer and force a disconnect in order to recover from the error 
> situtation (like it is done by RemoteFilePollingConsumerPollStrategy). 
> [DefaultQuartzScheduler-camel-1_Worker-1] INFO 
> org.apache.camel.example.ftp.ConsumerPollStrategy - Poll starting for 
> endpoint: 
> ftp://localhost:21/testdir?autoCreate=false=true...
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Exception checking 
> connection status: File operation failed: null Connection is not open. Code: 0
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Not connected/logged in, 
> connecting to: ftp://testuser@localhost:21
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Connected and logged in 
> to: ftp://testuser@localhost:21
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Took 0.151 seconds to 
> poll: testdir
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Total 1 files to consume
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.processor.DeadLetterChannel - Failed delivery for 
> (MessageId: ID-Klauss-MacBook-Pro-2-local-52649-1478165172245-0-2 on 
> ExchangeId: ID-Klauss-MacBook-Pro-2-local-52649-1478165172245-0-3). On 
> delivery attempt: 0 caught: 
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot 
> retrieve file: RemoteFile[testfile.txt] from: 
> ftp://localhost:21/testdir?autoCreate=false=true=testfile.txt=xx=%23try3times=%23myProcessStrategy=quartz2=15+0%2F1+*+%3F+*+*=true=5000=testuser
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot 
> retrieve file: RemoteFile[testfile.txt] from: 
> ftp://localhost:21/testdir?autoCreate=false=true=testfile.txt=xx=%23try3times=%23myProcessStrategy=quartz2=15+0%2F1+*+%3F+*+*=true=5000=testuser
>   at 
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:436)
>   at 
> org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:137)
>   at 
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
>   at 
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
>   at 
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
>   at 
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
>   at 
> org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerJob.execute(QuartzScheduledPollConsumerJob.java:61)
>   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
>   at 
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.processor.SendProcessor -  direct://deadletter 
> Exchange[ID-Klauss-MacBook-Pro-2-local-52649-1478165172245-0-3]
> [DefaultQuartzScheduler-camel-1_Worker-1] INFO 
> 

[jira] [Commented] (CAMEL-10440) ftp component: Errors during file download bypass redelivery and goes directly to the deadletterchannel

2016-12-01 Thread Claus Paludan (JIRA)

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

Claus Paludan commented on CAMEL-10440:
---

Any updates on this?

> ftp component: Errors during file download bypass redelivery and goes 
> directly to the deadletterchannel 
> 
>
> Key: CAMEL-10440
> URL: https://issues.apache.org/jira/browse/CAMEL-10440
> Project: Camel
>  Issue Type: Bug
>  Components: camel-ftp
>Affects Versions: 2.17.3, 2.18.0
> Environment: Behavior verified on MS Windows 7 (Spring Boot based 
> application) and MacOS (set based on "camel-example-ftp"). 
>Reporter: Klaus Johansen
>Priority: Minor
> Attachments: ConsumerPollStrategy.java, MyFtpServer.java, 
> MyFtpServerRouteBuilder.java
>
>
> When the FTP consumer is hit by an error during download of a file (eg. 
> socket timeout or because of missing read permission on the file) a 
> GenericFileOperationFailedException is thrown. Unfortunately is impossible to 
> recover from this error using redelivery because the message is forced onto 
> the deadletterchannel (marked exhausted?)
> When using consumer.bridgeErrorHandler=true redelivery works fine when the 
> errors happens during the polling phase (eg. connection timeouts and missing 
> directories).  
> When the error goes directly to the deadletterchannel the rollback method of 
> the PollingConsumerPollStrategy is never called. This makes it difficult to 
> access the consumer and force a disconnect in order to recover from the error 
> situtation (like it is done by RemoteFilePollingConsumerPollStrategy). 
> [DefaultQuartzScheduler-camel-1_Worker-1] INFO 
> org.apache.camel.example.ftp.ConsumerPollStrategy - Poll starting for 
> endpoint: 
> ftp://localhost:21/testdir?autoCreate=false=true...
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Exception checking 
> connection status: File operation failed: null Connection is not open. Code: 0
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Not connected/logged in, 
> connecting to: ftp://testuser@localhost:21
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Connected and logged in 
> to: ftp://testuser@localhost:21
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Took 0.151 seconds to 
> poll: testdir
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.component.file.remote.FtpConsumer - Total 1 files to consume
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.processor.DeadLetterChannel - Failed delivery for 
> (MessageId: ID-Klauss-MacBook-Pro-2-local-52649-1478165172245-0-2 on 
> ExchangeId: ID-Klauss-MacBook-Pro-2-local-52649-1478165172245-0-3). On 
> delivery attempt: 0 caught: 
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot 
> retrieve file: RemoteFile[testfile.txt] from: 
> ftp://localhost:21/testdir?autoCreate=false=true=testfile.txt=xx=%23try3times=%23myProcessStrategy=quartz2=15+0%2F1+*+%3F+*+*=true=5000=testuser
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot 
> retrieve file: RemoteFile[testfile.txt] from: 
> ftp://localhost:21/testdir?autoCreate=false=true=testfile.txt=xx=%23try3times=%23myProcessStrategy=quartz2=15+0%2F1+*+%3F+*+*=true=5000=testuser
>   at 
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:436)
>   at 
> org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:137)
>   at 
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
>   at 
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
>   at 
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
>   at 
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
>   at 
> org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerJob.execute(QuartzScheduledPollConsumerJob.java:61)
>   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
>   at 
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> [DefaultQuartzScheduler-camel-1_Worker-1] DEBUG 
> org.apache.camel.processor.SendProcessor -  direct://deadletter 
> Exchange[ID-Klauss-MacBook-Pro-2-local-52649-1478165172245-0-3]
> [DefaultQuartzScheduler-camel-1_Worker-1] INFO 
> org.apache.camel.processor.interceptor.Tracer - 
> ID-Klauss-MacBook-Pro-2-local-52649-1478165172245-0-3 

[jira] [Commented] (CAMEL-10548) Converter from List to String is not found when @EnableAutoConfiguration is used

2016-12-01 Thread Claus Ibsen (JIRA)

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

Claus Ibsen commented on CAMEL-10548:
-

Isnt the problem that Spring says true that it can convert from List -> String.
https://github.com/apache/camel/blob/master/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringTypeConverter.java#L51




> Converter from List to String is not found when @EnableAutoConfiguration is 
> used
> 
>
> Key: CAMEL-10548
> URL: https://issues.apache.org/jira/browse/CAMEL-10548
> Project: Camel
>  Issue Type: Bug
>  Components: camel-spring-boot
>Reporter: Luca Burgazzoli
>Assignee: Luca Burgazzoli
> Fix For: 2.19.0
>
>
> This very simple spring-boot application :
> {code:java}
> @SpringBootApplication
> public class Application {
> public static void main(String[] args) {
> SpringApplication.run(Application.class, args);
> }
> @Component
> public class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("timer:person")
> .setBody().constant(Arrays.asList(
> new Person("Peter", 25),
> new Person("John", 33)
> ))
> .log("Body is ${body}");
> }
> }
> public static class Person {
> private String name;
> private int age;
> public Person(String name, int age) {
> this.name = name;
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> @Override
> public String toString() {
> return "Person{" +
> "name='" + name + '\'' +
> ", age=" + age +
> '}';
> }
> }
> }
> {code}
> Fails to resolve the simple expression ${body} because of the following 
> exception:
> {code}
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.String with value 
> [Person{name='Peter', age=25}, Person{name='John', age=33}] due Failed to 
> convert from type [java.util.Arrays$ArrayList] to type [java.lang.String] 
> for value '[Person{name='Peter', age=25}, Person{name='John', age=33}]'; 
> nested exception is 
> org.springframework.core.convert.ConverterNotFoundException: No converter 
> found capable of converting from type [java.util.Arrays$ArrayList] to type 
> [java.lang.String]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:41)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.builder.ExpressionBuilder$75.evaluate(ExpressionBuilder.java:1795)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.LogProcessor.process(LogProcessor.java:53) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>  ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) 
> ~[camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:192)
>  [camel-core-2.18.0.jar:2.18.0]
>   at 
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76) 
> [camel-core-2.18.0.jar:2.18.0]
>   at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_112]
>   at 

[jira] [Commented] (CAMEL-10452) camel-salesforce: Add an option to simulate SELECT * from

2016-12-01 Thread Zoran Regvart (JIRA)

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

Zoran Regvart commented on CAMEL-10452:
---

Yes, the metadata would allow the implementation of the REST call to perform 
SELECT *, as it would be aware of all the fields SObject has.

> camel-salesforce: Add an option to simulate SELECT * from
> -
>
> Key: CAMEL-10452
> URL: https://issues.apache.org/jira/browse/CAMEL-10452
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-salesforce
>Reporter: Luca Burgazzoli
>Assignee: Zoran Regvart
>Priority: Minor
> Fix For: 2.19.0
>
>
> As today it is not possible to run a query like SELECT * from but one is 
> forced to list all the field he want.
> It would be nice to auto generate a statement using SObject meta data so one 
> can write:
> from("salesforce:stream?SObjectName=Case=true")
> to get all the fields the SObjectName supports.
> [~dhirajsb] what do you think ?



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