Camel Http Component

2016-04-15 Thread VinothKR
Hi Team,

I need to pass a Java model object to rest webservice using camel http
component. Please provide me some pointers on how to achieve it. 

something in the route like,


and since no other way is available to add dynamic url parameters we need to
pass it through set headers like,

urlParams=${body}


where ${body} is a unmarshalled object of pojo class.

when sending this through url it is automatically encoded and service is not
accepting the input.

My service will be like,
@RequestMapping(value="/service",consumes="application/json", method =
{RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String service(@RequestParam("urlParams") MYVO 
myVO)

Please provide a solution on how to achieve it.

Thanks,
Vinoth.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Http-Component-tp5781196.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Unicode characters not recognizing when reading file

2016-04-15 Thread patelp7
I figured the problem is converting from one charset to another. I realized
that the file I am reading is in charset "US-ASCII" and then I am trying to
convert it into "UTF-8" at which point the unicode character is lost. Any
suggestions on how to fix it?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Unicode-characters-not-recognizing-when-reading-file-tp5781028p5781188.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel-spring-boot + @UseAdviceWith

2016-04-15 Thread David Bennison
Cheers Claus

From: Jeff Segal 
Sent: 15 April 2016 15:40
To: users@camel.apache.org
Subject: Re: camel-spring-boot + @UseAdviceWith

Very exciting! I'll probably still have to employ a work-around for now but
look forward to using this once 2.17.1 is released. Thanks!

Jeff

On Fri, Apr 15, 2016 at 8:54 AM, Claus Ibsen  wrote:

> Hi
>
> I got time to work on this today and got this working
> https://issues.apache.org/jira/browse/CAMEL-9332
>
> There is a few tests here showing how it now works
>
> https://github.com/apache/camel/tree/master/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints
>
> You basically use the @RunWith(CamelSpringBootJUnit4ClassRunner.class)
>
>
>
> On Fri, Apr 15, 2016 at 2:48 PM, Jeff Segal 
> wrote:
> > I may be in the same boat. May I ask - did you rip out Spring Boot
> entirely
> > or just use vanilla camel-spring + Spring Boot? I'm hoping just the
> latter.
> >
> > On Fri, Apr 15, 2016 at 2:29 AM, David Bennison <
> david.benni...@metapack.com
> >> wrote:
> >
> >> Fortunately I am not too far into my project so I've branched and ripped
> >> out Camel Spring Boot (which is a shame). I lost a few days with this
> issue
> >> and it makes me wonder what other problems may be lurking. They really
> >> should have done what Chris Love suggested on CAMEL-7963 and
> highlighted in
> >> the Docs the annotations that don't work, preferably with any known
> >> workarounds.
> >>
> >> BTW once I ripped out Camel Spring Boot the @UseAdviceWith worked.
> >> 
> >> From: Jeff Segal 
> >> Sent: 14 April 2016 18:18
> >> To: users@camel.apache.org
> >> Subject: Re: camel-spring-boot + @UseAdviceWith
> >>
> >> Exactly - I had the same suspicion with regard to Camel-7963 but was
> hoping
> >> to be proven wrong here. I have not gotten any further unfortunately.
> I'm
> >> planning on trying a few work-arounds but it's unclear what the typical
> >> setup ought to be. I would think that others would be in the same boat
> if
> >> they want to apply integration tests to their routes while using
> >> camel-spring-boot.
> >>
> >> Jeff
> >>
> >> On Thu, Apr 14, 2016 at 5:16 AM, David Bennison <
> >> david.benni...@metapack.com
> >> > wrote:
> >>
> >> > Our problem looks similar to this one with @MockEndpoints raised back
> in
> >> > 2015 against Camel 2.16.0.
> >> >
> >> > http://grokbase.com/t/camel/users/15bgwdeftt/spring-boot-test-mocks
> >> >
> >> > The reason given by Joakim Bjørnstad appears to explain what we are
> >> > experiencing.
> >> >
> >> > The last comment on https://issues.apache.org/jira/browse/CAMEL-7963
> >> is:-
> >> >
> >> > "I still need to add support for Spring test annotations like
> >> > @MockEndpoints"
> >> >
> >> > So perhaps they never got done. I had problems with @MockEndpoints as
> >> > well. I am also experiencing strangeness with NotifyBuilder but that
> >> could
> >> > be unrelated.
> >> > 
> >> > From: Jeff Segal 
> >> > Sent: 12 April 2016 16:46
> >> > To: users@camel.apache.org
> >> > Subject: camel-spring-boot + @UseAdviceWith
> >> >
> >> > All,
> >> >
> >> > I'm currently creating a camel-spring-boot project and would like to
> add
> >> > some tests using @UseAdviceWith but am hitting a few issues. I
> couldn't
> >> > find an example that fit that use case exactly, so I've played around
> >> with
> >> > different things to no avail.
> >> >
> >> > Specifically, I found that when I use @ContextConfiguration to
> specify my
> >> > main Spring app config, my use of
> >> > @BootstrapWith(CamelTestContextBootstrapper.class) is honored (i.e. I
> can
> >> > step through it in a debugger during startup) and I can see
> >> @UseAdviceWith
> >> > being used in
> CamelSpringTestContextLoader.handleCamelContextStartup().
> >> > However, when I @Autowire my CamelContext into my test class, Spring
> >> > startup fails because it can't find my CamelContext Spring bean (even
> >> when
> >> > I explicitly include a @Configuration that extends CamelConfiguration,
> >> > which explicitly creates a CamelContext @Bean). I need a reference to
> my
> >> > CamelContext so that I can start it once I'm done setting up my
> routeWith
> >> > advice.
> >> >
> >> > One last thing: when I use @SpringApplicationConfiguration instead of
> >> > @ContextConfiguration, Spring is able to find the CamelContext bean
> but
> >> it
> >> > ignores my @BootstrapWith(CamelTestContextBootstrapper.class) &
> >> > @UseAdviceWith and thus just starts up the CamelContext automatically
> >> > rather than waiting for me to start it manually (after my routeWith
> >> > advice).
> >> >
> >> > Any pointers on what I might be doing wrong would be great. In
> summary:
> >> >
> >> > Honoring @UseAdviceWith but no CamelContext Spring bean:
> >> >
> >> 

Re: Best Strategy to process a large number of rows in File

2016-04-15 Thread Brad Johnson
I suspect the biggest problem you may be having here is that the file isn't
truly streaming but getting slurped into memory as a whole.  I don't know
that for certain but that test of two queues should show you that.

That might be throwaway code or it might be the basis for a next
implementation.  But it will at least let you see what you're dealing
with.  I wouldn't go too far past just reading/streaming the file in and
passing it on to the next queue so you can verify that you are getting
individual data records.

On Fri, Apr 15, 2016 at 9:58 AM, Michele 
wrote:

> How big is that object on the queue?
> As optimization, I changed generic LinkedHashMap in a bean SerialNumber
> that
> has this properties
>
> public class SerialNumber implements Serializable {
>
> private static final long serialVersionUID = -9067015746823050409L;
>
> private Date arg1;
> private Date arg2;
> private String arg3;
> private String arg4;
>
> // getter setter
> }
>
> Is it only a single line of data? Yes
>
> I try with seda:processAndStoreInQueue?concurrentConsumers=30 but the
> result
> is the same.
> I attached scrennshots with memory usage and live threads.
> memory-usage.png
> 
> live-threads.png
> 
>
> I will try decompose the problem into a  number of separate seda:queues to
> verify performance and memory usage and let you know.
>
> Thanks a lot again for your support.
>
> Best Regards
>
> Michele
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Best-Strategy-to-process-a-large-number-of-rows-in-File-tp5779856p5781179.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Best Strategy to process a large number of rows in File

2016-04-15 Thread Michele
How big is that object on the queue?  
As optimization, I changed generic LinkedHashMap in a bean SerialNumber that
has this properties

public class SerialNumber implements Serializable {

private static final long serialVersionUID = -9067015746823050409L;

private Date arg1;
private Date arg2;
private String arg3;
private String arg4;

// getter setter
}

Is it only a single line of data? Yes

I try with seda:processAndStoreInQueue?concurrentConsumers=30 but the result
is the same.
I attached scrennshots with memory usage and live threads.
memory-usage.png
  
live-threads.png
  

I will try decompose the problem into a  number of separate seda:queues to
verify performance and memory usage and let you know.

Thanks a lot again for your support.

Best Regards

Michele







--
View this message in context: 
http://camel.465427.n5.nabble.com/Best-Strategy-to-process-a-large-number-of-rows-in-File-tp5779856p5781179.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-spring-boot + @UseAdviceWith

2016-04-15 Thread Jeff Segal
Very exciting! I'll probably still have to employ a work-around for now but
look forward to using this once 2.17.1 is released. Thanks!

Jeff

On Fri, Apr 15, 2016 at 8:54 AM, Claus Ibsen  wrote:

> Hi
>
> I got time to work on this today and got this working
> https://issues.apache.org/jira/browse/CAMEL-9332
>
> There is a few tests here showing how it now works
>
> https://github.com/apache/camel/tree/master/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints
>
> You basically use the @RunWith(CamelSpringBootJUnit4ClassRunner.class)
>
>
>
> On Fri, Apr 15, 2016 at 2:48 PM, Jeff Segal 
> wrote:
> > I may be in the same boat. May I ask - did you rip out Spring Boot
> entirely
> > or just use vanilla camel-spring + Spring Boot? I'm hoping just the
> latter.
> >
> > On Fri, Apr 15, 2016 at 2:29 AM, David Bennison <
> david.benni...@metapack.com
> >> wrote:
> >
> >> Fortunately I am not too far into my project so I've branched and ripped
> >> out Camel Spring Boot (which is a shame). I lost a few days with this
> issue
> >> and it makes me wonder what other problems may be lurking. They really
> >> should have done what Chris Love suggested on CAMEL-7963 and
> highlighted in
> >> the Docs the annotations that don't work, preferably with any known
> >> workarounds.
> >>
> >> BTW once I ripped out Camel Spring Boot the @UseAdviceWith worked.
> >> 
> >> From: Jeff Segal 
> >> Sent: 14 April 2016 18:18
> >> To: users@camel.apache.org
> >> Subject: Re: camel-spring-boot + @UseAdviceWith
> >>
> >> Exactly - I had the same suspicion with regard to Camel-7963 but was
> hoping
> >> to be proven wrong here. I have not gotten any further unfortunately.
> I'm
> >> planning on trying a few work-arounds but it's unclear what the typical
> >> setup ought to be. I would think that others would be in the same boat
> if
> >> they want to apply integration tests to their routes while using
> >> camel-spring-boot.
> >>
> >> Jeff
> >>
> >> On Thu, Apr 14, 2016 at 5:16 AM, David Bennison <
> >> david.benni...@metapack.com
> >> > wrote:
> >>
> >> > Our problem looks similar to this one with @MockEndpoints raised back
> in
> >> > 2015 against Camel 2.16.0.
> >> >
> >> > http://grokbase.com/t/camel/users/15bgwdeftt/spring-boot-test-mocks
> >> >
> >> > The reason given by Joakim Bjørnstad appears to explain what we are
> >> > experiencing.
> >> >
> >> > The last comment on https://issues.apache.org/jira/browse/CAMEL-7963
> >> is:-
> >> >
> >> > "I still need to add support for Spring test annotations like
> >> > @MockEndpoints"
> >> >
> >> > So perhaps they never got done. I had problems with @MockEndpoints as
> >> > well. I am also experiencing strangeness with NotifyBuilder but that
> >> could
> >> > be unrelated.
> >> > 
> >> > From: Jeff Segal 
> >> > Sent: 12 April 2016 16:46
> >> > To: users@camel.apache.org
> >> > Subject: camel-spring-boot + @UseAdviceWith
> >> >
> >> > All,
> >> >
> >> > I'm currently creating a camel-spring-boot project and would like to
> add
> >> > some tests using @UseAdviceWith but am hitting a few issues. I
> couldn't
> >> > find an example that fit that use case exactly, so I've played around
> >> with
> >> > different things to no avail.
> >> >
> >> > Specifically, I found that when I use @ContextConfiguration to
> specify my
> >> > main Spring app config, my use of
> >> > @BootstrapWith(CamelTestContextBootstrapper.class) is honored (i.e. I
> can
> >> > step through it in a debugger during startup) and I can see
> >> @UseAdviceWith
> >> > being used in
> CamelSpringTestContextLoader.handleCamelContextStartup().
> >> > However, when I @Autowire my CamelContext into my test class, Spring
> >> > startup fails because it can't find my CamelContext Spring bean (even
> >> when
> >> > I explicitly include a @Configuration that extends CamelConfiguration,
> >> > which explicitly creates a CamelContext @Bean). I need a reference to
> my
> >> > CamelContext so that I can start it once I'm done setting up my
> routeWith
> >> > advice.
> >> >
> >> > One last thing: when I use @SpringApplicationConfiguration instead of
> >> > @ContextConfiguration, Spring is able to find the CamelContext bean
> but
> >> it
> >> > ignores my @BootstrapWith(CamelTestContextBootstrapper.class) &
> >> > @UseAdviceWith and thus just starts up the CamelContext automatically
> >> > rather than waiting for me to start it manually (after my routeWith
> >> > advice).
> >> >
> >> > Any pointers on what I might be doing wrong would be great. In
> summary:
> >> >
> >> > Honoring @UseAdviceWith but no CamelContext Spring bean:
> >> >
> >> > @ContextConfiguration(classes = {ApplicationConfig.class})
> >> > @RunWith(CamelSpringJUnit4ClassRunner.class)
> >> > @BootstrapWith(CamelTestContextBootstrapper.class)
> >> > @UseAdviceWith
> >> > 

