Polling consumer poll period

2016-11-01 Thread Kasim Sert (Ibtech-Software Infrastructure)
Hi,

Although timer period is 10 seconds , when i check the logs I can see this 
polling occurs every 1 minute. I changed the polling consumer timeout but same 
result.
Why is this behaviour ?

Note : Using camel 2.18.0 with Spring Boot.


from("timer://mytimer?period=1")
  .bean(MyBean.class)
  .pollEnrich("imaps://"+host+":993 ",1000)
  .log("finish");

Log:

2016-11-02 07:23:05.375  INFO 22784 --- [timer://mytimer] route1
2016-11-02 07:24:05.376  INFO 22784 --- [timer://mytimer] route1
2016-11-02 07:25:05.376  INFO 22784 --- [timer://mytimer] route1




Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. Onay?m?z 
olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i ki?i 
de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?. bu mesaj?n 
i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir garanti 
vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun i?eri?inden, 
iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir. Bu mesaj?n 
i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini i?ermeyebilir.

The information contained in this e-mail (including any attachments)is 
confidential. It must not be disclosed to any person without our authority. If 
you are not the intended recipient, please delete it from your system 
immediately. IBTech A.S. makes no warranty as to the accuracy or completeness 
of any information contained in this message and hereby excludes any liability 
of any kind for the information contained therein or for the information 
transmission, reception, storage or use of such in any way whatsoever. Any 
opinions expressed in this message are those of the author and may not 
necessarily reflect the opinions of IBTech A.S.


Re: Conditional Polling Consumer

2016-11-01 Thread Quinn Stevenson
Try enrich() http://camel.apache.org/content-enricher.html 


> On Nov 1, 2016, at 1:30 PM, Kasim Sert  wrote:
> 
> I have an apache camel application which runs as three identical services
> in production environment for scalability. I want to add email server
> polling to this application using camel-mail api. Since I dont want  all
> these three instances poll the server concurrently, I want to put some
> locking mechanism before camel polls. However since mail consumers are
> polling consumer, I can not use them in this situation. Is there an easy
> way to do this ?
> 
> In short, I have a route like below:
> 
> from("imaps://mymail...")//This polls periodically
>.to(Processmail.class)
> 
> But I need something like below in camel dsl
> 
> 
>   from("timer:mytimer")
> .to("direct:checkDistributedLock")
> .choice()
>  .when(header("gotlock").isEqualTo("true"))
> .from("imaps://..") // can not use from here!!!
> .end()
> 
> 
> -- 
> Kasim Sert



Conditional Polling Consumer

2016-11-01 Thread Kasim Sert
I have an apache camel application which runs as three identical services
in production environment for scalability. I want to add email server
polling to this application using camel-mail api. Since I dont want  all
these three instances poll the server concurrently, I want to put some
locking mechanism before camel polls. However since mail consumers are
polling consumer, I can not use them in this situation. Is there an easy
way to do this ?

In short, I have a route like below:

 from("imaps://mymail...")//This polls periodically
.to(Processmail.class)

But I need something like below in camel dsl


   from("timer:mytimer")
 .to("direct:checkDistributedLock")
 .choice()
  .when(header("gotlock").isEqualTo("true"))
 .from("imaps://..") // can not use from here!!!
 .end()


-- 
Kasim Sert


subscribe camel-users

2016-11-01 Thread Scott MacKay



Re: Java DSL: How to inject object endpoint?

2016-11-01 Thread Allan C.
I'll look into this, thanks.

Regards,
Allan C.

On Tue, Nov 1, 2016 at 10:21 PM, Brad Johnson 
wrote:

> You may also want to look at @EndpointInject with uri of the route you want
> to invoke.  That depends on the specific needs.  You might use that in the
> case where you want to iterate over items in a list, mutate some data or
> filter items and find it easier to do in a Java POJO than in the route
> builder or XML.  In that case the injection of the endpoint will permit you
> to invoke the next route from your Java code.
>
> I recently had a case where I received a List of items from a REST/SOAP
> route and needed to make sure that all the items were valid before sending
> back an OK or a rejection.  All the beans in the list had to be valid or
> none of them could be processed.  It could have been done in blueprint but
> it would have been a bit more fiddly and not as easy to unit test.
>
> That's the nice thing about Camel is it permits different mechanisms.
>
> On Mon, Oct 31, 2016 at 11:24 PM, Allan C.  wrote:
>
> > Noted, thanks for the tips!
> >
> > Regards,
> > Allan C.
> >
> > On Tue, Nov 1, 2016 at 12:11 PM, Tomohisa Igarashi <
> tm.igara...@gmail.com>
> > wrote:
> >
> > > Or migrate to @Named("someInstance") CDI bean with using camel-cdi?
> > > http://camel.apache.org/cdi.html
> > >
> > >
> > > On 11/01/2016 01:04 PM, Minh Tran wrote:
> > >
> > >> Hi
> > >>
> > >> It’s still the same syntax
> > >>
> > >> from("foo://bar?foobar=#someInstance”).to (….
> > >>
> > >> You still declare the someInstance somewhere in your Spring context as
> > >> you would have previously using xml DSL
> > >>
> > >> On 1 Nov 2016, at 3:01 PM, Allan C.  wrote:
> > >>>
> > >>> P/S I am using RouteBuilder
> > >>>
> > >>> Regards,
> > >>> Allan C.
> > >>>
> > >>> On Tue, Nov 1, 2016 at 11:58 AM, Allan C. 
> wrote:
> > >>>
> > >>> Hi,
> > 
> >  I've never used Java DSL to define routes. Can anyone share or
> provide
> >  some hints on how to perform the same thing below in Java code? i.e.
> >  inject
> >  someInstance into the endpoint.
> > 
> >  
> > 
> >  Regards,
> >  Allan C.
> > 
> > 
> > >>
> >
>


RE: zipfile question - thank you

2016-11-01 Thread Mills, Gary (GE Digital)
DefaultErrorHandler  | 198 - org.apache.camel.camel-core - 
2.15.1.redhat-620133 | Failed delivery for (MessageId: 
ID-alphprdfuse2i-43262-1478008924653-2-36907 on ExchangeId: 
ID-alphprdfuse2i-43262-1478008924653-2-36908). Exhausted after delivery 
attempt: 1 caught: org.apache.camel.InvalidPayloadException: No body available 
of type: java.lang.String but has value: 
org.apache.camel.dataformat.zipfile.ZipInputStreamWrapper@bcbe474 of type: 
org.apache.camel.dataformat.zipfile.ZipInputStreamWrapper on: Message: [Body is 
instance of java.io.InputStream]. Caused by: Error during type conversion from 
type: java.lang.String to the required type: java.lang.String with value [Body 
is instance of java.io.InputStream] due java.util.zip.ZipException: invalid 
code lengths set. Exchange[Message: [Body is instance of java.io.InputStream]]. 
Caused by: [org.apache.camel.TypeConversionException - Error during type 
conversion from type: java.lang.String to the required type: java.lang.String 
with value [Body is instance of java.io.InputStream] due 
java.util.zip.ZipException: invalid code lengths set]

I am very confused.  If I take that zip file and simply drop it in the 
fileEntranceEndpoint everything works fine. If I send it through email it 
doesn't work. The only thing I've noticed is that the zip file appears to be 
corrupted after extracting the attachment and the above is what error is thrown.

Thank you

From: Mills, Gary (GE Digital)
Sent: Tuesday, November 01, 2016 11:52 AM
To: Mills, Gary (GE Digital) 
Subject: RE: zipfile question - thank you

Update:

When I send an email to the endpoint email address, with an zip file 
attachment, and I open the zip file attachment directly from email endpoint 
mailbox, the zip file attachment opens ok.  It appears to be related to the 
extraction of the attachment in Camel ?

?



From: Mills, Gary (GE Digital)
Sent: Tuesday, November 01, 2016 10:34 AM
To: 'users-i...@camel.apache.org' 
>
Subject: RE: zipfile question - thank you

Here is the code used to unmarshall the zip file

   public void configure() throws Exception {

  ZipFileDataFormat zipFile = new ZipFileDataFormat();
  zipFile.setUsingIterator(true);

  
from(fileEntranceEndpoint).id("cfi.zipfile.endpointListenerRoute").log("Message 
received zip file: ${file:name}")
  
.unmarshal(zipFile).split(body(Iterator.class)).streaming().convertBodyTo(String.class)
  .log("file names from ZipFile: ${file:name}").to("file://" + 
outDirectory);
   }



From: Mills, Gary (GE Digital)
Sent: Tuesday, November 01, 2016 10:58 AM
To: 'd...@camel.apache.org' 
>
Subject: zipfile question - thank you

Camel users, ( thank you )
My project is to receive a zip compressed and encrypted file attachment from a 
customer, naturally, decompress and decrypt the attachment via email transfer.

I am only focusing on the zip portion now because over email I can't get it to 
work.  Seems that the compression size changes when sent over email.

It seems my logic works, if I take the zip file and simply drop it in the route 
from my Jboss environment it works. I can zip, unzip, the file from command 
line and the camel route. However, if I send the file as an attachment over 
email, the file size changes, and of course it does not work and throws the 
error...
org.apache.camel.RuntimeCamelException: java.util.zip.ZipException: invalid 
code lengths set

which suggests the zip file attachment has been altered during its transfer 
over email. The original file size is 9044 Bytes, after email xfr becomes, 
15580 Bytes.  If I try opening it from the OS with unzip, gunzip, it shows:

[root@alphprdfuse2i latest]# unzip 
ge-ip/core/tobeprocessed/archive/cfindustries.zip.ge
Archive:  ge-ip/core/tobeprocessed/archive/cfindustries.zip.ge
caution:  zipfile comment truncated
error [ge-ip/core/tobeprocessed/archive/cfindustries.zip.ge]:  missing 
3282862893 bytes in zipfile
  (attempting to process anyway)
error [ge-ip/core/tobeprocessed/archive/cfindustries.zip.ge]:  attempt to seek 
before beginning of zipfile
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

I've tried changing the file extension to JPEG, PNG, ge, etc... with no success.

Does anyone know what I can do to get around this???

Thank you !!

Gary Mills



Re: Question on multicast to pipelines

2016-11-01 Thread Brad Johnson
Edoardo,

I missed the second set of logging statements, sorry.  I thought you'd said
they were outputting the same thing. And, yes, that's a bit
counter-intuitive. Personally I almost always do it with just to routes in
the mulitcast and then any further routing or changes I put in those. And I
use blueprint for this though I'm slowly switching the Java DSL.

   







 

///modify the body here
 
   

   

  ///log message here
   

On Tue, Nov 1, 2016 at 12:27 PM, DariusX  wrote:

> Ah, I didn't understand what you were saying before.
> Your point is that these two should be synonymous, even if they're enclosed
> in a multicast()...end():
>
> 1) This...
>  .*pipeline("direct:A", "direct:B")*
>
> 2) and this...
>  .*pipeline().to("direct:C").to("direct:D").end()*
>
> but only the second one works the way you expect.
> The first one sends the same input to both routes (i.e. does not send the
> output of A to B)
>
>
> It does seem odd, and a brief test confirms the behavior you describe (
> Sample code here
>  CamelSandbox/src/main/java/com/zerses/camelsandbox/
> MulticastPipelinesTest.java)>
> )
>
> Looking at  the Camel code - Line 1165
>  src/main/java/org/apache/camel/model/ProcessorDefinition.java>
> , that version of pipeline(String...uri) is simply a synonym for
> to(String...uri), which would explain how it is working.
>
> Someone else would need to speak to how it *ought* to work, but I agree it
> does not seem intuitive as-is.
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Question-on-multicast-to-pipelines-tp5789396p5789593.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Question on multicast to pipelines

2016-11-01 Thread DariusX
Ah, I didn't understand what you were saying before. 
Your point is that these two should be synonymous, even if they're enclosed
in a multicast()...end():

1) This...
 .*pipeline("direct:A", "direct:B")*

2) and this...
 .*pipeline().to("direct:C").to("direct:D").end()*

