Re: Problem from Java DSL to Spring DSL

2013-05-15 Thread Claus Ibsen
On Wed, May 15, 2013 at 5:06 AM, Willem jiang willem.ji...@gmail.com wrote:
 Hi,

 I think you cannot use the constant of Exchange.FILE_NAME directly in the 
 Spring DSL.
 You should use the String directly like this

Yes you can. The DSL has special support for that so it makes
converting from java - xml easier.
But you should not have ${ } etc just do as you would do in Java DSL

 camel:setHeader headerName=Exchange.FILE_NAME

When a key starts with Exchange. then Camel checks if its a field from
the Exchange interface and uses its value.



 camel:setHeader headerName=CamelFileName/
 camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}/camel:constant


And btw use simple instead of constant. As constant is really just a
hardcoded fixed constant value. So if you want the current date, use
the simple language that has this function.


 --
 Willem Jiang

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Web: http://www.fusesource.com | http://www.redhat.com
 Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
 (English)
   http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
 Twitter: willemjiang
 Weibo: 姜宁willem





 On Wednesday, May 15, 2013 at 10:40 AM, Gary Liu wrote:

 Hello,

 I am trying to translate the following Java DSL (This is the example from
 2.10.4). The Java DSL works fine. But I after I translate to Spring DSL,
 several things are not working as expected. Would someone please help?
 Java DSL===
 from(cxf:bean:reportIncident)
 .convertBodyTo(InputReportIncident.class)
 .setHeader(Exchange.FILE_NAME,
 constant(request-${date:now:-MM-dd-HHmmssSSS}))
 .wireTap(file://target/inbox/)
 .choice().when(simple(${body.givenName} == 'Claus'))
 .transform(constant(ok))
 .otherwise()
 .bean(new ReportIncidentImpl(), doReportIncident)
 .transform(constant(accepted)

 );

 ===SPRING DSL===
 camel:camelContext id=camel


 camel:route
 camel:from uri=cxf:bean:reportIncident /
 camel:convertBodyTo
 type=org.apache.camel.example.reportincident.InputReportIncident /
 camel:setHeader headerName=${Exchange.FILE_NAME}

 camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}/camel:constant
 /camel:setHeader
 camel:wireTap uri=file://target/inbox//camel:wireTap
 camel:choice
 camel:when
 camel:simple${body.givenName} == 'Claus'/camel:simple
 camel:transform
 camel:constantOK/camel:constant
 /camel:transform
 /camel:when
 camel:otherwise
 camel:transform
 camel:constantAccepted/camel:constant
 /camel:transform
 /camel:otherwise
 /camel:choice
 /camel:route
 /camel:camelContext
 ===

 Here are the things I did not translate propertly:

 .choice().when(simple(${body.givenName} == 'Claus'))
 .transform(constant(ok))

 NOT THE SAME AS:
 camel:choice
 camel:when
 camel:simple${body.givenName} == 'Claus'/camel:simple
 camel:transform
 camel:constantOK/camel:constant
 /camel:transform
 /camel:when


 .setHeader(Exchange.FILE_NAME,
 constant(request-${date:now:-MM-dd-HHmmssSSS}))

 NOT THE SAME AS:

 camel:setHeader headerName=${Exchange.FILE_NAME}
 camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}

 Thanks,
 --Gary




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).






--
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: QueryParam value with (ampersand)

2013-05-15 Thread jamalissimo
Hi,

I will try to be more specific. This is how I call the service:

/path/to/service/upload?product=MyProductindex=0uploader=romanpathToFile=/path/to/my/fileWhichContainsinTheName.txtfolderId=1

When I try this URL I will get *java.lang.ArrayIndexOutOfBoundsException: 1*
error. 

-Thanks

Roman



--
View this message in context: 
http://camel.465427.n5.nabble.com/QueryParam-value-with-ampersand-tp5732487p5732574.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: QueryParam value with (ampersand)

2013-05-15 Thread Claus Ibsen
Use %26 to encode the 
http://en.wikipedia.org/wiki/Url_encode

And also can you paste the stacktrace?
And tell us which Camel version you use?

On Wed, May 15, 2013 at 8:34 AM, jamalissimo roman.janu...@gmail.com wrote:
 Hi,

 I will try to be more specific. This is how I call the service:

 /path/to/service/upload?product=MyProductindex=0uploader=romanpathToFile=/path/to/my/fileWhichContainsinTheName.txtfolderId=1

 When I try this URL I will get *java.lang.ArrayIndexOutOfBoundsException: 1*
 error.

 -Thanks

 Roman



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/QueryParam-value-with-ampersand-tp5732487p5732574.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


File component after polling should not move the file

2013-05-15 Thread Mohammad Shadab Ali
Hi,

I have a requirement where we want to poll a read-only directory using file 
component, so creating of .camel folder and moving of file to .camel folder 
will not be allowed. Is there an option available in file component that it 
should not move or delete the file from the polling directory.


Regards,
Shadab


*** This e-mail (and any attachments), is confidential and may be privileged. 
It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and 
disclosure or copying of its
contents or any action taken in reliance on it is unlawful. Unintended 
recipients must notify the sender immediately
by e-mail/phone  delete it from their system without making any copies or 
disclosing it to a third person.***

This e-mail (and any attachments), is confidential and may be privileged. It 
may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and 
disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended 
recipients must notify the sender immediately 
by e-mail/phone  delete it from their system without making any copies or 
disclosing it to a third person.



Re: File component after polling should not move the file

2013-05-15 Thread Claus Ibsen
Hi

Yes see the options in the consumer table at
http://camel.apache.org/file2

There is a noop option

On Wed, May 15, 2013 at 9:42 AM, Mohammad Shadab Ali
mohammad.a...@genpact.com wrote:
 Hi,

 I have a requirement where we want to poll a read-only directory using file 
 component, so creating of .camel folder and moving of file to .camel folder 
 will not be allowed. Is there an option available in file component that it 
 should not move or delete the file from the polling directory.


 Regards,
 Shadab

 
 *** This e-mail (and any attachments), is confidential and may be privileged. 
 It may be read, copied and used only
 by intended recipients. Unauthorized access to this e-mail (or attachments) 
 and disclosure or copying of its
 contents or any action taken in reliance on it is unlawful. Unintended 
 recipients must notify the sender immediately
 by e-mail/phone  delete it from their system without making any copies or 
 disclosing it to a third person.***

 This e-mail (and any attachments), is confidential and may be privileged. It 
 may be read, copied and used only
 by intended recipients. Unauthorized access to this e-mail (or attachments) 
 and disclosure or copying of its
 contents or any action taken in reliance on it is unlawful. Unintended 
 recipients must notify the sender immediately
 by e-mail/phone  delete it from their system without making any copies or 
 disclosing it to a third person.