Re: Best Strategy to process a large number of rows in File

2016-04-15 Thread Brad Johnson
The easiest way to think about SEDA queues is to recognize why they were
created and I think that will help you decompose such problems. Staged
Event Driven Architecture.  Initially they were invented for auto
management of threads on queues where one stage that is getting too few
threads could steal some from another that has too many and the whole
system would degrade gracefully under high load.  But in our current
context you might think of it as an easy way to decouple processing stages
and assign threading.

Just decompose the problem into a  number of separate seda:queues and chain
the calls together with a log statement in each so you can make sure you
aren't accidentally reading an entire file in and inadvertently picking up
a huge lump of data.


 
 

 



 
 
 //etc.


Make sure you are only seeing the rows come through.  Obviously I left out
a lot of the data streaming/unmarshalling logic there.  But a quick simple
route like that with the appropriate "streaming" and splitting as necessary
should result in that second stage getting on single lines or single
records (if they are multi-line).

On Fri, Apr 15, 2016 at 9:01 AM, Brad Johnson 
wrote:

> 6 hours?  I'm currently streaming a 50k line file through Beanio with seda
> queues in and doing similar processing in under a minute.
>
> You have a queue here tht appears to have something on  it that isbeing
> unmarashalled and then split.  How big is that object on the queue?  Is it
> only a single line of data? Try this.
>
> 
>  uri="seda:processAndStoreInQueue?concurrentConsumers=30" />
>
>
>
> On Fri, Apr 15, 2016 at 8:25 AM, Jens Breitenstein 
> wrote:
>
>> Hi Michele
>>
>> Reading a CSV with 40k lines using camel in streaming takes a view
>> seconds. As you limit the queue-size to avoid OOM the entire performance
>> depends how fast you can empty the queue.
>> How long does processing of ONE message take in average? To me it looks
>> like approximately 1.6 secs (35000/6/60/60). The processes responsible for
>> reading the queue is single-threaded??
>>
>> Jens
>>
>>
>> Am 15/04/16 um 14:59 schrieb Michele:
>>
>> Hi,
>>>
>>> I spent a bit of time reading different topics on this issue, and I
>>> changed
>>> my route like this reducing the memory usage of about 300Mb:
>>>
>>> 
>>> >>
>>> uri="{{uri.inbound}}?scheduler=quartz2scheduler.cron={{poll.consumer.scheduler}}scheduler.triggerId=FileRetrieverscheduler.triggerGroup=IF_CBIKIT{{uri.inbound.options}}"
>>> />
>>> >>
>>> headerName="ImportDateTime">${date:now:MMdd-HHmmss}
>>> >>
>>> headerName="MsgCorrelationId">CBIKIT_INBOUND_${in.header.ImportDateTime}
>>> 
>>>
>>>
>>> Import-${in.header.CamelFileName}-${in.header.ImportDateTime}-${in.header.breadcrumbId}
>>> 
>>> 
>>> 
>>> 
>>>
>>> 
>>> 
>>> 
>>> >> classType="com.fincons.ingenico.crt2.cbikit.inbound.model.RowData"/>
>>> 
>>>
>>> >> executorServiceRef="myThreadPoolExecutor" >
>>> ${body}
>>> 
>>> 
>>> 
>>> >>
>>> headerName="CamelSplitIndex">${in.header.CamelSplitIndex}
>>> >> ref="BodyEnricherProcessor" />
>>> >>
>>> uri="dozer:transform?mappingFile=file:{{crt2.apps.home}}{{dozer.mapping.path}}targetModel=com.fincons.ingenico.crt2.cbikit.inbound.model.SerialNumber"
>>> />
>>> 
>>> >> uri="activemq:queue:CBIKIT"  />
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> The last test processed 35000 lines of CSV file in about 6h with an
>>> average
>>> memory usage 1400Mb successful. But, Can I improve further processing
>>> performance?
>>>
>>> In addition, I noticed that Queue Size of Queue is low. Why? (Producer is
>>> slower than Consumer?)
>>>
>>> Thanks in advance.
>>>
>>> Best Regards
>>>
>>> Michele
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Best-Strategy-to-process-a-large-number-of-rows-in-File-tp5779856p5781168.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>