but only the second one works the way you expect. 
The first one sends the same input to both routes (i.e. does not send the
output of A to B)


It does seem odd, and a brief test confirms the behavior you describe ( 
Sample code here

  
) 

Looking at  the Camel code - Line 1165

 
, that version of pipeline(String...uri) is simply a synonym for
to(String...uri), which would explain how it is working.

Someone else would need to speak to how it *ought* to work, but I agree it
does not seem intuitive as-is.


 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Question-on-multicast-to-pipelines-tp5789396p5789593.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Zip all files available in folder - synchronously

2016-11-01 Thread Goyal, Arpit
Thanks Clause for the reply. So I assume there is no default approach via Camel 
Aggregator.

What I have done currently is used Looping with reading from File Endpoint with 
maxPollMessage = 1. As we are using 2.16 version, the only way this loop based 
solution works if we know before-hand how many files exists. Will switch to 
do-while with 2.17

And I really didn't get how else - on demand we can trigger the route to start 
aggregating the files. Is there some other Camel Component which can help or 
you are proposing non-camel approach? Sorry it isn't clear to me. 

Regards,
Arpit.

-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Tuesday, November 1, 2016 3:41 AM
To: users@camel.apache.org
Subject: Re: Zip all files available in folder - synchronously

You cannot do this the aggregate is in 2 different threads.

Don't use the direct endpoint but do something different to trigger
the route to start and aggreage those files, and then get an event
when its done, which you can then use to know when the zip is ready.