-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: How to create a generic SOAP consumer?

2013-05-15 Thread Smith-John
Hi,

I'm using Equinox.

Regards.



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732584.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Using pre-allocated Exchange with Proxy

2013-05-15 Thread helander
When I use a camel proxy, e.g. via a ProxyBuilder, I have not found any way
that my proxy client could inject additional (properties or message headers)
to the Exchange that will be used. The things I would like to inject is only
available at the client so it cant't be injected further down the route. Is
there some known solution to this?

Another option for me could be to create a processer that creates the same
type of BeanInvocation as the Proxy creates (using the in ,message to input
parameters).
In the Camel sources I can probably find code fragments that could help me
do this, but I do not want to depend on things that will not be supported by
the APIs long term. Is there some way that I can create a processor like
this using classes/methods from the public API?

Thanks

Lars



--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-pre-allocated-Exchange-with-Proxy-tp5732587.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Passing a list of parameters in SQL endpoint

2013-05-15 Thread Shishir
We are using IN clause and need to supply  , delimited list of values to
the query.

So we have used a single # and the expectation is that, the entire list
should be replaced. 

Tried to pass # as String String list, named parameter, but it seems camel
breaks every , in value and try to find that many number of # in the
query. Quite sure missing something basic.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Passing-a-list-of-parameters-in-SQL-endpoint-tp5732583.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: ProducerTemplate with Redelivery Policy

2013-05-15 Thread Darwish
Thanks Claus , i start new route ( from direct point ) and mark that route as
transacted ( require new ) ,
i expect that each exchange will commit when the new route end successfully
,but that not happening!, when i used seda point , its commit each exchange
individually .

is this normal ?


 



-
Othman Darwish
ProgressSoft Corp.

--
View this message in context: 
http://camel.465427.n5.nabble.com/ProducerTemplate-with-Redelivery-Policy-tp5732178p5732588.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Logging cause of failure with deadLetterChannel error handler?

2013-05-15 Thread Peter Hilton
On 14 May 2013, at 18:10, Peter Hilton pedro+ca...@lunatech.com wrote:
   …
 
   val deadLetterErrorHandler = 
 deadLetterChannel(failureEndpoint).disableRedelivery()
   deadLetterErrorHandler.setFailureProcessor(ErrorProcessor())
   errorHandler(deadLetterErrorHandler)
 
 This is okay, but I would prefer to encapsulate all of the above in a single 
 component that I can then give to errorHandler(…) for every route builder.

Correction: this error handler doesn't work. The ErrorProcessor logs the 
failure as expected, but the message file is not moved to the dead letter 
failure endpoint :(

Perhaps it’s possible to use a dead letter endpoint and handle the exception 
separately logging…

errorHandler(deadLetterChannel(failureEndpoint).disableRedelivery())

…

hanlde[Exception] {
// Log error…
…

Peter

RE: File component after polling should not move the file

2013-05-15 Thread Mohammad Shadab Ali
Thanks a lot Claus it works.

Another doubt:
I want to poll files having specific name pattern, say  XMLINCF1, i.e. I want 
to poll only those files having XMLINCF1 string in filename.
Please suggest.



-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com]
Sent: Wednesday, May 15, 2013 1:31 PM
To: users@camel.apache.org
Subject: Re: File component after polling should not move the file

Hi

Yes see the options in the consumer table at
http://camel.apache.org/file2

There is a noop option

On Wed, May 15, 2013 at 9:42 AM, Mohammad Shadab Ali 
mohammad.a...@genpact.com wrote:
 Hi,

 I have a requirement where we want to poll a read-only directory using file 
 component, so creating of .camel folder and moving of file to .camel folder 
 will not be allowed. Is there an option available in file component that it 
 should not move or delete the file from the polling directory.


 Regards,
 Shadab

 
 *** This e-mail (and any attachments), is confidential and may be
 privileged. It may be read, copied and used only by intended
 recipients. Unauthorized access to this e-mail (or attachments) and
 disclosure or copying of its contents or any action taken in reliance
 on it is unlawful. Unintended recipients must notify the sender
 immediately by e-mail/phone  delete it from their system without
 making any copies or disclosing it to a third person.***

 This e-mail (and any attachments), is confidential and may be
 privileged. It may be read, copied and used only by intended
 recipients. Unauthorized access to this e-mail (or attachments) and
 disclosure or copying of its contents or any action taken in reliance on it 
 is unlawful. Unintended recipients must notify the sender immediately by 
 e-mail/phone  delete it from their system without making any copies or 
 disclosing it to a third person.





--
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

*** This e-mail (and any attachments), is confidential and may be privileged. 
It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and 
disclosure or copying of its
contents or any action taken in reliance on it is unlawful. Unintended 
recipients must notify the sender immediately
by e-mail/phone  delete it from their system without making any copies or 
disclosing it to a third person.***
This e-mail (and any attachments), is confidential and may be privileged. It 
may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and 
disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended 
recipients must notify the sender immediately 
by e-mail/phone  delete it from their system without making any copies or 
disclosing it to a third person.



Re: File component after polling should not move the file

2013-05-15 Thread Claus Ibsen
Hi

Look at the other options on that link. There is options to include
files using a regular exp pattern, eg such as

include=.* XMLINCF1.*



On Wed, May 15, 2013 at 12:31 PM, Mohammad Shadab Ali
mohammad.a...@genpact.com wrote:
 Thanks a lot Claus it works.

 Another doubt:
 I want to poll files having specific name pattern, say  XMLINCF1, i.e. I 
 want to poll only those files having XMLINCF1 string in filename.
 Please suggest.



 -Original Message-
 From: Claus Ibsen [mailto:claus.ib...@gmail.com]
 Sent: Wednesday, May 15, 2013 1:31 PM
 To: users@camel.apache.org
 Subject: Re: File component after polling should not move the file

 Hi

 Yes see the options in the consumer table at
 http://camel.apache.org/file2

 There is a noop option

 On Wed, May 15, 2013 at 9:42 AM, Mohammad Shadab Ali 
 mohammad.a...@genpact.com wrote:
 Hi,

 I have a requirement where we want to poll a read-only directory using file 
 component, so creating of .camel folder and moving of file to .camel folder 
 will not be allowed. Is there an option available in file component that it 
 should not move or delete the file from the polling directory.


 Regards,
 Shadab

 
 *** This e-mail (and any attachments), is confidential and may be
 privileged. It may be read, copied and used only by intended
 recipients. Unauthorized access to this e-mail (or attachments) and
 disclosure or copying of its contents or any action taken in reliance
 on it is unlawful. Unintended recipients must notify the sender
 immediately by e-mail/phone  delete it from their system without
 making any copies or disclosing it to a third person.***

 This e-mail (and any attachments), is confidential and may be
 privileged. It may be read, copied and used only by intended
 recipients. Unauthorized access to this e-mail (or attachments) and
 disclosure or copying of its contents or any action taken in reliance on it 
 is unlawful. Unintended recipients must notify the sender immediately by 
 e-mail/phone  delete it from their system without making any copies or 
 disclosing it to a third person.





 --
 Claus Ibsen
 -
 www.camelone.org: The open source integration conference.

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen

 *** This e-mail (and any attachments), is confidential and may be privileged. 
 It may be read, copied and used only
 by intended recipients. Unauthorized access to this e-mail (or attachments) 
 and disclosure or copying of its
 contents or any action taken in reliance on it is unlawful. Unintended 
 recipients must notify the sender immediately
 by e-mail/phone  delete it from their system without making any copies or 
 disclosing it to a third person.***
 This e-mail (and any attachments), is confidential and may be privileged. It 
 may be read, copied and used only
 by intended recipients. Unauthorized access to this e-mail (or attachments) 
 and disclosure or copying of its
 contents or any action taken in reliance on it is unlawful. Unintended 
 recipients must notify the sender immediately
 by e-mail/phone  delete it from their system without making any copies or 
 disclosing it to a third person.





-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Making a route depend on multiple criteria

2013-05-15 Thread cwhistler
I'm a bit concerned about performance and memory management with enriching
the existing route.  That would in effect hold 2 files in memory wouldn't
it?

I think I will just configure that last route but not start it.  I'll use
the onCompletion API on the third route to start the fourth route.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Making-a-route-depend-on-multiple-criteria-tp5732515p5732602.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: File component after polling should not move the file

2013-05-15 Thread Mohammad Shadab Ali
Thanks a ton Claus it works :)