Re: how to hold temporary data to use later.....

2016-04-15 Thread Quinn Stevenson
This sounds like a good application of an aggregator ( 
http://camel.apache.org/aggregator2.html 
 )

Keep the first lines in the aggregation repository, and then have it complete 
one the file is uploaded.  On completion, you can update the DB.
> On Apr 15, 2016, at 12:50 AM, sungkwon.eom  wrote:
> 
> Hello, this is the scenario what I want to handle..
> 
> 
> 1) load files from a directory
> 2)collect first line from each files  (Using this data DB will be
> updated later)
> 3)compress files to a single tar.gz file.
> 4)upload the compressed file to FTP site.
> 5)update DB table over the compressed and FTP uploded files using temporary
> data from (2).
> 
> 
> In here, how can I hold the first line of each files and how to pass the
> line data to DB route?
> Of course if compress & FTP uploading is fail,  DB update should not occur.
> 
> Thanks, in advance.
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/how-to-hold-temporary-data-to-use-later-tp5781121.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Best Strategy to process a large number of rows in File

2016-04-15 Thread Jens Breitenstein

Hi Michele

Reading a CSV with 40k lines using camel in streaming takes a view 
seconds. As you limit the queue-size to avoid OOM the entire performance 
depends how fast you can empty the queue.
How long does processing of ONE message take in average? To me it looks 
like approximately 1.6 secs (35000/6/60/60). The processes responsible 
for reading the queue is single-threaded??


Jens


Am 15/04/16 um 14:59 schrieb Michele:

Hi,

I spent a bit of time reading different topics on this issue, and I changed
my route like this reducing the memory usage of about 300Mb:



${date:now:MMdd-HHmmss}
CBIKIT_INBOUND_${in.header.ImportDateTime}


Import-${in.header.CamelFileName}-${in.header.ImportDateTime}-${in.header.breadcrumbId}












${body}



${in.header.CamelSplitIndex}



 








The last test processed 35000 lines of CSV file in about 6h with an average
memory usage 1400Mb successful. But, Can I improve further processing
performance?

In addition, I noticed that Queue Size of Queue is low. Why? (Producer is
slower than Consumer?)

Thanks in advance.

Best Regards

Michele



--
View this message in context: 
http://camel.465427.n5.nabble.com/Best-Strategy-to-process-a-large-number-of-rows-in-File-tp5779856p5781168.html
Sent from the Camel - Users mailing list archive at Nabble.com.




HTTP4 Endpoint - Read time out behavior is strange

2016-04-15 Thread Binu Surendran
We are using Camel HTTP4 endpoint for calling to external webservice. The
connection time out and read time are provided thru the endpoint options,
like below.

/http4://api.webservice.com?httpClient.soTimeout=200;httpClient.connectionTimeout=200/


The camel route from which this endpoint calls contain following 3 tasks;

i) set a camel header using  
// used for logging purpose
ii) calling above http4 endpoint 
iii) Remove the above header using 