On Mon, Oct 31, 2016 at 11:04 PM, Goyal, Arpit  wrote:
> Hi Colleagues,
>
> I want to read all file and aggregate into one single zip, but the batch 
> consumer always run in different thread. What needs to be done additionally 
> to get the response synchronously?
>
> Regards,
> Arpit.
>
>DefaultCamelContext c = new DefaultCamelContext();
> try {
>   c.addRoutes(new RouteBuilder() {
>
> @Override
> public void configure() throws Exception {
>   
> from("direct:start").from("file:/tmp/wiretap/6443391d-196a-4c75-b2f8-9c0696025b56/?include=.*=true=2500")
>   .aggregate(body(), new 
> CustomZipAggregationStrategy()).completionFromBatchConsumer().to("file:/tmp/wiretap/aggregate");
> }
>   });
>
>   ProducerTemplate template = c.createProducerTemplate();
>   c.start();
>   template.start();
>   template.requestBody("direct:start", "BEGIN"); //synchronously response 
> on completion of zip construction...
> } finally {
>   c.stop();
> }
>



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


Re: Question on multicast to pipelines

2016-11-01 Thread Edoardo Causarano
I don’t see how .pipeline().to(“A”).to(“B”).end() should not be equivalent to 
.pipeline(“A”, “B”), or to .to(“A”, “B”) which is - for what I understood from 
documentation - equivalent to the pipeline statement anyway. I am of course 
changing data in the A and C steps, please go look at the gist in my original 
email (and the output of the working example for that matter.)

I understand the intuition that the multicast sends the same message 
downstream; what is counter-intuitive to me is that it reaches *into* the 
pipelines rather than just their heads. Please read my code and the logs I 
added in my last post and let me know if this is expected - albeit backwards - 
behavior or whether it’s a bug.


Best,
Edoardo