-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com]
Sent: Wednesday, May 15, 2013 4:53 PM
To: users@camel.apache.org
Subject: Re: File component after polling should not move the file

Hi

Look at the other options on that link. There is options to include files using 
a regular exp pattern, eg such as

include=.* XMLINCF1.*



On Wed, May 15, 2013 at 12:31 PM, Mohammad Shadab Ali 
mohammad.a...@genpact.com wrote:
 Thanks a lot Claus it works.

 Another doubt:
 I want to poll files having specific name pattern, say  XMLINCF1, i.e. I 
 want to poll only those files having XMLINCF1 string in filename.
 Please suggest.



 -Original Message-
 From: Claus Ibsen [mailto:claus.ib...@gmail.com]
 Sent: Wednesday, May 15, 2013 1:31 PM
 To: users@camel.apache.org
 Subject: Re: File component after polling should not move the file

 Hi

 Yes see the options in the consumer table at
 http://camel.apache.org/file2

 There is a noop option

 On Wed, May 15, 2013 at 9:42 AM, Mohammad Shadab Ali 
 mohammad.a...@genpact.com wrote:
 Hi,

 I have a requirement where we want to poll a read-only directory using file 
 component, so creating of .camel folder and moving of file to .camel folder 
 will not be allowed. Is there an option available in file component that it 
 should not move or delete the file from the polling directory.


 Regards,
 Shadab

 
 *** This e-mail (and any attachments), is confidential and may be
 privileged. It may be read, copied and used only by intended
 recipients. Unauthorized access to this e-mail (or attachments) and
 disclosure or copying of its contents or any action taken in reliance
 on it is unlawful. Unintended recipients must notify the sender
 immediately by e-mail/phone  delete it from their system without
 making any copies or disclosing it to a third person.***

 This e-mail (and any attachments), is confidential and may be
 privileged. It may be read, copied and used only by intended
 recipients. Unauthorized access to this e-mail (or attachments) and
 disclosure or copying of its contents or any action taken in reliance on it 
 is unlawful. Unintended recipients must notify the sender immediately by 
 e-mail/phone  delete it from their system without making any copies or 
 disclosing it to a third person.





 --
 Claus Ibsen
 -
 www.camelone.org: The open source integration conference.

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen

 *** This e-mail (and any attachments), is confidential and may be
 privileged. It may be read, copied and used only by intended
 recipients. Unauthorized access to this e-mail (or attachments) and
 disclosure or copying of its contents or any action taken in reliance
 on it is unlawful. Unintended recipients must notify the sender
 immediately by e-mail/phone  delete it from their system without
 making any copies or disclosing it to a third person.*** This e-mail
 (and any attachments), is confidential and may be privileged. It may be read, 
 copied and used only by intended recipients. Unauthorized access to this 
 e-mail (or attachments) and disclosure or copying of its contents or any 
 action taken in reliance on it is unlawful. Unintended recipients must notify 
 the sender immediately by e-mail/phone  delete it from their system without 
 making any copies or disclosing it to a third person.





--
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

*** This e-mail (and any attachments), is confidential and may be privileged. 
It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and 
disclosure or copying of its
contents or any action taken in reliance on it is unlawful. Unintended 
recipients must notify the sender immediately
by e-mail/phone  delete it from their system without making any copies or 
disclosing it to a third person.***
This e-mail (and any attachments), is confidential and may be privileged. It 
may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and 
disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended 
recipients must notify the sender immediately 
by e-mail/phone  delete it from their system without making any copies or 
disclosing it to a third person.



Re: How to create a generic SOAP consumer?

2013-05-15 Thread Smith-John
Hi,

I'm using Equinox.

I checked all my bundles for exporting javax.xml.ws.
But I only found one: jaxws-api-osgi2.2.8.jar. This was added because
cxf-rt-frontend-jaxws-2.7.3.jar needed the javax.xml.ws things.

But I found out that javax.xml.ws is already part of the system library (I'm
using jdk 1.6). 
Can this trigger the problem? If yes, how can I fix this?



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732606.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Query on Multiple Producers one consumer (use of throttling)

2013-05-15 Thread deepak_a
Hi, 

In our system, Camel produces JMS messages from integrated endpoints, which
are consumed by EJB MDBs.   
The EJB application in-turn produces new JMS messages, which are consumed by
Camel to send to other integrated endpoints (eg. WebSphere MQ).   
We use transacted routes, and Atomikos as XA transaction coordinator. 
ActiveMQ 5.6.0, Camel 2.9.0. 