We are using Camel's *EventNotifierSupport *for logging purpose, especially
to log the response time of external webservice calls. The application only
consider *ExchangeSentEvent *types and all other events will be discarded.
In addition the events will be filtered further based on the Message header
- to get notification only for external http4 calls. The application using
*/exchangeSentEvent.getTimeTaken()/* api and its value considered as the
response time of respective call. 

Even though the read time out is configured as 200 ms the external calls
with time more than 200 ms are not always failing or not throwing
SocketTimeOutException. The external calls are not throwing any
SocketTimeOutException when exchangeSentEvent.getTimeTaken() value is
204/208/211 etc..., but there are cases the SocketTimeOutException happens
when exchangeSentEvent.getTimeTaken() value is 200+ ms. To sum up, whenever
any SocketTimeOutException occurs the value of
exchangeSentEvent.getTimeTaken() is above 200 ms, but the value of
exchangeSentEvent.getTimeTaken() is above 200 ms its not mandatory to happen
SocketTimeOutException!

Could anyone guide how can we calculate the accurate read time of a http4
call? To handle the timeout properly.
Whether the exchangeSentEvent.getTimeTaken() include any buffer time like
pre & post processing of camel exchange ?
Is there anyway to know the accurate time taken for connection & read when
using a httpendpoint?

Apache Camel version - 2.12.1
camel-http4 version - 2.12.1

Please advise.





--
View this message in context: 
http://camel.465427.n5.nabble.com/HTTP4-Endpoint-Read-time-out-behavior-is-strange-tp5781169.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Best Strategy to process a large number of rows in File

2016-04-15 Thread Michele
Hi, 

I spent a bit of time reading different topics on this issue, and I changed
my route like this reducing the memory usage of about 300Mb:



${date:now:MMdd-HHmmss}
CBIKIT_INBOUND_${in.header.ImportDateTime}

  
Import-${in.header.CamelFileName}-${in.header.ImportDateTime}-${in.header.breadcrumbId}












${body}



${in.header.CamelSplitIndex}



 








The last test processed 35000 lines of CSV file in about 6h with an average
memory usage 1400Mb successful. But, Can I improve further processing
performance?

In addition, I noticed that Queue Size of Queue is low. Why? (Producer is
slower than Consumer?) 

Thanks in advance.

Best Regards

Michele



--
View this message in context: 
http://camel.465427.n5.nabble.com/Best-Strategy-to-process-a-large-number-of-rows-in-File-tp5779856p5781168.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-spring-boot + @UseAdviceWith

2016-04-15 Thread Claus Ibsen
Hi

I got time to work on this today and got this working
https://issues.apache.org/jira/browse/CAMEL-9332

There is a few tests here showing how it now works
https://github.com/apache/camel/tree/master/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints

You basically use the @RunWith(CamelSpringBootJUnit4ClassRunner.class)



On Fri, Apr 15, 2016 at 2:48 PM, Jeff Segal  wrote:
> I may be in the same boat. May I ask - did you rip out Spring Boot entirely
> or just use vanilla camel-spring + Spring Boot? I'm hoping just the latter.
>
> On Fri, Apr 15, 2016 at 2:29 AM, David Bennison > wrote:
>
>> Fortunately I am not too far into my project so I've branched and ripped
>> out Camel Spring Boot (which is a shame). I lost a few days with this issue
>> and it makes me wonder what other problems may be lurking. They really
>> should have done what Chris Love suggested on CAMEL-7963 and highlighted in
>> the Docs the annotations that don't work, preferably with any known
>> workarounds.
>>
>> BTW once I ripped out Camel Spring Boot the @UseAdviceWith worked.
>> 
>> From: Jeff Segal 
>> Sent: 14 April 2016 18:18
>> To: users@camel.apache.org
>> Subject: Re: camel-spring-boot + @UseAdviceWith
>>
>> Exactly - I had the same suspicion with regard to Camel-7963 but was hoping
>> to be proven wrong here. I have not gotten any further unfortunately. I'm
>> planning on trying a few work-arounds but it's unclear what the typical
>> setup ought to be. I would think that others would be in the same boat if
>> they want to apply integration tests to their routes while using
>> camel-spring-boot.
>>
>> Jeff
>>
>> On Thu, Apr 14, 2016 at 5:16 AM, David Bennison <
>> david.benni...@metapack.com
>> > wrote:
>>
>> > Our problem looks similar to this one with @MockEndpoints raised back in
>> > 2015 against Camel 2.16.0.
>> >
>> > http://grokbase.com/t/camel/users/15bgwdeftt/spring-boot-test-mocks
>> >
>> > The reason given by Joakim Bjørnstad appears to explain what we are
>> > experiencing.
>> >
>> > The last comment on https://issues.apache.org/jira/browse/CAMEL-7963
>> is:-
>> >
>> > "I still need to add support for Spring test annotations like
>> > @MockEndpoints"
>> >
>> > So perhaps they never got done. I had problems with @MockEndpoints as
>> > well. I am also experiencing strangeness with NotifyBuilder but that
>> could
>> > be unrelated.
>> > 
>> > From: Jeff Segal 
>> > Sent: 12 April 2016 16:46
>> > To: users@camel.apache.org
>> > Subject: camel-spring-boot + @UseAdviceWith
>> >
>> > All,
>> >
>> > I'm currently creating a camel-spring-boot project and would like to add
>> > some tests using @UseAdviceWith but am hitting a few issues. I couldn't
>> > find an example that fit that use case exactly, so I've played around
>> with
>> > different things to no avail.
>> >
>> > Specifically, I found that when I use @ContextConfiguration to specify my
>> > main Spring app config, my use of
>> > @BootstrapWith(CamelTestContextBootstrapper.class) is honored (i.e. I can
>> > step through it in a debugger during startup) and I can see
>> @UseAdviceWith
>> > being used in CamelSpringTestContextLoader.handleCamelContextStartup().
>> > However, when I @Autowire my CamelContext into my test class, Spring
>> > startup fails because it can't find my CamelContext Spring bean (even
>> when
>> > I explicitly include a @Configuration that extends CamelConfiguration,
>> > which explicitly creates a CamelContext @Bean). I need a reference to my
>> > CamelContext so that I can start it once I'm done setting up my routeWith
>> > advice.
>> >
>> > One last thing: when I use @SpringApplicationConfiguration instead of
>> > @ContextConfiguration, Spring is able to find the CamelContext bean but
>> it
>> > ignores my @BootstrapWith(CamelTestContextBootstrapper.class) &
>> > @UseAdviceWith and thus just starts up the CamelContext automatically
>> > rather than waiting for me to start it manually (after my routeWith
>> > advice).
>> >
>> > Any pointers on what I might be doing wrong would be great. In summary:
>> >
>> > Honoring @UseAdviceWith but no CamelContext Spring bean:
>> >
>> > @ContextConfiguration(classes = {ApplicationConfig.class})
>> > @RunWith(CamelSpringJUnit4ClassRunner.class)
>> > @BootstrapWith(CamelTestContextBootstrapper.class)
>> > @UseAdviceWith
>> > @Slf4j
>> > public class MyTest {
>> >
>> > @Autowired
>> > CamelContext camelContext;
>> >
>> > @Test
>> > public void test() throws InterruptedException {
>> > log.info("Starting test...");
>> > Thread.sleep(1000 * 60);
>> > }
>> >
>> > }
>> >
>> > Have a CamelContext Spring bean but NOT honoring @UseAdviceWith:
>> >
>> > @SpringApplicationConfiguration(classes = {ApplicationConfig.class})
>> > 

Re: camel-spring-boot + @UseAdviceWith

2016-04-15 Thread Jeff Segal
I may be in the same boat. May I ask - did you rip out Spring Boot entirely
or just use vanilla camel-spring + Spring Boot? I'm hoping just the latter.

On Fri, Apr 15, 2016 at 2:29 AM, David Bennison  wrote:

> Fortunately I am not too far into my project so I've branched and ripped
> out Camel Spring Boot (which is a shame). I lost a few days with this issue
> and it makes me wonder what other problems may be lurking. They really
> should have done what Chris Love suggested on CAMEL-7963 and highlighted in
> the Docs the annotations that don't work, preferably with any known
> workarounds.
>
> BTW once I ripped out Camel Spring Boot the @UseAdviceWith worked.
> 
> From: Jeff Segal 
> Sent: 14 April 2016 18:18
> To: users@camel.apache.org
> Subject: Re: camel-spring-boot + @UseAdviceWith
>
> Exactly - I had the same suspicion with regard to Camel-7963 but was hoping
> to be proven wrong here. I have not gotten any further unfortunately. I'm
> planning on trying a few work-arounds but it's unclear what the typical
> setup ought to be. I would think that others would be in the same boat if
> they want to apply integration tests to their routes while using
> camel-spring-boot.
>
> Jeff
>
> On Thu, Apr 14, 2016 at 5:16 AM, David Bennison <
> david.benni...@metapack.com
> > wrote:
>
> > Our problem looks similar to this one with @MockEndpoints raised back in
> > 2015 against Camel 2.16.0.
> >
> > http://grokbase.com/t/camel/users/15bgwdeftt/spring-boot-test-mocks
> >
> > The reason given by Joakim Bjørnstad appears to explain what we are
> > experiencing.
> >
> > The last comment on https://issues.apache.org/jira/browse/CAMEL-7963
> is:-
> >
> > "I still need to add support for Spring test annotations like
> > @MockEndpoints"
> >
> > So perhaps they never got done. I had problems with @MockEndpoints as
> > well. I am also experiencing strangeness with NotifyBuilder but that
> could
> > be unrelated.
> > 
> > From: Jeff Segal 
> > Sent: 12 April 2016 16:46
> > To: users@camel.apache.org
> > Subject: camel-spring-boot + @UseAdviceWith
> >
> > All,
> >
> > I'm currently creating a camel-spring-boot project and would like to add
> > some tests using @UseAdviceWith but am hitting a few issues. I couldn't
> > find an example that fit that use case exactly, so I've played around
> with
> > different things to no avail.
> >
> > Specifically, I found that when I use @ContextConfiguration to specify my
> > main Spring app config, my use of
> > @BootstrapWith(CamelTestContextBootstrapper.class) is honored (i.e. I can
> > step through it in a debugger during startup) and I can see
> @UseAdviceWith
> > being used in CamelSpringTestContextLoader.handleCamelContextStartup().
> > However, when I @Autowire my CamelContext into my test class, Spring
> > startup fails because it can't find my CamelContext Spring bean (even
> when
> > I explicitly include a @Configuration that extends CamelConfiguration,
> > which explicitly creates a CamelContext @Bean). I need a reference to my
> > CamelContext so that I can start it once I'm done setting up my routeWith
> > advice.
> >
> > One last thing: when I use @SpringApplicationConfiguration instead of
> > @ContextConfiguration, Spring is able to find the CamelContext bean but
> it
> > ignores my @BootstrapWith(CamelTestContextBootstrapper.class) &
> > @UseAdviceWith and thus just starts up the CamelContext automatically
> > rather than waiting for me to start it manually (after my routeWith
> > advice).
> >
> > Any pointers on what I might be doing wrong would be great. In summary:
> >
> > Honoring @UseAdviceWith but no CamelContext Spring bean:
> >
> > @ContextConfiguration(classes = {ApplicationConfig.class})
> > @RunWith(CamelSpringJUnit4ClassRunner.class)
> > @BootstrapWith(CamelTestContextBootstrapper.class)
> > @UseAdviceWith
> > @Slf4j
> > public class MyTest {
> >
> > @Autowired
> > CamelContext camelContext;
> >
> > @Test
> > public void test() throws InterruptedException {
> > log.info("Starting test...");
> > Thread.sleep(1000 * 60);
> > }
> >
> > }
> >
> > Have a CamelContext Spring bean but NOT honoring @UseAdviceWith:
> >
> > @SpringApplicationConfiguration(classes = {ApplicationConfig.class})
> > @RunWith(CamelSpringJUnit4ClassRunner.class)
> > @BootstrapWith(CamelTestContextBootstrapper.class)
> > @UseAdviceWith
> > @Slf4j
> > public class MyTest {
> >
> > @Autowired
> > CamelContext camelContext;
> >
> > @Test
> > public void test() throws InterruptedException {
> > log.info("Starting test...");
> > Thread.sleep(1000 * 60);
> > }
> >
> > }
> >
> > Thanks!
> > Jeff
> > This email is confidential and may be privileged. If you are not the
> > intended recipient, please notify the sender immediately and delete the
> > email from your computer. 

RE: Store un-evaluated simple expression, and evaluate on use?

2016-04-15 Thread jimi.hullegard
On Friday, April 15, 2016 1:36 PM, claus.ib...@gmail.com wrote:
> >  
> > 
> > On Fri, Apr 15, 2016 at 1:29 PM,   
> > wrote:
> >
> > So, to summarize. I can get Camel to eval the Expression bean when using 
> > testExpression in a setHeader. But I can't get Camel to eval it 
> > as part of another simple expression, like the log example above. Shouldn't 
> > this be possible too?
>
> No that is not possible a simple ref just refers to a bean in the registry, 
> its not for evaluating an expression.

Sure, the ref just refers to a bean in the registry. But since it is possible 
to trigger an eval by the ref tag in the setHeader tag, it is only reasonable 
to believe that the same thing can be performed somehow using just an Simple 
Expression. And if all else fails, at least one should be able to perform a 
simple method call to the eval method, right? (I just don't know how.)

The reason I can't just use the header approach is that I would like to use the 
expression result as part of the uri in the  element, and I can't set any 
header before the , as far as I know.

/Jimi


Re: Store un-evaluated simple expression, and evaluate on use?

2016-04-15 Thread Claus Ibsen
On Fri, Apr 15, 2016 at 1:29 PM,   wrote:
> OK, thanks. Now the test with the header works. But I still can't get the 
> "inline" expression to work, in the  tag. How should I write there? I 
> have tried:
>
> 
> 
>
> But this just prints:
>
> Test 2: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
> Test 3: $ref{testExpression}
>
>
> So, to summarize. I can get Camel to eval the Expression bean when using 
> testExpression in a setHeader. But I can't get Camel to eval it as 
> part of another simple expression, like the log example above. Shouldn't this 
> be possible too?
>

No that is not possible a simple ref just refers to a bean in the
registry, its not for evaluating an expression.


> /Jimi
>
> -Original Message-
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Friday, April 15, 2016 1:18 PM
> To: users@camel.apache.org
> Subject: Re: Store un-evaluated simple expression, and evaluate on use?
>
> Ah yeah use  instead of 
>
> On Fri, Apr 15, 2016 at 11:31 AM,   
> wrote:
>> I can't get it to work.
>>
>> This is my config:
>>
>> > class="org.apache.camel.language.simple.SimpleLanguage" 
>> factory-method="simple">
>> > value="${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}" /> 
>>
>> 
>> 
>>   [...]
>>   
>>   ref:testExpression
>>   
>>   
>>   
>>   [...]
>> 
>> 
>>
>>
>> And this is the output:
>>
>> Test 1: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
>> Test 2: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
>>
>>
>> But I expected something like this as output:
>>
>> Test 1: myFile_2016-04-15_11.26.40
>> Test 2: myFile_2016-04-15_11.26.40
>>
>> So, it seems like it treats the expression as a String instead of evaluating 
>> it.
>>
>> /Jimi
>>
>>
>> -Original Message-
>> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
>> Sent: Friday, April 15, 2016 10:39 AM
>> To: users@camel.apache.org
>> Subject: Re: Store un-evaluated simple expression, and evaluate on use?
>>
>> In Java code you can store anything in the registry,
>>
>> and also in xml but using  style and call the static simple
>> method on the language
>>
>> 
>>   > method with your string as parameter> 
>>
>> And then you can refer to the expression using
>>
>> xxx
>>
>> Or if using simple
>>
>> ref:xxx
>>
>>
>> An alternative is to use property placeholders
>> http://camel.apache.org/using-propertyplaceholder.html
>>
>> On Fri, Apr 15, 2016 at 10:22 AM,   
>> wrote:
>>> Hi,
>>>
>>> Is it possible to define a simple expression in some global variable, 
>>> without evaluating it? And then reference it, and evaluate it, later? I'm 
>>> using Camel Spring XML.
>>>
>>> For example, something like this pseudo config:
>>>
>>> >> value="${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}"/>
>>>
>>> 
>>> 
>>>   [...]
>>>   >> headerName="myHeader">${testExpression}
>>>   [...]
>>> 
>>> 
>>>
>>> Can this be done with some built in standard functionality? The reason is 
>>> that I want to use the exact same expression in multiple places, and want 
>>> to avoid copy pasting it.
>>>
>>> I use Camel 2.17.0.
>>>
>>> Regards
>>> /Jimi
>>
>>
>>
>> --
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


RE: Store un-evaluated simple expression, and evaluate on use?

2016-04-15 Thread jimi.hullegard
OK, thanks. Now the test with the header works. But I still can't get the 
"inline" expression to work, in the  tag. How should I write there? I have 
tried:




But this just prints:

Test 2: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
Test 3: $ref{testExpression}


So, to summarize. I can get Camel to eval the Expression bean when using 
testExpression in a setHeader. But I can't get Camel to eval it as 
part of another simple expression, like the log example above. Shouldn't this 
be possible too?

/Jimi

-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Friday, April 15, 2016 1:18 PM
To: users@camel.apache.org
Subject: Re: Store un-evaluated simple expression, and evaluate on use?

Ah yeah use  instead of 

On Fri, Apr 15, 2016 at 11:31 AM,   wrote:
> I can't get it to work.
>
> This is my config:
>
>  class="org.apache.camel.language.simple.SimpleLanguage" 
> factory-method="simple">
>  value="${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}" /> 
>
> 
> 
>   [...]
>   
>   ref:testExpression
>   
>   
>   
>   [...]
> 
> 
>
>
> And this is the output:
>
> Test 1: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
> Test 2: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
>
>
> But I expected something like this as output:
>
> Test 1: myFile_2016-04-15_11.26.40
> Test 2: myFile_2016-04-15_11.26.40
>
> So, it seems like it treats the expression as a String instead of evaluating 
> it.
>
> /Jimi
>
>
> -Original Message-
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Friday, April 15, 2016 10:39 AM
> To: users@camel.apache.org
> Subject: Re: Store un-evaluated simple expression, and evaluate on use?
>
> In Java code you can store anything in the registry,
>
> and also in xml but using  style and call the static simple 
> method on the language
>
> 
>method with your string as parameter> 
>
> And then you can refer to the expression using
>
> xxx
>
> Or if using simple
>
> ref:xxx
>
>
> An alternative is to use property placeholders 
> http://camel.apache.org/using-propertyplaceholder.html
>
> On Fri, Apr 15, 2016 at 10:22 AM,   
> wrote:
>> Hi,
>>
>> Is it possible to define a simple expression in some global variable, 
>> without evaluating it? And then reference it, and evaluate it, later? I'm 
>> using Camel Spring XML.
>>
>> For example, something like this pseudo config:
>>
>> > value="${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}"/>
>>
>> 
>> 
>>   [...]
>>   > headerName="myHeader">${testExpression}
>>   [...]
>> 
>> 
>>
>> Can this be done with some built in standard functionality? The reason is 
>> that I want to use the exact same expression in multiple places, and want to 
>> avoid copy pasting it.
>>
>> I use Camel 2.17.0.
>>
>> Regards
>> /Jimi
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



--
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Store un-evaluated simple expression, and evaluate on use?

2016-04-15 Thread Claus Ibsen
Ah yeah use  instead of 

On Fri, Apr 15, 2016 at 11:31 AM,   wrote:
> I can't get it to work.
>
> This is my config:
>
>  class="org.apache.camel.language.simple.SimpleLanguage" 
> factory-method="simple">
>  value="${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}" />
> 
>
> 
> 
>   [...]
>   
>   ref:testExpression
>   
>   
>   
>   [...]
> 
> 
>
>
> And this is the output:
>
> Test 1: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
> Test 2: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
>
>
> But I expected something like this as output:
>
> Test 1: myFile_2016-04-15_11.26.40
> Test 2: myFile_2016-04-15_11.26.40
>
> So, it seems like it treats the expression as a String instead of evaluating 
> it.
>
> /Jimi
>
>
> -Original Message-
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Friday, April 15, 2016 10:39 AM
> To: users@camel.apache.org
> Subject: Re: Store un-evaluated simple expression, and evaluate on use?
>
> In Java code you can store anything in the registry,
>
> and also in xml but using  style and call the static simple method on 
> the language
>
> 
>with your string as parameter> 
>
> And then you can refer to the expression using
>
> xxx
>
> Or if using simple
>
> ref:xxx
>
>
> An alternative is to use property placeholders 
> http://camel.apache.org/using-propertyplaceholder.html
>
> On Fri, Apr 15, 2016 at 10:22 AM,   
> wrote:
>> Hi,
>>
>> Is it possible to define a simple expression in some global variable, 
>> without evaluating it? And then reference it, and evaluate it, later? I'm 
>> using Camel Spring XML.
>>
>> For example, something like this pseudo config:
>>
>> > value="${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}"/>
>>
>> 
>> 
>>   [...]
>>   > headerName="myHeader">${testExpression}
>>   [...]
>> 
>> 
>>
>> Can this be done with some built in standard functionality? The reason is 
>> that I want to use the exact same expression in multiple places, and want to 
>> avoid copy pasting it.
>>
>> I use Camel 2.17.0.
>>
>> Regards
>> /Jimi
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Multiple camel producers instantiated

2016-04-15 Thread Shiva
I am using Apache camel - 2.15.5 and Activemq - 5.10.2

Below is the code for my route

// Define heartbeat routes
for (final EndpointInfo endpointInfo : endpointInfos) {
final String uri = BOLD_ENDPOINT_PREFIX + endpointInfo.getUri();
from("timer:monitor" + uri + "?fixedRate=true=" +
(heartbeatInterval * 1000))
.routeId(endpointInfo.getHeartbeatRouteId())
.autoStartup(false)
.setBody(constant(HEARTBEAT_MSG))
.doTry()
  .to(uri)
  .process(new HealthProcessor(endpointInfo, true))
.doCatch(Throwable.class)
  .process(new HealthProcessor(endpointInfo, false))
.end();

uris[index++] = uri;
routeIds[index] = endpointInfo.getHeartbeatRouteId();
}

// Define event route
   
from("activemq:Queue.External?cacheLevelName=CACHE_CONSUMER=true")
.routeId("eventProcessing")
.autoStartup(false)
.log(LoggingLevel.DEBUG, "Event Received: ${id}")
.process(factory.createProducerTransformer())
.loadBalance(new BoldLoadBalancer(endpointInfos))
.to(uris);

// Set up heartbeat detector
heartbeatDetector.initialize(this, routeIds);

Camel Producer
-
@Override
protected void doStart() throws Exception {
super.doStart();
connect();
}

private void connect() {
final ChannelFuture channelFuture = bootstrap.connect();
channelFuture.addListener(new GenericFutureListener() {
@Override
public void operationComplete(final ChannelFuture future) throws
Exception {
if (!future.isSuccess()) {
LOG.info("Connection not successful. Cause: " +
future.cause().toString() + " -> Reconnecting...");
reconnect(future.channel());
} else {
LOG.info("Connection successful.");
}
}
});
}

I am nomally creating a new producer when an endpoint is intialized and
createProducer() is called.

Endpoint class

@Override
public Producer createProducer() throws Exception {
LOG.info("Create Producer called");
return new BoldProducer(this, uri);
}

It looks like this createProducer() is also called from ProducerCache.java

Thanks,
Shiva 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Multiple-camel-producers-instantiated-tp5781152p5781155.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Catch-All for (Sub-) Route Exception Handling

2016-04-15 Thread ritterda
Hello, 

I am analyzing the exception handling capabilities of Apache Camel (v2.16.x)
and was wondering whether it is possible to propagate exceptions from a
subroute (B; e.g., "from:direct") to the calling route (A; e.g.,
"to:direct") without setting ".errorHandler(noErrorHandler())".

A: from(..).onException(IOException.class)...process().to(direct:subroute);

B:
from(direct:subroute).*errorHandler(noErrorHandler())*.process(fails).to(..);

The noErrorHandler flag on a subroute level disables all error handlers
(e.g., global TransactionErrorHandler, DefaultErrorHandler). As a result the
exception is propagated to the calling route (A). As suggested in many
forums, this works fine, i.e., the exception is caught by the onException
clause for further processing. However, if error handlers are required, the
noErrorHandler cannot be set, which does not propagate the exception.

Do you know a way how to ensure the described behavior? Thank you in
advance.

Best Regards,
Daniel Ritter







--
View this message in context: 
http://camel.465427.n5.nabble.com/Catch-All-for-Sub-Route-Exception-Handling-tp5781154.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple camel producers instantiated

2016-04-15 Thread Charles Moulliard
Hi Shiva,

Can you share the code/test case in order to reproduce the issue please ?
Which camel component do you use ? Which camel version ?

Regards,

On Fri, Apr 15, 2016 at 11:51 AM, Shiva  wrote:

> Hi,
>
> I am using Camel and I have an issue that multiple instances of the Default
> producer is being created suddenly. Normally when I start the camel route,
> only one instance of the producer is created as expected. It works fine for
> a few hours sending messages to the endpoint. But after a while, a new
> Producer is instantiated. I try to establish a TCP connection to the
> endpoint in doStart() of Producer. The newly created producer tries to
> establish connection which is not successful. So I am not able to forward
> messages to the endpoint anymore. Please help!!
>
> Thanks,
> Shiva
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Multiple-camel-producers-instantiated-tp5781152.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io


Multiple camel producers instantiated

2016-04-15 Thread Shiva
Hi,

I am using Camel and I have an issue that multiple instances of the Default
producer is being created suddenly. Normally when I start the camel route,
only one instance of the producer is created as expected. It works fine for
a few hours sending messages to the endpoint. But after a while, a new
Producer is instantiated. I try to establish a TCP connection to the
endpoint in doStart() of Producer. The newly created producer tries to
establish connection which is not successful. So I am not able to forward
messages to the endpoint anymore. Please help!!

Thanks,
Shiva



--
View this message in context: 
http://camel.465427.n5.nabble.com/Multiple-camel-producers-instantiated-tp5781152.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Store un-evaluated simple expression, and evaluate on use?

2016-04-15 Thread jimi.hullegard
I can't get it to work.

This is my config:







  [...]
  
  ref:testExpression
  
  
  
  [...]




And this is the output:

Test 1: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}
Test 2: ${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}


But I expected something like this as output:

Test 1: myFile_2016-04-15_11.26.40
Test 2: myFile_2016-04-15_11.26.40

So, it seems like it treats the expression as a String instead of evaluating it.

/Jimi


-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Friday, April 15, 2016 10:39 AM
To: users@camel.apache.org
Subject: Re: Store un-evaluated simple expression, and evaluate on use?

In Java code you can store anything in the registry,

and also in xml but using  style and call the static simple method on the 
language


   

And then you can refer to the expression using

xxx

Or if using simple

ref:xxx


An alternative is to use property placeholders 
http://camel.apache.org/using-propertyplaceholder.html

On Fri, Apr 15, 2016 at 10:22 AM,   wrote:
> Hi,
>
> Is it possible to define a simple expression in some global variable, without 
> evaluating it? And then reference it, and evaluate it, later? I'm using Camel 
> Spring XML.
>
> For example, something like this pseudo config:
>
>  value="${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}"/>
>
> 
> 
>   [...]
>headerName="myHeader">${testExpression}
>   [...]
> 
> 
>
> Can this be done with some built in standard functionality? The reason is 
> that I want to use the exact same expression in multiple places, and want to 
> avoid copy pasting it.
>
> I use Camel 2.17.0.
>
> Regards
> /Jimi



--
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Store un-evaluated simple expression, and evaluate on use?

2016-04-15 Thread Claus Ibsen
In Java code you can store anything in the registry,

and also in xml but using  style and call the static simple
method on the language


  


And then you can refer to the expression using

xxx

Or if using simple

ref:xxx


An alternative is to use property placeholders
http://camel.apache.org/using-propertyplaceholder.html

On Fri, Apr 15, 2016 at 10:22 AM,   wrote:
> Hi,
>
> Is it possible to define a simple expression in some global variable, without 
> evaluating it? And then reference it, and evaluate it, later? I'm using Camel 
> Spring XML.
>
> For example, something like this pseudo config:
>
>  value="${file:name.noext}_${date:now:-MM-dd_HH.mm.ss}"/>
>
> 
> 
>   [...]
>headerName="myHeader">${testExpression}
>   [...]
> 
> 
>
> Can this be done with some built in standard functionality? The reason is 
> that I want to use the exact same expression in multiple places, and want to 
> avoid copy pasting it.
>
> I use Camel 2.17.0.
>
> Regards
> /Jimi



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Store un-evaluated simple expression, and evaluate on use?

2016-04-15 Thread jimi.hullegard
Hi,

Is it possible to define a simple expression in some global variable, without 
evaluating it? And then reference it, and evaluate it, later? I'm using Camel 
Spring XML.

For example, something like this pseudo config:





  [...]
  ${testExpression}
  [...]



Can this be done with some built in standard functionality? The reason is that 
I want to use the exact same expression in multiple places, and want to avoid 
copy pasting it.

I use Camel 2.17.0.

Regards
/Jimi


how to hold temporary data to use later.....

2016-04-15 Thread sungkwon.eom
Hello, this is the scenario what I want to handle..


1) load files from a directory
2)collect first line from each files  (Using this data DB will be
updated later)
3)compress files to a single tar.gz file.
4)upload the compressed file to FTP site.
5)update DB table over the compressed and FTP uploded files using temporary
data from (2).


In here, how can I hold the first line of each files and how to pass the
line data to DB route?
Of course if compress & FTP uploading is fail,  DB update should not occur.

Thanks, in advance.



--
View this message in context: 
http://camel.465427.n5.nabble.com/how-to-hold-temporary-data-to-use-later-tp5781121.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2016-04-15 Thread Claus Ibsen
Hi

Thanks I logged a ticket
https://issues.apache.org/jira/browse/CAMEL-9870

On Thu, Apr 14, 2016 at 10:00 PM, Mario Balaban  wrote:
> I am using version 2.16.1. The example is something like this:
>
>  
>
> and the the java bean method is:
>
> public void addNote(String invoice, String note){
> ...}
>
> In this case the binding expression assigns the result of Invoice.toString
> method to the first argument and null to the second even if there is a
> header with name "note" that does contain a non null value.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5781114.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Camel scheduler is not concurrent

2016-04-15 Thread cookie
Thank you very much... that looks like the answer I am looking for.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-scheduler-is-not-concurrent-tp5781066p5781120.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel-spring-boot + @UseAdviceWith

2016-04-15 Thread David Bennison
Fortunately I am not too far into my project so I've branched and ripped out 
Camel Spring Boot (which is a shame). I lost a few days with this issue and it 
makes me wonder what other problems may be lurking. They really should have 
done what Chris Love suggested on CAMEL-7963 and highlighted in the Docs the 
annotations that don't work, preferably with any known workarounds.

BTW once I ripped out Camel Spring Boot the @UseAdviceWith worked.

From: Jeff Segal 
Sent: 14 April 2016 18:18
To: users@camel.apache.org
Subject: Re: camel-spring-boot + @UseAdviceWith

Exactly - I had the same suspicion with regard to Camel-7963 but was hoping
to be proven wrong here. I have not gotten any further unfortunately. I'm
planning on trying a few work-arounds but it's unclear what the typical
setup ought to be. I would think that others would be in the same boat if
they want to apply integration tests to their routes while using
camel-spring-boot.

Jeff

On Thu, Apr 14, 2016 at 5:16 AM, David Bennison  wrote:

> Our problem looks similar to this one with @MockEndpoints raised back in
> 2015 against Camel 2.16.0.
>
> http://grokbase.com/t/camel/users/15bgwdeftt/spring-boot-test-mocks
>
> The reason given by Joakim Bjørnstad appears to explain what we are
> experiencing.
>
> The last comment on https://issues.apache.org/jira/browse/CAMEL-7963 is:-
>
> "I still need to add support for Spring test annotations like
> @MockEndpoints"
>
> So perhaps they never got done. I had problems with @MockEndpoints as
> well. I am also experiencing strangeness with NotifyBuilder but that could
> be unrelated.
> 
> From: Jeff Segal 
> Sent: 12 April 2016 16:46
> To: users@camel.apache.org
> Subject: camel-spring-boot + @UseAdviceWith
>
> All,
>
> I'm currently creating a camel-spring-boot project and would like to add
> some tests using @UseAdviceWith but am hitting a few issues. I couldn't
> find an example that fit that use case exactly, so I've played around with
> different things to no avail.
>
> Specifically, I found that when I use @ContextConfiguration to specify my
> main Spring app config, my use of
> @BootstrapWith(CamelTestContextBootstrapper.class) is honored (i.e. I can
> step through it in a debugger during startup) and I can see @UseAdviceWith
> being used in CamelSpringTestContextLoader.handleCamelContextStartup().
> However, when I @Autowire my CamelContext into my test class, Spring
> startup fails because it can't find my CamelContext Spring bean (even when
> I explicitly include a @Configuration that extends CamelConfiguration,
> which explicitly creates a CamelContext @Bean). I need a reference to my
> CamelContext so that I can start it once I'm done setting up my routeWith
> advice.
>
> One last thing: when I use @SpringApplicationConfiguration instead of
> @ContextConfiguration, Spring is able to find the CamelContext bean but it
> ignores my @BootstrapWith(CamelTestContextBootstrapper.class) &
> @UseAdviceWith and thus just starts up the CamelContext automatically
> rather than waiting for me to start it manually (after my routeWith
> advice).
>
> Any pointers on what I might be doing wrong would be great. In summary:
>
> Honoring @UseAdviceWith but no CamelContext Spring bean:
>
> @ContextConfiguration(classes = {ApplicationConfig.class})
> @RunWith(CamelSpringJUnit4ClassRunner.class)
> @BootstrapWith(CamelTestContextBootstrapper.class)
> @UseAdviceWith
> @Slf4j
> public class MyTest {
>
> @Autowired
> CamelContext camelContext;
>
> @Test
> public void test() throws InterruptedException {
> log.info("Starting test...");
> Thread.sleep(1000 * 60);
> }
>
> }
>
> Have a CamelContext Spring bean but NOT honoring @UseAdviceWith:
>
> @SpringApplicationConfiguration(classes = {ApplicationConfig.class})
> @RunWith(CamelSpringJUnit4ClassRunner.class)
> @BootstrapWith(CamelTestContextBootstrapper.class)
> @UseAdviceWith
> @Slf4j
> public class MyTest {
>
> @Autowired
> CamelContext camelContext;
>
> @Test
> public void test() throws InterruptedException {
> log.info("Starting test...");
> Thread.sleep(1000 * 60);
> }
>
> }
>
> Thanks!
> Jeff
> This email is confidential and may be privileged. If you are not the
> intended recipient, please notify the sender immediately and delete the
> email from your computer. You should not copy the email, use it for any
> purpose or disclose its contents to any other person. Please note that any
> views or opinions presented in this email may be personal to the author and
> do not necessarily represent the views or opinions of MetaPack. It is the
> responsibility of the recipient to check this email for the presence of
> viruses. MetaPack accepts no liability for any damage caused by any virus
> transmitted by this email. MetaPack Registered Office: 4th