> On 1 Nov 2016, at 14:59, Brad Johnson  wrote:
> 
> That's what you should see unless you change the data in A or in C.  A and
> C should both receive START.  It is a multicast. If you change the value in
> A you'll see that change in B but that will not be shown in C since C is at
> the root of the multicast. If you change the data in C you'll see it in D.
> 
> Another way to think of the multicast, if this helps, is that the first
> elements in the multicast are like a pub/sub or JMS topic where each of the
> subscribers receive exactly the same message.
> 
> On Tue, Nov 1, 2016 at 4:49 AM, Edoardo Causarano <
> edoardo.causar...@gmail.com> wrote:
> 
>> Hi all,
>> 
>> these are the results I get, only the most explicit and verbose
>> configuration returns the expected result.
>> 
>> Working route:
>> .pipeline().to("A").to("B").end()
>> .pipeline().to("C").to("D").end()
>> 
>> 10:41:12.644 [main] INFO route1 - after direct:start body=START
>> 10:41:12.666 [main] DEBUG org.apache.camel.processor.SendProcessor - 
>> A Exchange[ID-Spitfire-local-50181-1477993271722-0-3]
>> 10:41:12.667 [main] DEBUG com.esc.test.MulticastPipelinesTest - A got
>> in=START
>> 10:41:12.667 [main] DEBUG org.apache.camel.processor.SendProcessor - 
>> B Exchange[ID-Spitfire-local-50181-1477993271722-0-3]
>> 10:41:12.667 [main] DEBUG com.esc.test.MulticastPipelinesTest - B got in=A
>> 10:41:12.670 [main] DEBUG org.apache.camel.processor.SendProcessor - 
>> C Exchange[ID-Spitfire-local-50181-1477993271722-0-4]
>> 10:41:12.671 [main] DEBUG com.esc.test.MulticastPipelinesTest - C got
>> in=START
>> 10:41:12.671 [main] DEBUG org.apache.camel.processor.SendProcessor - 
>> D Exchange[ID-Spitfire-local-50181-1477993271722-0-4]
>> 10:41:12.671 [main] DEBUG com.esc.test.MulticastPipelinesTest - D got in=C
>> 
>> 
>> Faulty routes:
>> .pipeline("A", "B")
>> .pipeline("C", "D”)
>> 
>> or
>> 
>> .to("A", "B")
>> .to("C", "D")
>> 
>> 10:43:46.383 [main] INFO route1 - after direct:start body=START
>> 10:43:46.389 [main] DEBUG org.apache.camel.processor.SendProcessor - 
>> A Exchange[ID-Spitfire-local-50316-1477993425625-0-3]
>> 10:43:46.389 [main] DEBUG com.esc.test.MulticastPipelinesTest - A got
>> in=START
>> 10:43:46.390 [main] DEBUG org.apache.camel.processor.SendProcessor - 
>> B Exchange[ID-Spitfire-local-50316-1477993425625-0-4]
>> 10:43:46.390 [main] DEBUG com.esc.test.MulticastPipelinesTest - B got
>> in=START
>> 10:43:46.391 [main] DEBUG org.apache.camel.processor.SendProcessor - 
>> C Exchange[ID-Spitfire-local-50316-1477993425625-0-5]
>> 10:43:46.391 [main] DEBUG com.esc.test.MulticastPipelinesTest - C got
>> in=START
>> 10:43:46.391 [main] DEBUG org.apache.camel.processor.SendProcessor - 
>> D Exchange[ID-Spitfire-local-50316-1477993425625-0-6]
>> 10:43:46.391 [main] DEBUG com.esc.test.MulticastPipelinesTest - D got
>> in=START
>> 
>> 
>> Best,
>> Edoardo
>> 
>>> On 31 Oct 2016, at 15:04, DariusX  wrote:
>>> 
>>> Your example was:
>>> multicast()
>>>   .pipeline("A", "B")
>>>   .pipeline("C", "D")
>>> .end()
>>> 
>>> You send "START" as the body to this. So, you should expect "START" to be
>>> the in.body for both "A" and "C".
>>> 
>>> The in body for "B" will depend on what "A" does. Example: if "A"
>> transforms
>>> the body to a constant "Hello from A", then that is what "B" will get as
>> its
>>> in.body.
>>> 
>>> Similarly, "D" will get whatever "C" decides to send along.
>>> 
>>> If neither A nor C make any changes to the body, then you should expect
>>> "START" to be the in.body for all four.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: http://camel.465427.n5.nabble.
>> com/Question-on-multicast-to-pipelines-tp5789396p5789518.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
>> 



QuartzScheduledPollConsumerScheduler, cluster and scheduler.triggerId

2016-11-01 Thread glenn
Am using a camel file consumer within a cluster to poll files on a periodic
basis. I wish to ensure that a consumer will only poll files if it has an
exclusive read lock on them so using the
QuartzScheduledPollConsumerScheduler with a readLock=idempotent read lock
strategy backed by a JdbcMessageIdRepository idempotentRepository.

I wanted to confirm that such an approach will ONLY work correctly in
cluster PROVIDED a unique triggerId is also assigned (ie assigned via use of
the QuartzScheduledPollConsumerScheduler scheduler.triggerId option)?

As where scheduler.triggerId is NOT assigned then a UUID is generated and a
unique job/trigger is created for EACH node resulting in > 1 file consumers
poll starting simultaneously.
For example in a cluster of two nodes with auto assigned UUID triggerId,
then two jobs will trigger against only one node each or both jobs against
one node. That scenario seems wrong in a cluster. 

BUT if a unique scheduler.triggerId is specified then only one job/trigger
will exist in DB and so quartz can ensure that the triggered job will only
ever work against one of the nodes at a time. That does seem to be the
desired behaviour.

So adopting the use of a scheduler.triggerId based approach does seem valid
but it does raise a question concerning the removal of the DB triggers/jobs
upon camel context shut down in a cluster so I wanted to check my
understanding before following up on that.




--
View this message in context: 
http://camel.465427.n5.nabble.com/QuartzScheduledPollConsumerScheduler-cluster-and-scheduler-triggerId-tp5789575.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Hystrix Fallback not executed on Thread Pool/Semaphore rejection

2016-11-01 Thread Maxime Tremblay
Great, thank you for the fix.

On Tue, Nov 1, 2016 at 7:23 AM, Claus Ibsen  wrote:

> Hi
>
> Ah yes thats a bug. I have logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-10430
>
> We should get the exception from the command which then also has
> exception for other kind of failures such as rejected etc
>
>
>
> On Mon, Oct 31, 2016 at 3:44 PM, Maxime Tremblay
>  wrote:
> > Hi,
> >
> > In the Camel-Hystrix component, what motivated the choice the execute the
> > Fallback only when an Exception is raised ?
> >
> > Why not to let the end user choose if they want to execute the fallback
> or
> > not when no Exception is raised ?
> >
> > To put in context:
> >
> > The getFallback() is called by Hystrix in all the cases documented in
> > Hystrix doc:
> > "Hystrix will execute this fallback for all types of failure such as
> run()
> > failure, timeout, thread pool or semaphore rejection, and circuit-breaker
> > short-circuiting. "
> >
> > Cf: https://github.com/Netflix/Hystrix/wiki/How-To-Use#Fallback
> >
> > However, Camel-Hystrix sometimes does not execute the fallback, eg. on
> > thread pool or semaphore rejection, because no Exception is raised those
> > cases.
> >
> > Cf line 50 of:
> > https://github.com/apache/camel/blob/master/components/
> camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/
> HystrixProcessorCommand.java
> >
> > Best Regards,
> >
> > Max
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Java DSL: How to inject object endpoint?

2016-11-01 Thread Brad Johnson
You may also want to look at @EndpointInject with uri of the route you want
to invoke.  That depends on the specific needs.  You might use that in the
case where you want to iterate over items in a list, mutate some data or
filter items and find it easier to do in a Java POJO than in the route
builder or XML.  In that case the injection of the endpoint will permit you
to invoke the next route from your Java code.

I recently had a case where I received a List of items from a REST/SOAP
route and needed to make sure that all the items were valid before sending
back an OK or a rejection.  All the beans in the list had to be valid or
none of them could be processed.  It could have been done in blueprint but
it would have been a bit more fiddly and not as easy to unit test.

That's the nice thing about Camel is it permits different mechanisms.

On Mon, Oct 31, 2016 at 11:24 PM, Allan C.  wrote:

> Noted, thanks for the tips!
>
> Regards,
> Allan C.
>
> On Tue, Nov 1, 2016 at 12:11 PM, Tomohisa Igarashi 
> wrote:
>
> > Or migrate to @Named("someInstance") CDI bean with using camel-cdi?
> > http://camel.apache.org/cdi.html
> >
> >
> > On 11/01/2016 01:04 PM, Minh Tran wrote:
> >
> >> Hi
> >>
> >> It’s still the same syntax
> >>
> >> from("foo://bar?foobar=#someInstance”).to (….
> >>
> >> You still declare the someInstance somewhere in your Spring context as
> >> you would have previously using xml DSL
> >>
> >> On 1 Nov 2016, at 3:01 PM, Allan C.  wrote:
> >>>
> >>> P/S I am using RouteBuilder
> >>>
> >>> Regards,
> >>> Allan C.
> >>>
> >>> On Tue, Nov 1, 2016 at 11:58 AM, Allan C.  wrote:
> >>>
> >>> Hi,
> 
>  I've never used Java DSL to define routes. Can anyone share or provide
>  some hints on how to perform the same thing below in Java code? i.e.
>  inject
>  someInstance into the endpoint.
> 
>  
> 
>  Regards,
>  Allan C.
> 
> 
> >>
>


Re: Question on multicast to pipelines

2016-11-01 Thread Brad Johnson
That's what you should see unless you change the data in A or in C.  A and
C should both receive START.  It is a multicast. If you change the value in
A you'll see that change in B but that will not be shown in C since C is at
the root of the multicast. If you change the data in C you'll see it in D.

Another way to think of the multicast, if this helps, is that the first
elements in the multicast are like a pub/sub or JMS topic where each of the
subscribers receive exactly the same message.

On Tue, Nov 1, 2016 at 4:49 AM, Edoardo Causarano <
edoardo.causar...@gmail.com> wrote:

> Hi all,
>
> these are the results I get, only the most explicit and verbose
> configuration returns the expected result.
>
> Working route:
> .pipeline().to("A").to("B").end()
> .pipeline().to("C").to("D").end()
>
> 10:41:12.644 [main] INFO route1 - after direct:start body=START
> 10:41:12.666 [main] DEBUG org.apache.camel.processor.SendProcessor - 
> A Exchange[ID-Spitfire-local-50181-1477993271722-0-3]
> 10:41:12.667 [main] DEBUG com.esc.test.MulticastPipelinesTest - A got
> in=START
> 10:41:12.667 [main] DEBUG org.apache.camel.processor.SendProcessor - 
> B Exchange[ID-Spitfire-local-50181-1477993271722-0-3]
> 10:41:12.667 [main] DEBUG com.esc.test.MulticastPipelinesTest - B got in=A
> 10:41:12.670 [main] DEBUG org.apache.camel.processor.SendProcessor - 
> C Exchange[ID-Spitfire-local-50181-1477993271722-0-4]
> 10:41:12.671 [main] DEBUG com.esc.test.MulticastPipelinesTest - C got
> in=START
> 10:41:12.671 [main] DEBUG org.apache.camel.processor.SendProcessor - 
> D Exchange[ID-Spitfire-local-50181-1477993271722-0-4]
> 10:41:12.671 [main] DEBUG com.esc.test.MulticastPipelinesTest - D got in=C
>
>
> Faulty routes:
> .pipeline("A", "B")
> .pipeline("C", "D”)
>
> or
>
> .to("A", "B")
> .to("C", "D")
>
> 10:43:46.383 [main] INFO route1 - after direct:start body=START
> 10:43:46.389 [main] DEBUG org.apache.camel.processor.SendProcessor - 
> A Exchange[ID-Spitfire-local-50316-1477993425625-0-3]
> 10:43:46.389 [main] DEBUG com.esc.test.MulticastPipelinesTest - A got
> in=START
> 10:43:46.390 [main] DEBUG org.apache.camel.processor.SendProcessor - 
> B Exchange[ID-Spitfire-local-50316-1477993425625-0-4]
> 10:43:46.390 [main] DEBUG com.esc.test.MulticastPipelinesTest - B got
> in=START
> 10:43:46.391 [main] DEBUG org.apache.camel.processor.SendProcessor - 
> C Exchange[ID-Spitfire-local-50316-1477993425625-0-5]
> 10:43:46.391 [main] DEBUG com.esc.test.MulticastPipelinesTest - C got
> in=START
> 10:43:46.391 [main] DEBUG org.apache.camel.processor.SendProcessor - 
> D Exchange[ID-Spitfire-local-50316-1477993425625-0-6]
> 10:43:46.391 [main] DEBUG com.esc.test.MulticastPipelinesTest - D got
> in=START
>
>
> Best,
> Edoardo
>
> > On 31 Oct 2016, at 15:04, DariusX  wrote:
> >
> > Your example was:
> > multicast()
> >.pipeline("A", "B")
> >.pipeline("C", "D")
> > .end()
> >
> > You send "START" as the body to this. So, you should expect "START" to be
> > the in.body for both "A" and "C".
> >
> > The in body for "B" will depend on what "A" does. Example: if "A"
> transforms
> > the body to a constant "Hello from A", then that is what "B" will get as
> its
> > in.body.
> >
> > Similarly, "D" will get whatever "C" decides to send along.
> >
> > If neither A nor C make any changes to the body, then you should expect
> > "START" to be the in.body for all four.
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.
> com/Question-on-multicast-to-pipelines-tp5789396p5789518.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


Re: Camel-REST vs Cxfrs

2016-11-01 Thread DariusX
Claus Ibsen-2 wrote
> Camel in Action 2nd ed book has a full chapter on REST and various ways to
> use it with Camel.

Yes, looking at the MEAP edition got me wondering if that was the general
direction: i.e. to encourage the use of the REST DSL unless there were
specific reasons for one of the other approaches.

Thank you both for your answers; very informative.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-REST-vs-Cxfrs-tp5789523p5789571.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel 2.18.0 blueprint message metrics fail

2016-11-01 Thread gustavo.maurizio
In Camel 2.18.0 under Karaf, using blueprint, now messageMetrics fail
indicating messageMetrics must be specified. This is different behavior from
Camel 2.17.3, where no such component configuration was required.

Any ideas how to fix them?








--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-2-18-0-blueprint-message-metrics-fail-tp5789564.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Hystrix behaviour when circuit is open

2016-11-01 Thread Claus Ibsen
Hi

Ah sorry didn't spot this email. Only now when I searched for hystrix
in our user forum. We got this reported recently again. I logged a
ticket and fixed it: https://issues.apache.org/jira/browse/CAMEL-10430

On Tue, Oct 25, 2016 at 3:59 PM, jamesnetherton
 wrote:
> Hi all,
>
> I've been experimenting with camel-hystrix and wanted to check what the
> expected (or correct) behaviour should be when the Hystrix circuit is open.
>
> Looking at HystrixProcessorCommand.getFallback(), the fallback command is
> only ever run if a prior exception was encountered. However, when the
> circuit is in the open state, I'd expect a 'short-circuit' and the default
> action would be to just invoke the fallback command (if configured).
>
> I'm basing my assumptions on the Hystrix docs:
>
> https://github.com/Netflix/Hystrix/wiki/How-it-Works
>
> Is this a bug? Or am i misunderstanding how it should work in Camel?
>
> --
> James
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-Hystrix-behaviour-when-circuit-is-open-tp5789223.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: Hystrix Fallback not executed on Thread Pool/Semaphore rejection

2016-11-01 Thread Claus Ibsen
Hi

Ah yes thats a bug. I have logged a ticket
https://issues.apache.org/jira/browse/CAMEL-10430

We should get the exception from the command which then also has
exception for other kind of failures such as rejected etc



On Mon, Oct 31, 2016 at 3:44 PM, Maxime Tremblay
 wrote:
> Hi,
>
> In the Camel-Hystrix component, what motivated the choice the execute the
> Fallback only when an Exception is raised ?
>
> Why not to let the end user choose if they want to execute the fallback or
> not when no Exception is raised ?
>
> To put in context:
>
> The getFallback() is called by Hystrix in all the cases documented in
> Hystrix doc:
> "Hystrix will execute this fallback for all types of failure such as run()
> failure, timeout, thread pool or semaphore rejection, and circuit-breaker
> short-circuiting. "
>
> Cf: https://github.com/Netflix/Hystrix/wiki/How-To-Use#Fallback
>
> However, Camel-Hystrix sometimes does not execute the fallback, eg. on
> thread pool or semaphore rejection, because no Exception is raised those
> cases.
>
> Cf line 50 of:
> https://github.com/apache/camel/blob/master/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java
>
> Best Regards,
>
> Max



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


Re: Camel-REST vs Cxfrs

2016-11-01 Thread Sergey Beryozkin

Claus,
On 01/11/16 10:48, Claus Ibsen wrote:

There are some JIRA tickets to integrate camel-cxf with rest-dsl.
However this requires some changes in CXF to facilitate this.

It is not quite correct. As I pointed out at the time, while attaching 
the initial patches to the relevant Camel issues, the initial POC (where 
absolute HTTP addresses were used as far as I recall) was working, what 
was missing was the good tests and the support for some other deployment 
scenarios (Blueprint, etc).

Some of the CXF committers from Talend said they would like to work on
that, but they don't seem to had the time yet to work on this.

Not quite correct either (see above). Unfortunately, yes, finding time 
to complete this project is a problem - it would require a full time one 
or 2 weeks commitment at least and it is difficult to allocate such a 
time...


My own opinion is it will be worth completing the REST-DSL over CXF-RS 
project and the foundation (in the form of the initial patches) is 
available.


Cheers, Sergey


That said you can always code REST services using plain JAX-RS java
code style also. Or if using Spring Boot then how they do it with
their controllers.

Camel in Action 2nd ed book has a full chapter on REST and various
ways to use it with Camel.

On Mon, Oct 31, 2016 at 5:02 PM, DariusX  wrote:

I would like to expose some Camel routes via REST, and am considering using
the REST DSL. (I do not have  pre-existing REST-based web-service
components.)

Is there any reason/advantage to using camel-cxfrs or some other such
component that supports REST in such a scenario?

It appears to me that the Camel REST DSL is always the way to go unless one
has legacy reasons to use something else, but I'd appreciate someone telling
me if that's a wrong assumption. Also, is there a page somewhere on the
Camel site that would speak to this: i.e. the motivation of using one over
the other?

thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-REST-vs-Cxfrs-tp5789523.html
Sent from the Camel - Users mailing list archive at Nabble.com.







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


R: Re: camel 2.18.0 rabbitmq component fails under Karaf

2016-11-01 Thread Andrea Cosentino
Non sure. Need to investigate a bit 
 
  Il mar, 1 nov, 2016 alle 11:59, souciance 
ha scritto:   Does anyone know why you need to do that?  It isn't necessary in 
2.17.0 and
karaf 4.0.2.

Den 31 okt. 2016 2:09 em skrev "gustavo.maurizio [via Camel]" <
ml-node+s465427n5789514...@n5.nabble.com>:

> Andrea, fantastic!
> Adding this  install -s wrap:mvn:junit/junit/4.12 before installing made
> it work! Thanks!!!
>
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/camel-2-18-0-rabbitmq-
> component-fails-under-Karaf-tp5789413p5789514.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428...@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-2-18-0-rabbitmq-component-fails-under-Karaf-tp5789413p5789556.html
Sent from the Camel - Users mailing list archive at Nabble.com.  


Re: camel 2.18.0 rabbitmq component fails under Karaf

2016-11-01 Thread souciance
Does anyone know why you need to do that?  It isn't necessary in 2.17.0 and
karaf 4.0.2.

Den 31 okt. 2016 2:09 em skrev "gustavo.maurizio [via Camel]" <
ml-node+s465427n5789514...@n5.nabble.com>:

> Andrea, fantastic!
> Adding this  install -s wrap:mvn:junit/junit/4.12 before installing made
> it work! Thanks!!!
>
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/camel-2-18-0-rabbitmq-
> component-fails-under-Karaf-tp5789413p5789514.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428...@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-2-18-0-rabbitmq-component-fails-under-Karaf-tp5789413p5789556.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JpaConsumer endpoint not showing up in hawtio.

2016-11-01 Thread raulsperoni
Ok i'll try with a newer version, anyway could you explain or show an example
of how do you use that component?

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/JpaConsumer-endpoint-not-showing-up-in-hawtio-tp5789346p5789554.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel-REST vs Cxfrs

2016-11-01 Thread Claus Ibsen
Oh also camel-cxf with cxfrs is a bit to bloated with both WS and RS
mixed together. There is also a JIRA ticket to separate this and make
the dependencies smaller and leaner.


On Tue, Nov 1, 2016 at 11:48 AM, Claus Ibsen  wrote:
> There are some JIRA tickets to integrate camel-cxf with rest-dsl.
> However this requires some changes in CXF to facilitate this.
>
> Some of the CXF committers from Talend said they would like to work on
> that, but they don't seem to had the time yet to work on this.
>
> That said you can always code REST services using plain JAX-RS java
> code style also. Or if using Spring Boot then how they do it with
> their controllers.
>
> Camel in Action 2nd ed book has a full chapter on REST and various
> ways to use it with Camel.
>
> On Mon, Oct 31, 2016 at 5:02 PM, DariusX  wrote:
>> I would like to expose some Camel routes via REST, and am considering using
>> the REST DSL. (I do not have  pre-existing REST-based web-service
>> components.)
>>
>> Is there any reason/advantage to using camel-cxfrs or some other such
>> component that supports REST in such a scenario?
>>
>> It appears to me that the Camel REST DSL is always the way to go unless one
>> has legacy reasons to use something else, but I'd appreciate someone telling
>> me if that's a wrong assumption. Also, is there a page somewhere on the
>> Camel site that would speak to this: i.e. the motivation of using one over
>> the other?
>>
>> thanks
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Camel-REST-vs-Cxfrs-tp5789523.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



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


camel-quartz failed camel route creation when database is unreachable

2016-11-01 Thread Rachid KRAIEM
Hi Everyone: 

My bundle osgi installed into karaf container 4.0.7, that use
camel-quartz2-2.17.3 In camelContext I have many routes such as "myRoute",
it call a job quatrz (using camel-quartz2) configured in postgresql
database:


Camel route



 http://camel.apache.org/schema/blueprint;>






 


Bean quartz2


 

 


quartz2 configuration : stat_quartz.cfg



#
# Configure Main Scheduler Properties  
#
org.quartz.scheduler.instanceName=Scheduler
org.quartz.scheduler.instanceId=AUTO
org.quartz.scheduler.skipUpdateCheck=true
org.quartz.scheduler.jobFactory.class=org.quartz.simpl.SimpleJobFactory
#
# Configure ThreadPool  
#
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=10
#
# Configure JobStore  
#
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.dataSource=statQuartzDS
org.quartz.jobStore.tablePrefix=stat_qrtz_
org.quartz.jobStore.isClustered=true
org.quartz.jobStore.clusterCheckinInterval=2
org.quartz.jobStore.useProperties=false 
#
# Configure Datasources  
#
org.quartz.dataSource.statQuartzDS.jndiURL=osgi:service/statQuartzDS



Problem



My issue is when I try to starting the karaf container and postgresql is
stopped, I have the log problem below and the camelContext "myCamelContext"
will be shutdown.


2016-10-14 17:21:40,201 | ERROR | FelixStartLevel  | BlueprintCamelContext  
 
| 80 - org.apache.camel.camel-blueprint - 2.17.3 | Error occurred during
starting Camel: CamelContext(statisticsContext) due Failed to create route
myRoute: Route(myRoute)[[From[quartz2://stat... because of Failed to resolve
endpoint:
quartz2://statGroup/startupTimer?trigger.repeatCount=0=1
due to: Failed to obtain DB connection from data source 'statQuartzDS':
java.sql.SQLException: Could not retrieve datasource via JNDI url
'osgi:service/statQuartzDS' java.sql.SQLException: Unable to acquire a new
connection from the pool
org.apache.camel.FailedToCreateRouteException: Failed to create route
myRoute: Route(myRoute)[[From[quartz2://stat... because of Failed to resolve
endpoint:
quartz2://statGroup/startupTimer?trigger.repeatCount=0=1
due to: Failed to obtain DB connection from data source 'statQuartzDS':
java.sql.SQLException: Could not retrieve datasource via JNDI url
'osgi:service/statQuartzDS' java.sql.SQLException: Unable to acquire a new
connection from the pool
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:974)[83:org.apache.camel.camel-core:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3301)[83:org.apache.camel.camel-core:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3024)[83:org.apache.camel.camel-core:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)[83:org.apache.camel.camel-core:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2854)
at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2850)
at
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2873)[83:org.apache.camel.camel-core:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2850)[83:org.apache.camel.camel-core:2.17.3]
at 

Re: Camel-REST vs Cxfrs

2016-11-01 Thread Claus Ibsen
There are some JIRA tickets to integrate camel-cxf with rest-dsl.
However this requires some changes in CXF to facilitate this.

Some of the CXF committers from Talend said they would like to work on
that, but they don't seem to had the time yet to work on this.

That said you can always code REST services using plain JAX-RS java
code style also. Or if using Spring Boot then how they do it with
their controllers.

Camel in Action 2nd ed book has a full chapter on REST and various
ways to use it with Camel.

On Mon, Oct 31, 2016 at 5:02 PM, DariusX  wrote:
> I would like to expose some Camel routes via REST, and am considering using
> the REST DSL. (I do not have  pre-existing REST-based web-service
> components.)
>
> Is there any reason/advantage to using camel-cxfrs or some other such
> component that supports REST in such a scenario?
>
> It appears to me that the Camel REST DSL is always the way to go unless one
> has legacy reasons to use something else, but I'd appreciate someone telling
> me if that's a wrong assumption. Also, is there a page somewhere on the
> Camel site that would speak to this: i.e. the motivation of using one over
> the other?
>
> thanks
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-REST-vs-Cxfrs-tp5789523.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 2.18.0 rabbitmq component fails under Karaf

2016-11-01 Thread Claus Ibsen
Hi

Andrea do we have an issue in 2.18.x branch with installing camel-rabbitmq?
Then we may need to get this fixed?

Also its a bit weird that junit is needed to be installed, that is for
testing ;)

On Mon, Oct 31, 2016 at 2:09 PM, gustavo.maurizio  wrote:
> Andrea, fantastic!
> Adding this  install -s wrap:mvn:junit/junit/4.12 before installing made it
> work! Thanks!!!
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-2-18-0-rabbitmq-component-fails-under-Karaf-tp5789413p5789514.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: JpaConsumer endpoint not showing up in hawtio.

2016-11-01 Thread Claus Ibsen
Yeah you can do that, but its not very often in use.

Try with a newer Camel release. 2.16.x is EOL.

On Mon, Oct 31, 2016 at 5:27 PM, raulsperoni  wrote:
> I'm doing exactly that...creating the instance like you say.
>
> Sorry the ignorance, how am i supposed to do it?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/JpaConsumer-endpoint-not-showing-up-in-hawtio-tp5789346p5789524.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: Zip all files available in folder - synchronously

2016-11-01 Thread Claus Ibsen
You cannot do this the aggregate is in 2 different threads.

Don't use the direct endpoint but do something different to trigger
the route to start and aggreage those files, and then get an event
when its done, which you can then use to know when the zip is ready.





On Mon, Oct 31, 2016 at 11:04 PM, Goyal, Arpit  wrote:
> Hi Colleagues,
>
> I want to read all file and aggregate into one single zip, but the batch 
> consumer always run in different thread. What needs to be done additionally 
> to get the response synchronously?
>
> Regards,
> Arpit.
>
>DefaultCamelContext c = new DefaultCamelContext();
> try {
>   c.addRoutes(new RouteBuilder() {
>
> @Override
> public void configure() throws Exception {
>   
> from("direct:start").from("file:/tmp/wiretap/6443391d-196a-4c75-b2f8-9c0696025b56/?include=.*=true=2500")
>   .aggregate(body(), new 
> CustomZipAggregationStrategy()).completionFromBatchConsumer().to("file:/tmp/wiretap/aggregate");
> }
>   });
>
>   ProducerTemplate template = c.createProducerTemplate();
>   c.start();
>   template.start();
>   template.requestBody("direct:start", "BEGIN"); //synchronously response 
> on completion of zip construction...
> } finally {
>   c.stop();
> }
>



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


Re: Camel-REST vs Cxfrs

2016-11-01 Thread Sergey Beryozkin

On 01/11/16 07:42, souciance wrote:

I guess it strictly depends on your requirements. If the REST DSL satisfy
your requirements and a POC shows it works for you it probably makes sense
to use it. I am not sure if there is such a condition as to always use one
above the other, unless off course the camel-cxfrs will be discontinued,
which I haven't heard.

I don't think it will be discontinued

Cheers, Sergey


On Mon, Oct 31, 2016 at 5:02 PM, DariusX [via Camel] <
ml-node+s465427n5789523...@n5.nabble.com> wrote:


I would like to expose some Camel routes via REST, and am considering
using the REST DSL. (I do not have  pre-existing REST-based web-service
components.)

Is there any reason/advantage to using camel-cxfrs or some other such
component that supports REST in such a scenario?

It appears to me that the Camel REST DSL is always the way to go unless
one has legacy reasons to use something else, but I'd appreciate someone
telling me if that's a wrong assumption. Also, is there a page somewhere on
the Camel site that would speak to this: i.e. the motivation of using one
over the other?

thanks

--
If you reply to this email, your message will be added to the discussion
below:
http://camel.465427.n5.nabble.com/Camel-REST-vs-Cxfrs-tp5789523.html
To start a new topic under Camel - Users, email
ml-node+s465427n465428...@n5.nabble.com
To unsubscribe from Camel - Users, click here

.
NAML







--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-REST-vs-Cxfrs-tp5789523p5789541.html
Sent from the Camel - Users mailing list archive at Nabble.com.





Re: camel 2.18.0 VM problem after update

2016-11-01 Thread Claus Ibsen
Hi

Maybe this bug fixes this
https://issues.apache.org/jira/browse/CAMEL-10406

You can build latest code and test with a SNAPSHOT version
http://camel.apache.org/building

On Mon, Oct 31, 2016 at 3:14 PM, Marvin  wrote:
> I updated my camel version from 2.15.2 to 2.18.0. I'm using the vm component
> to send messages through different contexts.
>
> After the update I got following exception:
>
> o.a.c.c.v.VmConsumer | Error processing exchange. Exchange[]. Caused by:
> [java.lang.NullPointerException - null]
> java.lang.NullPointerException: null
> at
> org.apache.camel.util.ExchangeHelper.isStreamCachingEnabled(ExchangeHelper.java:657)
> at
> org.apache.camel.converter.stream.OutputStreamBuilder.(OutputStreamBuilder.java:38)
> at
> org.apache.camel.converter.stream.OutputStreamBuilder.withExchange(OutputStreamBuilder.java:55)
> at
> org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:58)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>
> I've found out that the problem the corresponding context to which the
> exchange is set to is. It's using the route id of my vm enpoint and trying
> to get the route out of the original context of the exchange. But it cannot
> find the route because it isn't defined in the original context of the
> exchange.
>
> With the version 2.15.2 it's working fine.
>
> Does anyone have an idea how I can fix this?
>
> Thanks
>
> Marvin
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-2-18-0-VM-problem-after-update-tp5789519.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: Question on multicast to pipelines

2016-11-01 Thread Edoardo Causarano
Hi all,

these are the results I get, only the most explicit and verbose configuration 
returns the expected result. 

Working route: 
.pipeline().to("A").to("B").end()
.pipeline().to("C").to("D").end()

10:41:12.644 [main] INFO route1 - after direct:start body=START
10:41:12.666 [main] DEBUG org.apache.camel.processor.SendProcessor -  A 
Exchange[ID-Spitfire-local-50181-1477993271722-0-3]
10:41:12.667 [main] DEBUG com.esc.test.MulticastPipelinesTest - A got in=START
10:41:12.667 [main] DEBUG org.apache.camel.processor.SendProcessor -  B 
Exchange[ID-Spitfire-local-50181-1477993271722-0-3]
10:41:12.667 [main] DEBUG com.esc.test.MulticastPipelinesTest - B got in=A
10:41:12.670 [main] DEBUG org.apache.camel.processor.SendProcessor -  C 
Exchange[ID-Spitfire-local-50181-1477993271722-0-4]
10:41:12.671 [main] DEBUG com.esc.test.MulticastPipelinesTest - C got in=START
10:41:12.671 [main] DEBUG org.apache.camel.processor.SendProcessor -  D 
Exchange[ID-Spitfire-local-50181-1477993271722-0-4]
10:41:12.671 [main] DEBUG com.esc.test.MulticastPipelinesTest - D got in=C


Faulty routes:
.pipeline("A", "B")
.pipeline("C", "D”)

or 

.to("A", "B")
.to("C", "D")

10:43:46.383 [main] INFO route1 - after direct:start body=START
10:43:46.389 [main] DEBUG org.apache.camel.processor.SendProcessor -  A 
Exchange[ID-Spitfire-local-50316-1477993425625-0-3]
10:43:46.389 [main] DEBUG com.esc.test.MulticastPipelinesTest - A got in=START
10:43:46.390 [main] DEBUG org.apache.camel.processor.SendProcessor -  B 
Exchange[ID-Spitfire-local-50316-1477993425625-0-4]
10:43:46.390 [main] DEBUG com.esc.test.MulticastPipelinesTest - B got in=START
10:43:46.391 [main] DEBUG org.apache.camel.processor.SendProcessor -  C 
Exchange[ID-Spitfire-local-50316-1477993425625-0-5]
10:43:46.391 [main] DEBUG com.esc.test.MulticastPipelinesTest - C got in=START
10:43:46.391 [main] DEBUG org.apache.camel.processor.SendProcessor -  D 
Exchange[ID-Spitfire-local-50316-1477993425625-0-6]
10:43:46.391 [main] DEBUG com.esc.test.MulticastPipelinesTest - D got in=START


Best,
Edoardo

> On 31 Oct 2016, at 15:04, DariusX  wrote:
> 
> Your example was:
> multicast() 
>.pipeline("A", "B") 
>.pipeline("C", "D") 
> .end() 
> 
> You send "START" as the body to this. So, you should expect "START" to be
> the in.body for both "A" and "C".
> 
> The in body for "B" will depend on what "A" does. Example: if "A" transforms
> the body to a constant "Hello from A", then that is what "B" will get as its
> in.body.
> 
> Similarly, "D" will get whatever "C" decides to send along.
> 
> If neither A nor C make any changes to the body, then you should expect
> "START" to be the in.body for all four.
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Question-on-multicast-to-pipelines-tp5789396p5789518.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Camel-REST vs Cxfrs

2016-11-01 Thread souciance
I guess it strictly depends on your requirements. If the REST DSL satisfy
your requirements and a POC shows it works for you it probably makes sense
to use it. I am not sure if there is such a condition as to always use one
above the other, unless off course the camel-cxfrs will be discontinued,
which I haven't heard.

On Mon, Oct 31, 2016 at 5:02 PM, DariusX [via Camel] <
ml-node+s465427n5789523...@n5.nabble.com> wrote:

> I would like to expose some Camel routes via REST, and am considering
> using the REST DSL. (I do not have  pre-existing REST-based web-service
> components.)
>
> Is there any reason/advantage to using camel-cxfrs or some other such
> component that supports REST in such a scenario?
>
> It appears to me that the Camel REST DSL is always the way to go unless
> one has legacy reasons to use something else, but I'd appreciate someone
> telling me if that's a wrong assumption. Also, is there a page somewhere on
> the Camel site that would speak to this: i.e. the motivation of using one
> over the other?
>
> thanks
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-REST-vs-Cxfrs-tp5789523.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428...@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-REST-vs-Cxfrs-tp5789523p5789541.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Zip all files available in folder - synchronously

2016-11-01 Thread Goyal, Arpit
HI JB,

Can you elaborate a little. At least the code I have written below, I always 
see Aggregation happening in separate thread and not main-thread. 

And which method you mean by stopping condition? Tried 
completionFromBatchConsumer and completionSize, without any luck.

Regards,
Arpit.

-Original Message-
From: Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
Sent: Monday, October 31, 2016 11:14 PM
To: users@camel.apache.org
Subject: Re: Zip all files available in folder - synchronously

Hi Arpit,

The aggregate should work for that. All depends on the "stopping condition".

Regards
JB

On 10/31/2016 11:04 PM, Goyal, Arpit wrote:
> Hi Colleagues,
>
> I want to read all file and aggregate into one single zip, but the batch 
> consumer always run in different thread. What needs to be done additionally 
> to get the response synchronously?
>
> Regards,
> Arpit.
>
>DefaultCamelContext c = new DefaultCamelContext();
> try {
>   c.addRoutes(new RouteBuilder() {
>
> @Override
> public void configure() throws Exception {
>   
> from("direct:start").from("file:/tmp/wiretap/6443391d-196a-4c75-b2f8-9c0696025b56/?include=.*=true=2500")
>   .aggregate(body(), new 
> CustomZipAggregationStrategy()).completionFromBatchConsumer().to("file:/tmp/wiretap/aggregate");
> }
>   });
>
>   ProducerTemplate template = c.createProducerTemplate();
>   c.start();
>   template.start();
>   template.requestBody("direct:start", "BEGIN"); //synchronously response 
> on completion of zip construction...
> } finally {
>   c.stop();
> }
>
>

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Zip all files available in folder - synchronously

2016-11-01 Thread Jean-Baptiste Onofré

Hi Arpit,

The aggregate should work for that. All depends on the "stopping condition".

Regards
JB

On 10/31/2016 11:04 PM, Goyal, Arpit wrote:

Hi Colleagues,

I want to read all file and aggregate into one single zip, but the batch 
consumer always run in different thread. What needs to be done additionally to 
get the response synchronously?

Regards,
Arpit.

   DefaultCamelContext c = new DefaultCamelContext();
try {
  c.addRoutes(new RouteBuilder() {

@Override
public void configure() throws Exception {
  
from("direct:start").from("file:/tmp/wiretap/6443391d-196a-4c75-b2f8-9c0696025b56/?include=.*=true=2500")
  .aggregate(body(), new 
CustomZipAggregationStrategy()).completionFromBatchConsumer().to("file:/tmp/wiretap/aggregate");
}
  });

  ProducerTemplate template = c.createProducerTemplate();
  c.start();
  template.start();
  template.requestBody("direct:start", "BEGIN"); //synchronously response 
on completion of zip construction...
} finally {
  c.stop();
}




--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com