At most only one Queue can be mapped to a single EJB MDB. 

So effectively each EJB consumes messages from a Queue - to which multiple
camel routes (publishers) have published messages. 

I want to ensure that each producer(s) have the same level of priority in
publishing to the Queue. 
i.e. Assume - I have 3 producers, I don't want a scenario where Producer 1
and Producer 2 publish 1000 messages each followed by Producer 3. This will
result in the EJB MDB consuming messages produced by Producer 3 only after
previous 2000 messages. 

I have tried using throttling
http://camel.apache.org/throttler.html

But a concern is that the rate of throttling depends on how quickly the
messages are processed (by the consumer), if throttling is too slow and you
waste throughput.  Too fast and you risk producer flooding the
message-broker.

Is it possible to have a Camel route which does round-robin from 1 or more
JMS queues?

regards
D


regards 
D



--
View this message in context: 
http://camel.465427.n5.nabble.com/Query-on-Multiple-Producers-one-consumer-use-of-throttling-tp5732608.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Solved: Logging cause of failure with deadLetterChannel error handler?

2013-05-15 Thread Peter Hilton
On 14 May 2013, at 18:10, Peter Hilton pedro+ca...@lunatech.com wrote:
 I have a route that takes a file, parses it and then sends JSON to a web 
 service. If the Camel processor that parses the file throws a parse 
 exception, the configured error handler moves the file to the dead letter 
 endpoint. This much works.
 
   errorHandler(deadLetterChannel(failureEndpoint).disableRedelivery())
 
 However, I *also* want to log an error with the parse exception that the 
 parser throws. How should I do this?

I now have something that works.

After reading enough of the Scala DSL unit tests, I added the following to my 
route builder:

handle[Exception] {
  log(LoggingLevel.ERROR, ${id} ${exception})
  to(failureEndpoint)
}.handled

It doesn't appear to be necessary to call maximumRedeliveries(0) on handle, 
since I don't get retries when I do this.

This is not ideal because I would prefer this to be a single statement, e.g. 
using a custom component, to be able to customise the log output, and to 
include the stack trace. I may get to those things, but I've run out of time 
for now.

Peter

Removing route stops other routes from the same producer

2013-05-15 Thread ikoblik
Hi All,

I'm having problems with vm: in multicast mode where if I stop one of the
routes it will stop all the routes in the same MulticastProcessor.

I've attached a test file that reproduces this. Normally you should see 100
messages being printed to stdout. I noticed that after removing route2 if I
stop the route1 and then start it again then its consumers will receive the
messages. I think that the culprit is in SedaEndpoint line 144, when
stopping route2 it stops MulticastProcessor with all its services which
includes those from route1.

CamelTest.java
http://camel.465427.n5.nabble.com/file/n5732616/CamelTest.java  

I'm using V2.11.0.

Thank you for your help!
Ivan.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Removing-route-stops-other-routes-from-the-same-producer-tp5732616.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem from Java DSL to Spring DSL

2013-05-15 Thread Gary Liu
Thanks Claus! The following code works.

camel:setHeader headerName=Exchange.FILE_NAME

camel:constantrequest-${date:now:-MM-dd-HHmmssSSS}/camel:constant
/camel:setHeader


I still don't understand how the following Java DSL works, i mean
transform part :
from(cxf:bean:reportIncident)
.convertBodyTo(InputReportIncident.class)
.setHeader(Exchange.FILE_NAME,
constant(request-${date:now:-MM-dd-HHmmssSSS}))
.wireTap(file://target/inbox/)
.choice().when(simple(${body.givenName} == 'Claus'))
.transform(constant(ok))
.otherwise()
.bean(new ReportIncidentImpl(), doReportIncident)
.transform(constant(accepted)

);


To me transform(constant(ok)) will return a string ok, but client is
expect OutputReportIncident. Of course, the Java DSL works, and my
translation of Spring DSL did not work. Why?

I created a bean:
@Override
@WebResult(name = outputReportIncident, targetNamespace =
http://reportincident.example.camel.apache.org;, partName = out)
@WebMethod(action =
http://reportincident.example.camel.apache.org/ReportIncident;)
public OutputReportIncident doReportIncident(
@WebParam(partName = in, name = 
inputReportIncident, targetNamespace
= http://reportincident.example.camel.apache.org;) InputReportIncident in)
{
// TODO Auto-generated method stub

System.out.println(===);
System.out.println(in.familyName);
//  in.setGivenName(IChangeIt);
OutputReportIncident output = new OutputReportIncident();
if(in.getGivenName().equalsIgnoreCase(Claus)){
output.setCode(OK);
} else {
output.setCode(Accepted);
}
return output;
}

That works.

What have I missed?

Thanks,
--Gary





--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558p5732613.html
Sent from the Camel - Users mailing list archive at Nabble.com.


stream:file closeOnDone not close all time

2013-05-15 Thread Jean Francois LE BESCONT
Hey !

A new option is available for the stream:file to close it when done
(closeOnDone). This option is appeared in 2.11 after my jira (
https://issues.apache.org/jira/browse/CAMEL-6147)

File unlock (or released or closed) looks to doesn't works fine if last
line is not passed to the endpoint

Example :

We have a CSV with X line. We want to write a part of it in a file
out_1.csv and a second part in a file out_2.csv according to a business
rule, in my example the rule is after two lines readed.

An example is :

from(file://C:/Temp/camel/rep1/?noop=true)
.log(start process file = ${file:name})
.split()
.tokenize(\n)
.streaming()
.process(new Processor() {

public void process(Exchange exchange) throws Exception {
   // After 2 lines, next lines are rejected via an exchange
property
   i++ ;
   if( i   2)  {
   exchange.setProperty(FILE_1, true );
   } else {
   exchange.setProperty(FILE_1, false);
   }
}
   })
   .choice()
   .when(property(FILE_1).isEqualTo(Boolean.TRUE))

 .to(stream:file?fileName=C:/Temp/camel/rep1/out/out_1.csvcloseOnDone=true)
   .when(property(FILE_2).isEqualTo(Boolean.TRUE))

.to(stream:file?fileName=C:/Temp/camel/rep1/out/out_2.csvcloseOnDone=true)
   .end()
.end()
.log(end process file = ${file:name})
.end()
;

It create two files, and out_1.csv is still locked.

Should I update the jira or open a new ?

Thanks

Jeff


Exception Handling Scenario - Suggestions Needed

2013-05-15 Thread Jothi
Camel Users:

I have the following route:

from(activemq:{{in.queue}})
.process(new MyInputProcessor())
.beanRef(myBeanProcessor)
.process(new MyOutputProcessor())
.to(activemq:{{out.queue}});
  
In my beanRef, I change the body of the Exchange to a different type after
processing the incoming message from the Exchange (from the activemq queue).
In my route I have the following defined for the exception handling:

onException(Exception.class).maximumRedeliveries(0)
.useOriginalMessage()
.process(exceptionHandler)
.convertBodyTo(String.class)
.wireTap(activemq:alert);

My requirement is that if in my myBeanProcessor, any Exception occurs, I
need to handle it differently in the sense that I cannot use the
.useOriginalMessage(), but rather, I need to get the actual body in the
exchange after the MyInputProcessor() has run (which I already know), and
then do some processing, and then I need to send it to the exceptionHandler.
But this time when I send it to the exceptionHandler, I need to get the
original message that I got from the activemq:{{in.queue}}.

Here is what I have so far:


onException(Exception.class).maximumRedeliveries(0).useOriginalMessage()
// When I use this, simple(${body} is com.test.generated.MyType) is
evaluated to false
.choice()
.when(simple(${body} is com.test.generated.MyType))
.log(LoggingLevel.INFO, getClass().getName(),
ExceptionHandling: Routing to direct:sendErrorResponse
route).to(direct:sendErrorResponse)
.otherwise()
.log(LoggingLevel.INFO, getClass().getName(),
ExceptionHandling: Routing to direct:handleExceptionHandler) route)

.to(direct:handleExceptionHandler).routeId(exceptionHandler);

// If an exception occurs during the creation of TradeBuilder xml
from(direct:sendErrorResponse)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
MyType myType = exchange.getIn().getBody(MyType.class);
// Get and set values into another object
MyResponseType resp = new 
MyResponseType();
resp.setField1(myType.getField1());
resp.setField2(...);
resp.setField3(...);
exchange.getIn().setBody(resp);
}
})
.marshal(jaxb).
.to(activemq:{{out.queue}})
// Send it also to the exceptionHandler appender
.to(direct:handleExceptionHandler).routeId(responseHandler);

from(direct:handleExceptionHandler) // I always want to use the
original message that I get from the in.queue in my route above
.process(new ExceptionHandler())
.convertBodyTo(String.class)
.wireTap(activemq:alert);

Any suggestions?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-Handling-Scenario-Suggestions-Needed-tp5732623.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Why do Camel core methods still throw Checked Exceptions (everyone agrees they're 'bad' now, right?)

2013-05-15 Thread Hadrian Zbarcea

FWIW, +1 Pat (my personal opinion).
My explanation, legacy stuff. Hopefully it'll be addressed in 3.0. 
Backward compatibility will really be a serious issue.


Hadrian


On 05/15/2013 01:57 PM, pmcb55 wrote:

Hi Christian,

Thanks for the reply.

Basically the issue with Camel throwing Checked Exceptions is that my code
now has to declare those Checked Exceptions, which I concern just 'noise'
(i.e. they add no value to my code, and now my Unit tests are infected with
'throws Exception' clauses that they really shouldn't care about, and my
methods to initialise Camel need unhelpful try{}/catch{} blocks). But just
like Hibernate, all these exceptions are really 'fatal' errors that my
application can't handle anyway, and so should propagate all the way up (and
like you say, if 'process()' throws *any* kind of exception, it will be
caught by 'onException()' anyway). So as Joshua Bloch states in the famous
'Effective Java' book, only use Checked Exceptions for things your app can
be expected to be able to handle.

Again, I'd read the link I sent about Checked Exceptions being 'dead' in
Java development to really understand where I'm coming from
(http://jyops.blogspot.ie/2012/03/why-should-you-use-unchecked-exceptions.html).
(And ok, ok, lots of people will still probably cling to them, but for
frameworks like Hibernate and Camel I really don't see that they add any
value at all over Unchecked Exceptions).

So maybe this issue just never arose before, and I'll just go ahead and wrap
my Camel calls in utility methods that convert any checked exceptions to
unchecked ones - it's no big deal for me to do this, but I think it may be
worth the Camel community looking at the issue (like the Hibernate guys
did).

Cheers,

Pat.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-do-Camel-core-methods-still-throw-Checked-Exceptions-everyone-agrees-they-re-bad-now-right-tp5732364p5732627.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: What is the best approach to do an asynchronous rendezvous?

2013-05-15 Thread Raul Kripalani
Hi Chris,

I like this kind of problems ;-) Do these two messages share a correlation
key?

If yes, you can create a bean which acts like a Repository, accumulating
message bodies or Exchanges under the correlation key. Could be implemented
using Guava's MultiMap, or a DB if you need durable persistence, or a
distributed cache if you require clustering without persistence.

When a message arrives, you query the Repository for a previous message
with the same correlation key. If it exists, you pick it up, do whatever
manipulation is needed, and release the 3rd event. Kind of like a
CyclicBarrier that stores the messages for later usage.

P.S.: You could consider using the Aggregator EIP, but it'll block a thread
until the 2nd event comes through.

Regards,

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Wed, May 15, 2013 at 6:56 PM, Chris Wolf cwolf.a...@gmail.com wrote:

 In my process, I have two events that must be completed before the
 third can proceed.
 One event is the arrival of a certain JMS message and the other is the
 arrival of
 a certain file type.  The problem is, I cannot represent this in a
 route pipeline because
 one event may occur before the other and it's totally random from one
 run to another.

 In the abstract, I'm thinking one of the EIP patterns, either
 resequencer or scatter-gather
 applies, but I'm not certain how to do this in a concrete way with
 Camel.  If anyone has
 ideas, that would be great...

 Thanks,


 Chris



Re: What is the best approach to do an asynchronous rendezvous?

2013-05-15 Thread Chris Wolf
Raúl,

Thanks for your ideas.  Now it's 3 events without guaranteed order to
arrive before triggering the fourth event.  As for correlation key, I
guess it would be customer-id plus a timestamp
that shows the event happened in the last several hours.

The more I look into it, the more it seems like the Camel resequencer
process may apply
here:  http://camel.apache.org/resequencer.html

The thing is, I'm not sure about setting batch size and/or timeout.
The documentation
states:

...messages are collected into a batch, either by a maximum number of
messages per batch or using a timeout...

So it seems I would set batch size to 3 in my case, but our process is
supporting
multiple customers, so really, it's 3 predecessor events *per customer*.  Also,
I think I would need persistent state in the even of a crash.
Although I'd like to
avoid it, I can't help thinking I may have to implement yet another custom
Processor to support this use case.  (I already had to implement a custom
SFTP Processor to handle dynamic endpoint settings based on the customer-id).

I know that Camel is intended for ETL-ish sorts of problems, but I
think the Camel
approach is also appropriate for interactive, online processing, but
in that case,
it would be really helpful if endpoint configurations had the
additional dimension
of settings/configs indexed by id (such as customer-id, user-id,
account-id, etc.)

I could be wrong, but it seems that the static URI way of configuring endpoints
doesn't scale to process-flow/per-identity.  Those endpoints that do take
expressions help in this regard, but not all of them work with
expression-language
configuration, e.g. SFTP Consumer.

Thanks,

Chris

On Wed, May 15, 2013 at 3:46 PM, Raul Kripalani r...@evosent.com wrote:
 Hi Chris,

 I like this kind of problems ;-) Do these two messages share a correlation
 key?

 If yes, you can create a bean which acts like a Repository, accumulating
 message bodies or Exchanges under the correlation key. Could be implemented
 using Guava's MultiMap, or a DB if you need durable persistence, or a
 distributed cache if you require clustering without persistence.

 When a message arrives, you query the Repository for a previous message
 with the same correlation key. If it exists, you pick it up, do whatever
 manipulation is needed, and release the 3rd event. Kind of like a
 CyclicBarrier that stores the messages for later usage.

 P.S.: You could consider using the Aggregator EIP, but it'll block a thread
 until the 2nd event comes through.

 Regards,

 *Raúl Kripalani*
 Enterprise Architect, Open Source Integration specialist, Program
 Manager | Apache
 Camel Committer
 http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
 http://blog.raulkr.net | twitter: @raulvk

 On Wed, May 15, 2013 at 6:56 PM, Chris Wolf cwolf.a...@gmail.com wrote:

 In my process, I have two events that must be completed before the
 third can proceed.
 One event is the arrival of a certain JMS message and the other is the
 arrival of
 a certain file type.  The problem is, I cannot represent this in a
 route pipeline because
 one event may occur before the other and it's totally random from one
 run to another.

 In the abstract, I'm thinking one of the EIP patterns, either
 resequencer or scatter-gather
 applies, but I'm not certain how to do this in a concrete way with
 Camel.  If anyone has
 ideas, that would be great...

 Thanks,


 Chris



Re: What is the best approach to do an asynchronous rendezvous?

2013-05-15 Thread Raul Kripalani
Let me try and understand the timeline of these events. I will call a
logical grouping of events event batch.
If you don't mind answering the following questions, I can assist better:

   - How many batches per day will you receive per customer?
   - Can the event batches interleave?
   - What identifies a concrete batch of events?
   - Do you have a finite list of customers? (and customer ids?)
   - What is the payload of the fourth event? Am I right asserting that you
   receive 3 raw events, and you build some sort of composite or merged
   message and release it as the 4th event?

Regards,

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Wed, May 15, 2013 at 9:30 PM, Chris Wolf cwolf.a...@gmail.com wrote:

 Raúl,

 Thanks for your ideas.  Now it's 3 events without guaranteed order to
 arrive before triggering the fourth event.  As for correlation key, I
 guess it would be customer-id plus a timestamp
 that shows the event happened in the last several hours.

 The more I look into it, the more it seems like the Camel resequencer
 process may apply
 here:  http://camel.apache.org/resequencer.html

 The thing is, I'm not sure about setting batch size and/or timeout.
 The documentation
 states:

 ...messages are collected into a batch, either by a maximum number of
 messages per batch or using a timeout...

 So it seems I would set batch size to 3 in my case, but our process is
 supporting
 multiple customers, so really, it's 3 predecessor events *per customer*.
  Also,
 I think I would need persistent state in the even of a crash.
 Although I'd like to
 avoid it, I can't help thinking I may have to implement yet another custom
 Processor to support this use case.  (I already had to implement a custom
 SFTP Processor to handle dynamic endpoint settings based on the
 customer-id).

 I know that Camel is intended for ETL-ish sorts of problems, but I
 think the Camel
 approach is also appropriate for interactive, online processing, but
 in that case,
 it would be really helpful if endpoint configurations had the
 additional dimension
 of settings/configs indexed by id (such as customer-id, user-id,
 account-id, etc.)

 I could be wrong, but it seems that the static URI way of configuring
 endpoints
 doesn't scale to process-flow/per-identity.  Those endpoints that do take
 expressions help in this regard, but not all of them work with
 expression-language
 configuration, e.g. SFTP Consumer.

 Thanks,

 Chris

 On Wed, May 15, 2013 at 3:46 PM, Raul Kripalani r...@evosent.com wrote:
  Hi Chris,
 
  I like this kind of problems ;-) Do these two messages share a
 correlation
  key?
 
  If yes, you can create a bean which acts like a Repository, accumulating
  message bodies or Exchanges under the correlation key. Could be
 implemented
  using Guava's MultiMap, or a DB if you need durable persistence, or a
  distributed cache if you require clustering without persistence.
 
  When a message arrives, you query the Repository for a previous message
  with the same correlation key. If it exists, you pick it up, do whatever
  manipulation is needed, and release the 3rd event. Kind of like a
  CyclicBarrier that stores the messages for later usage.
 
  P.S.: You could consider using the Aggregator EIP, but it'll block a
 thread
  until the 2nd event comes through.
 
  Regards,
 
  *Raúl Kripalani*
  Enterprise Architect, Open Source Integration specialist, Program
  Manager | Apache
  Camel Committer
  http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
  http://blog.raulkr.net | twitter: @raulvk
 
  On Wed, May 15, 2013 at 6:56 PM, Chris Wolf cwolf.a...@gmail.com
 wrote:
 
  In my process, I have two events that must be completed before the
  third can proceed.
  One event is the arrival of a certain JMS message and the other is the
  arrival of
  a certain file type.  The problem is, I cannot represent this in a
  route pipeline because
  one event may occur before the other and it's totally random from one
  run to another.
 
  In the abstract, I'm thinking one of the EIP patterns, either
  resequencer or scatter-gather
  applies, but I'm not certain how to do this in a concrete way with
  Camel.  If anyone has
  ideas, that would be great...
 
  Thanks,
 
 
  Chris
 



Re: Camel-mongodb with Scala and JndiRegistry

2013-05-15 Thread Sven Richter
Well, like i said i am fairly new, instead of using val for variables
i used def, which is a very stupid mistake.
This code works:
  val reg = new SimpleRegistry()
  val connectionBean = new Mongo(localhost, 27017)
  reg.put(myConnection, connectionBean)
  val camelContext = new DefaultCamelContext(reg)
  camelContext.addRoutes(new RssRouteBuilder)
  camelContext.start

Best Regards,
Sven

On Mon, May 13, 2013 at 4:40 PM, Sven Richter sver...@googlemail.com wrote:
 Hi,

 i am fairly new to camel and scala and try to get the hang of it. For
 this i want to write a small scala application which takes some input
 and writes it into a mongodb database.
 Looking at the camel-mongodb documentation i see i have to define a
 Mongo bean somewhere in my application so that camel can connect to
 it. This is my code which tries to achieve this:
 // application
   def createDefaultContextJndiRegistry(): DefaultCamelContext = {
 def reg = new JndiRegistry(new JndiContext())
 def connectionBean = new Mongo(localhost, 27017)
 reg.bind(myConnection, connectionBean)
 def context = new DefaultCamelContext(reg)

 context
   }

   camelContext.addRoutes(new RssRouteBuilder)
   camelContext.start

 //rssRouteBuilder
 class RssRouteBuilder() extends RouteBuilder{
   def configure(){
 
 from(direct:insert).to(log:de.sveri.talk.rss?level=DEBUG).to(mongodb:myConnection?database=talkcollection=rssoperation=insert)
   }
 }

 When i execute that code i get an error message [1] saying that it
 cannot find myConnection. So i guess i dont use the JndiRegistry in
 the right way. I also tried to use the SimpleRegistry, but that threw
 the same error.
 So my question is basically how to use the Registry and camel-mongodb
 when i dont use spring.

 Best Regards,
 Sven

 [1]
 Exception in thread main
 org.apache.camel.FailedToCreateRouteException: Failed to create route
 route2 at:  
 To[mongodb:myConnection?database=talkcollection=rssoperation=insert]
  in route: Route(route2)[[From[direct:insert]] -
 [To[log:de.sveri.talk... because of Failed to resolve endpoint:
 mongodb://myConnection?collection=rssdatabase=talkoperation=insert
 due to: No bean could be found in the registry for: myConnection of
 type: com.mongodb.Mongo
 at 
 org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:883)
 at 
 org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:176)
 at 
 org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:750)
 at 
 org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1829)
 at 
 org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1609)
 at 
 org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1478)
 at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
 at 
 org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1446)
 at de.sveri.talk.Server$delayedInit$body.apply(Server.scala:61)
 at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
 at 
 scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
 at scala.App$$anonfun$main$1.apply(App.scala:71)
 at scala.App$$anonfun$main$1.apply(App.scala:71)
 at scala.collection.immutable.List.foreach(List.scala:318)
 at 
 scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
 at scala.App$class.main(App.scala:71)
 at de.sveri.talk.Server$.main(Server.scala:11)
 at de.sveri.talk.Server.main(Server.scala)
 Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
 resolve endpoint:
 mongodb://myConnection?collection=rssdatabase=talkoperation=insert
 due to: No bean could be found in the registry for: myConnection of
 type: com.mongodb.Mongo
 at 
 org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:508)
 at 
 org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:62)
 at 
 org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:191)
 at 
 org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108)
 at 
 org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:114)
 at 
 org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:61)
 at 
 org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:55)
 at 
 org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:479)
 at 
 org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:197)
 at 
 org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:880)
 ... 17 more
 Caused by: org.apache.camel.NoSuchBeanException: No bean could be
 found in the registry for: myConnection of type: com.mongodb.Mongo
 at 
 

Re: when calling ejb cliiebt using ejb component of camel two string parameter method is called but in ejb the parameter'svalue is not printed instead string class (type of parameter)is printed

2013-05-15 Thread Christian Müller
I didn't get it. Please have a look at
http://camel.apache.org/support.htmlan provide the required details.

Sent from a mobile device
Am 15.05.2013 18:19 schrieb RUPA JAIN rupa.jai...@gmail.com:

 when calling two string parameters method  of ejb  using ejb component of
 camel , the method is called  but in jdev'log parameter's value is not
 printed instead string class (type of parameter)is printed.



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/when-calling-ejb-cliiebt-using-ejb-component-of-camel-two-string-parameter-method-is-called-but-in-ed-tp5732622.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: What is the best approach to do an asynchronous rendezvous?

2013-05-15 Thread Chris Wolf
Hello Raúl,

The more I analyze the requirements, the more complicated it seems to get - it's
looking like I need to have a per-customer state machine to manage the flow.

To answer your questions:
- How many batches per day will you receive per customer?
one per day per customer - 3 predecessor events in, 1 result event out.

- Can the event batches interleave?
Yes, for sure, which raises another issue - now I'm thinking I need
per-customer, dynamically added route/route-policy

- What identifies a concrete batch of events?
  * a per-customer arrival of config info from external system via JMS
  * a per-customer arrival of message indicating certain external
processing is ready for next step from Camel-based process
  * a per-customer indication of a set of files have arrived via SFTP

- Do you have a finite list of customers? (and customer ids?)
   * I don't see how that factors in - assume the less restrictive case

- What is the payload of the fourth event?
  * an advisory JMS message that SFTP-processed files has completed
and that the
 external system can proceed base on these results.

Thanks,

Chris

On Wed, May 15, 2013 at 4:42 PM, Raul Kripalani r...@evosent.com wrote:
 Let me try and understand the timeline of these events. I will call a
 logical grouping of events event batch.
 If you don't mind answering the following questions, I can assist better:

- How many batches per day will you receive per customer?
- Can the event batches interleave?
- What identifies a concrete batch of events?
- Do you have a finite list of customers? (and customer ids?)
- What is the payload of the fourth event? Am I right asserting that you
receive 3 raw events, and you build some sort of composite or merged
message and release it as the 4th event?

 Regards,

 *Raúl Kripalani*
 Enterprise Architect, Open Source Integration specialist, Program
 Manager | Apache
 Camel Committer
 http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
 http://blog.raulkr.net | twitter: @raulvk

 On Wed, May 15, 2013 at 9:30 PM, Chris Wolf cwolf.a...@gmail.com wrote:

 Raúl,

 Thanks for your ideas.  Now it's 3 events without guaranteed order to
 arrive before triggering the fourth event.  As for correlation key, I
 guess it would be customer-id plus a timestamp
 that shows the event happened in the last several hours.

 The more I look into it, the more it seems like the Camel resequencer
 process may apply
 here:  http://camel.apache.org/resequencer.html

 The thing is, I'm not sure about setting batch size and/or timeout.
 The documentation
 states:

 ...messages are collected into a batch, either by a maximum number of
 messages per batch or using a timeout...

 So it seems I would set batch size to 3 in my case, but our process is
 supporting
 multiple customers, so really, it's 3 predecessor events *per customer*.
  Also,
 I think I would need persistent state in the even of a crash.
 Although I'd like to
 avoid it, I can't help thinking I may have to implement yet another custom
 Processor to support this use case.  (I already had to implement a custom
 SFTP Processor to handle dynamic endpoint settings based on the
 customer-id).

 I know that Camel is intended for ETL-ish sorts of problems, but I
 think the Camel
 approach is also appropriate for interactive, online processing, but
 in that case,
 it would be really helpful if endpoint configurations had the
 additional dimension
 of settings/configs indexed by id (such as customer-id, user-id,
 account-id, etc.)

 I could be wrong, but it seems that the static URI way of configuring
 endpoints
 doesn't scale to process-flow/per-identity.  Those endpoints that do take
 expressions help in this regard, but not all of them work with
 expression-language
 configuration, e.g. SFTP Consumer.

 Thanks,

 Chris

 On Wed, May 15, 2013 at 3:46 PM, Raul Kripalani r...@evosent.com wrote:
  Hi Chris,
 
  I like this kind of problems ;-) Do these two messages share a
 correlation
  key?
 
  If yes, you can create a bean which acts like a Repository, accumulating
  message bodies or Exchanges under the correlation key. Could be
 implemented
  using Guava's MultiMap, or a DB if you need durable persistence, or a
  distributed cache if you require clustering without persistence.
 
  When a message arrives, you query the Repository for a previous message
  with the same correlation key. If it exists, you pick it up, do whatever
  manipulation is needed, and release the 3rd event. Kind of like a
  CyclicBarrier that stores the messages for later usage.
 
  P.S.: You could consider using the Aggregator EIP, but it'll block a
 thread
  until the 2nd event comes through.
 
  Regards,
 
  *Raúl Kripalani*
  Enterprise Architect, Open Source Integration specialist, Program
  Manager | Apache
  Camel Committer
  http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
  http://blog.raulkr.net | twitter: 

Netty to ActiveMQ - replies

2013-05-15 Thread asp
Hi,

   I am a first time camel user and would like to know how to proceed with
setting up the camel route for my case. 
1. I have a netty consumer where I receive messages from a non-netty TCP
client
2. I have to forward the request to Active MQ
3. I have to respond back (send ACK ) to the non-netty TCP client only when
the message is successfully sent to message queue. We cannot lose any
messages. 

1. and 2. are simple and I have that working. I am trying to figure out a
way to confirm that the message has been successfully received by the
ActiveMQ before responding back. How can I do this? 

any pointers is greatly appreciated!!

Thanks,
AP



--
View this message in context: 
http://camel.465427.n5.nabble.com/Netty-to-ActiveMQ-replies-tp5732645.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: when calling ejb cliiebt using ejb component of camel two string parameter method is called but in ejb the parameter'svalue is not printed instead string class (type of parameter)is printed

2013-05-15 Thread RUPA JAIN
when calling two string parameters method  of ejb  using ejb component of
 camel , the method is called  but when I am trying to fetch parameters
inside ejb bean method  parameter's value is not fetched instead  type of
parameter(string class)is fetched and second parameter is nullified. 

Bean method:
public String sayHelloParam(String s1,String s2) {
// TODO Auto-generated method stub
System.out.println(remoteinterface methods sayhello with 2 
string
param...+s1.toString()+...+s2);
return sayHello from Converter with 2 string param...;
}
 
output:remoteinterface methods sayhello with 2 string
param...[Ljava.lang.String;@13d172cd...null

Client side code:
final String[] paramArray=new String[2];
paramArray[0]=s;
paramArray[1]=s2;



exchange = producer.request(FrameworksStartup.getInstance().getUriMap()
.get(camelID), new Processor() {
public void process(Exchange exchange) throws Exception 
{
if(paramArray!=null)
{

exchange.getIn().setBody(paramArray);

}

}

});



--
View this message in context: 
http://camel.465427.n5.nabble.com/when-calling-two-string-parameters-method-of-ejb-using-ejb-component-of-camel-the-method-is-called-b-tp5732622p5732646.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: stream:file closeOnDone not close all time

2013-05-15 Thread Jean Francois LE BESCONT
Hi,

what should I do ?

Thanks

Jeff


2013/5/15 Jean Francois LE BESCONT jflebesc...@gmail.com

 Hey !

 A new option is available for the stream:file to close it when done
 (closeOnDone). This option is appeared in 2.11 after my jira (
 https://issues.apache.org/jira/browse/CAMEL-6147)

 File unlock (or released or closed) looks to doesn't works fine if last
 line is not passed to the endpoint

 Example :

 We have a CSV with X line. We want to write a part of it in a file
 out_1.csv and a second part in a file out_2.csv according to a business
 rule, in my example the rule is after two lines readed.

 An example is :

 from(file://C:/Temp/camel/rep1/?noop=true)
 .log(start process file = ${file:name})
 .split()
 .tokenize(\n)
 .streaming()
 .process(new Processor() {

 public void process(Exchange exchange) throws Exception {
// After 2 lines, next lines are rejected via an exchange
 property
i++ ;
if( i   2)  {
exchange.setProperty(FILE_1, true );
} else {
exchange.setProperty(FILE_1, false);
}
 }
})
.choice()
.when(property(FILE_1).isEqualTo(Boolean.TRUE))

  .to(stream:file?fileName=C:/Temp/camel/rep1/out/out_1.csvcloseOnDone=true)
.when(property(FILE_2).isEqualTo(Boolean.TRUE))

 .to(stream:file?fileName=C:/Temp/camel/rep1/out/out_2.csvcloseOnDone=true)
.end()
 .end()
 .log(end process file = ${file:name})
 .end()
 ;

 It create two files, and out_1.csv is still locked.

 Should I update the jira or open a new ?

 Thanks

 Jeff




Re: Removing route stops other routes from the same producer

2013-05-15 Thread ikoblik
I realized that I didn't ask the question... I want to implement
Observer/Observable pattern with ability to subscribe and unsubscribe. I was
looking for better ways to do this with Camel, but it seems that adding and
removing routes is the only way.

Has anyone solved this problem before? What did you use?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Removing-route-stops-other-routes-from-the-same-producer-tp5732616p5732648.html
Sent from the Camel - Users mailing list archive at Nabble.com.