Re: camel error with simple program with camel-core-2.11.1.jar

2013-07-22 Thread Willem jiang
Which version JDK are you using?


--  
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 Monday, July 22, 2013 at 12:33 PM, vinay wrote:

> update..
>  
> I get following warning when starting camel...
>  
> WARNING: Module [camel-groovy] - Unable to load extension class [class
> org.apach
> e.camel.groovy.extend.CamelGroovyMethods] due to
> [org/apache/camel/Expression].
> Maybe this module is not supported by your JVM version.
>  
> regards,
> Vinay
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-error-with-simple-program-with-camel-core-2-11-1-jar-tp5735829p5736000.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).





Re: Camel cache consumer (event based)

2013-07-22 Thread Willem jiang
Hi,

Did you have chance to check out the example5 of this wiki page[1]?

[1]http://camel.apache.org/cache.html  

--  
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 Monday, July 22, 2013 at 2:46 PM, rrajen2 wrote:

> Hi
> I have a Camel cache producer built using EHCache. I was wondering if I
> want a event-based Cache consumer to consume from it, how would I be able to
> do it? Assume I have a Cache named cache://testCache with its producer
> built. Please share sample code demonstrating a event based consumer from
> the cache cache://testCache showing cache changes like
> addition/update/delete events.
>  
> Thanks
>  
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-cache-consumer-event-based-tp5736001.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).





Re: Camel HTTP component vs. Apache HTTP client

2013-07-22 Thread Raul Kripalani
Camel does a fair degree of lazy loading. Try to measure performance
on a second or third invocation of the route, rather than the first
time.

Also, pease post the source your HelperBean and ObjectCreationProcess class.

Thanks,
Raúl.

On 21 Jul 2013, at 18:51, humayun0156  wrote:

> i've used http4 component and test my code. but it still took 600-800 ms per
> request.
> my route looks like :
> from("direct:npGet")
>.setHeader(Exchange.HTTP_METHOD, constant("GET"))
>.setProperty("url", simple("${body}"))
>.setHeader(Exchange.HTTP_URI, simple("${body}"))
>.to("http4://dummyHost.com?" + npAuthenticationString)
>.convertBodyTo(Document.class)
>.bean(HelperBean.class, "setUrlETagMapping")
>.process(new ObjectCreationProcess(xmlToObjectMapping));
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5735974.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel HTTP component vs. Apache HTTP client

2013-07-22 Thread humayun0156
HelperBean.java   

ObjectCreatoinProcessor.java   



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5736005.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Mocking consumer endpoints

2013-07-22 Thread Claus Ibsen
Hi

Yeah that could be a good idea to make it easier to replace the from
uri on route(s).

Likewise it would also be nice if we could have a mocked registry so
you can add beans to this registry in unit tests, and this registry
takes precedence over the default registry.

But that is another improvement to look at later.

On Sun, Jul 21, 2013 at 10:23 PM, Bilgin Ibryam  wrote:
> Then I think I method like the following in CamelTestSupport
>
> public void replaceRouteFromWith(String routeId, String fromEndpoint) {
> fromEndpoints.put(routeId, fromEndpoint);
> }
>
> and some additions to doSetUp()
>
> for (final Map.Entry entry : 
> fromEndpoints.entrySet()) {
> context.getRouteDefinition(entry.getKey()).adviceWith(context,
> new AdviceWithRouteBuilder() {
> @Override
> public void configure() throws Exception {
> replaceFromWith(entry.getValue());
> }
> });
> }
>
> would be useful for replacing from endpoints in tests.
>
> I will add that soon if there are no objections.
>
> Bilgin
>
> On 11 July 2013 18:16, Claus Ibsen  wrote:
>> No there is not.
>>
>> On Mon, Jul 1, 2013 at 6:55 PM, Bilgin Ibryam  wrote:
>>> Hi,
>>>
>>> with CamelTestSupport I can use isMockEndpointsAndSkip method to mock
>>> existing endpoints, but for mocking the consumer endpoint I still have to
>>> use AdviceWithRouteBuilder.
>>>
>>> Is there a method in CamelTestSupport that I can override and mock the
>>> consumer endpoints?
>>>
>>> Thanks
>>> Bilgin
>>
>>
>>
>> --
>> Claus Ibsen
>> -
>> Red Hat, Inc.
>> Email: cib...@redhat.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Regarding TO uri

2013-07-22 Thread indrayani
Hi All,
Is it possible to read To uri in the processor class?
I can get a From uri in the processor class as follows :

exchange.getFromEndpoint().getEndpointUri()

Is there any way to read To uri ?






--
View this message in context: 
http://camel.465427.n5.nabble.com/Regarding-TO-uri-tp5736012.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Regarding TO uri

2013-07-22 Thread Claus Ibsen
The last to endpoint uri is stored as a  property on the exchange with key
org.apache.camel.Exchange#TO_ENDPOINT

On Mon, Jul 22, 2013 at 11:31 AM, indrayani  wrote:
> Hi All,
> Is it possible to read To uri in the processor class?
> I can get a From uri in the processor class as follows :
>
> exchange.getFromEndpoint().getEndpointUri()
>
> Is there any way to read To uri ?
>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Regarding-TO-uri-tp5736012.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Round Robin in Camel Routes

2013-07-22 Thread deepak_a
Yes,

** expecting your consumers 
to actively fetch messages. *

-> That's where I was trying to get to!

Thanks for the explanation - its much clear now. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Round-Robin-in-Camel-Routes-tp5735857p5736014.html
Sent from the Camel - Users mailing list archive at Nabble.com.


NPE with splitter, aggregator and JMS - properties and transferExchange option

2013-07-22 Thread Martin Stiborský
Hello guys,
I have a route, where List from Exchange body is splitted and each item is
sent to JMS, the main route waits for response, performs some more
transformation and then continue with next item from the list in the same
way.
All the response are aggregated into another list, which is processed once
the splitter get its job done.

In the JMS route, I need to use some Exchange properties, so I used
tranferExchange=true option for both JMS producer and consumer endpoint.

But I have strange problem there, sometime it works, sometimes not and the
NPE exception is raised.
I can't find the wrong point, it seems that the problem is with properties
when transferring the exchange to JMS route.

I broke the code into smaller pieces and wrote some unit tests to locate
the problem.
Here is link to the test, the routes there describes what I'm doing, in
simplified version:
https://gist.github.com/stibi/6052674

Here is the jaxrs service resource class:
https://gist.github.com/stibi/6052697

Could you guys try to run the test?
Or if you spot something completely wrong there, please let me know.

Sometimes the route works, the second test pass green (the first one
without transferring the exchange always pass), but sometimes this
exception occur:
https://gist.github.com/stibi/6052726

I'm running Camel 2.11.0. Maybe it could be related to this issues:
https://issues.apache.org/jira/browse/CAMEL-6218

-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: st...@njs.netlab.cz
Twitter: http://www.twitter.com/stibi


Re: jsf and apache camel

2013-07-22 Thread lassesvestergaard
Thank you very much James.

I ended up using JSF. I found out how to integrate Camel into a JSF
application. I'm not sure it's the best way, but it seems to work (please
enlighten me if you know a better solution).  What I did is making a new
managed bean (in JSF 2.0), that is application scoped, and through it's
constructor starting a camelcontext. This way I can access the full Camel
application in the web layer, and the camelcontext exists as long as the
webserver is not shut down.

The reason why I want to be able to create anonymous processors on-the-fly,
is that I want users to be able to create custom routes from the web
interface. I think anonymous processors are relevant because data formats
can be more or less arbitrary, and therefore needs to be handled uniquely
per route definition. I will definitely look into the build-in type
converter and bean integration though.

Thanks

Lasse Vestergaard



--
View this message in context: 
http://camel.465427.n5.nabble.com/jsf-and-apache-camel-tp5735818p5736018.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Regarding TO uri

2013-07-22 Thread indrayani
hi,
i tried as follows but i am gettting null value :

exchange.getProperty("TO_ENDPOINT")

am i missing anything?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Regarding-TO-uri-tp5736012p5736017.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Regarding TO uri

2013-07-22 Thread Claus Ibsen
Its

Exchange.TO_ENDPOINT which is the key. eg its a constant on the Exchange.

On Mon, Jul 22, 2013 at 12:03 PM, indrayani  wrote:
> hi,
> i tried as follows but i am gettting null value :
>
> exchange.getProperty("TO_ENDPOINT")
>
> am i missing anything?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Regarding-TO-uri-tp5736012p5736017.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: NPE with splitter, aggregator and JMS - properties and transferExchange option

2013-07-22 Thread Martin Stiborský
Fortunately I can solve the problem with kind of workaround - not passing
exchange to JMS and use just Exchange headers. That works for me.
Anyway i'd like to know what is wrong with the transferExchange=true
solution.


On Mon, Jul 22, 2013 at 12:01 PM, Martin Stiborský <
martin.stibor...@gmail.com> wrote:

> Hello guys,
> I have a route, where List from Exchange body is splitted and each item is
> sent to JMS, the main route waits for response, performs some more
> transformation and then continue with next item from the list in the same
> way.
> All the response are aggregated into another list, which is processed once
> the splitter get its job done.
>
> In the JMS route, I need to use some Exchange properties, so I used
> tranferExchange=true option for both JMS producer and consumer endpoint.
>
> But I have strange problem there, sometime it works, sometimes not and the
> NPE exception is raised.
> I can't find the wrong point, it seems that the problem is with properties
> when transferring the exchange to JMS route.
>
> I broke the code into smaller pieces and wrote some unit tests to locate
> the problem.
> Here is link to the test, the routes there describes what I'm doing, in
> simplified version:
> https://gist.github.com/stibi/6052674
>
> Here is the jaxrs service resource class:
> https://gist.github.com/stibi/6052697
>
> Could you guys try to run the test?
> Or if you spot something completely wrong there, please let me know.
>
> Sometimes the route works, the second test pass green (the first one
> without transferring the exchange always pass), but sometimes this
> exception occur:
> https://gist.github.com/stibi/6052726
>
> I'm running Camel 2.11.0. Maybe it could be related to this issues:
> https://issues.apache.org/jira/browse/CAMEL-6218
>
> --
> S pozdravem / Best regards
> Martin Stiborský
>
> Jabber: st...@njs.netlab.cz
> Twitter: http://www.twitter.com/stibi
>



-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: st...@njs.netlab.cz
Twitter: http://www.twitter.com/stibi


Re: How to recover corrupted HawtDB files

2013-07-22 Thread Stefan Burkard
@Claus: I read there (http://leveldb.googlecode.com/svn/trunk/doc/index.html)
that it is safe when only my camel/java process or even the writing process
dies, but it is not safe when the whole operating system dies (power
outage). Perhaps I get it wrong?

@Raul: I don't expect that the Camel commiters build these tools, but the
people who build the database. I just wanted to point out that I use
frameworks to avoid building all by myself.



Von "aabändle" bis "zwüsche" - das umfangreichste Berndeutsch-Wörterbuch
im Internet: http://www.berndeutsch.ch
Ausserdem: Das Blog zur Website unter http://blog.berndeutsch.ch
Facebook-Seite unter https://www.facebook.com/berndeutsch
Google+ Seite unter http://www.google.com/+berndeutsch


On Sun, Jul 21, 2013 at 1:27 PM, Raul Kripalani  wrote:

> > After all I use the great Camel framework to
> avoid building general-purpose functionality like this by myself.
>
> At Apache Camel we only offer a component to interact with HawtDB, but
> we're not responsible for the development nor tooling around that project.
> Sorry.
>
> Regards,
> Raúl.
> On 18 Jul 2013 08:48, "Stefan Burkard"  wrote:
>
> > Hi Claus
> >
> > I'm using camel-hawtdb 2.9.6 and (according to the classpath) hawtdb 1.6.
> > The fact that hawtdb has no recovery tools but I need to build them by
> > myself is bad news to me. After all I use the great Camel framework to
> > avoid building general-purpose functionality like this by myself.
> >
> > How about LevelDB? Has it better tool support? And can I already use
> > leveldb with a Camel 2.x release? I stumbled over LevelDB while searching
> > for recovery options for HawtDB, but I didn't find an example how to use
> it
> > with the aggregator. Is there a unittest or similar I can look at?
> >
> > Thanks
> > Stefan
> >
> >
> >
> >
> > 
> > Von "aabändle" bis "zwüsche" - das umfangreichste Berndeutsch-Wörterbuch
> > im Internet: http://www.berndeutsch.ch
> > Ausserdem: Das Blog zur Website unter http://blog.berndeutsch.ch
> > Facebook-Seite unter https://www.facebook.com/berndeutsch
> > Google+ Seite unter http://www.google.com/+berndeutsch
> >
> >
> > On Wed, Jul 17, 2013 at 10:10 AM, Claus Ibsen 
> > wrote:
> >
> > > What version of Camel and HawtDB are you using?
> > >
> > > To try to recover you would possible need to write some java code with
> > > the HawtDB API to load the corrupted file(s) and peak inside.
> > >
> > > Down the road we recommend using camel-leveldb instead of
> > > camel-hawtdb. This uses LevelDB as the store instead which is a much
> > > more mature and widespread used store.
> > > https://code.google.com/p/leveldb/
> > >
> > > Apache ActiveMQ 5.9 offers leveldb out of the box, and is being
> > > considered as the recommended/default store over its KahaDB store.
> > >
> > > The camel-leveldb has the same functionality as camel-hawtdb and is
> > > very similar to setup.
> > >
> > >
> > > On Tue, Jul 16, 2013 at 10:12 AM, Stefan Burkard 
> > > wrote:
> > > > Hi Camel users
> > > >
> > > > I have a component with 2 persistent aggregators. One receives all
> > > messages,
> > > > one only a part of them. After a lot of test runs without problems I
> > had
> > > > yesterday a serious problem with the aggregator persistence (hawtdb).
> > > >
> > > > I don't know yet what causes the problems, but however, problems can
> > > occur.
> > > > My problem is that I cannot recover the data from the hawtdb-files.
> > > >
> > > > Im my logs, I got first of all about 8 stacktraces like the attached
> > > > "stacktrace1.txt". The number in the error message "The requested
> page
> > > was
> > > > not an extent: 35" is growing from stacktrace to stacktrace from 35
> to
> > > 1163.
> > > >
> > > > Then, I got some stacktraces like the attached "stacktrace2.txt".
> > > >
> > > > Finally I got A LOT of stacktraces like the attached
> "stacktrace3.txt".
> > > >
> > > > After shutting down the component gracefully, I tried to restart it,
> > but
> > > > this throws stacktraces like the attached "stacktrace-startup.txt".
> > > >
> > > > I can only start the component again if I rename the hawtdb-files so
> > they
> > > > are ignored and new hawtdb-files are created.
> > > >
> > > > This leaves me with the question: how can I recover the corrupted
> > > > hawtdb-files? I didn't found anything about this subject and if this
> is
> > > not
> > > > possible, this would be a real show-stopper.
> > > >
> > > > Thanks for any help
> > > > Stefan
> > > >
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -
> > > Red Hat, Inc.
> > > Email: cib...@redhat.com
> > > Twitter: davsclaus
> > > Blog: http://davsclaus.com
> > > Author of Camel in Action: http://www.manning.com/ibsen
> > >
> >
>


Re: How to recover corrupted HawtDB files

2013-07-22 Thread Stefan Burkard
Just for others who receive the same kind of stacktraces. I was able to
reproduce the problem by starting the component with the aggregators
multiple times.

Obviously I started accidentally multiple instances and therefore multiple
camel/java processes "shared" the same aggregator-hawtdbs. So, I need to
check on startup if another instance for the same environment is already
running and then this problem should no more occur.

If I understand the docs correctly, LevelDB does this "automatically" with
a file lock that a second instance would not be able to acquire.

Thanks to all
Stephan




Von "aabändle" bis "zwüsche" - das umfangreichste Berndeutsch-Wörterbuch
im Internet: http://www.berndeutsch.ch
Ausserdem: Das Blog zur Website unter http://blog.berndeutsch.ch
Facebook-Seite unter https://www.facebook.com/berndeutsch
Google+ Seite unter http://www.google.com/+berndeutsch


On Mon, Jul 22, 2013 at 12:44 PM, Stefan Burkard  wrote:

> @Claus: I read there (
> http://leveldb.googlecode.com/svn/trunk/doc/index.html) that it is safe
> when only my camel/java process or even the writing process dies, but it is
> not safe when the whole operating system dies (power outage). Perhaps I get
> it wrong?
>
> @Raul: I don't expect that the Camel commiters build these tools, but the
> people who build the database. I just wanted to point out that I use
> frameworks to avoid building all by myself.
>
>
> 
> Von "aabändle" bis "zwüsche" - das umfangreichste Berndeutsch-Wörterbuch
> im Internet: http://www.berndeutsch.ch
> Ausserdem: Das Blog zur Website unter http://blog.berndeutsch.ch
> Facebook-Seite unter https://www.facebook.com/berndeutsch
> Google+ Seite unter http://www.google.com/+berndeutsch
>
>
> On Sun, Jul 21, 2013 at 1:27 PM, Raul Kripalani  wrote:
>
>> > After all I use the great Camel framework to
>> avoid building general-purpose functionality like this by myself.
>>
>> At Apache Camel we only offer a component to interact with HawtDB, but
>> we're not responsible for the development nor tooling around that project.
>> Sorry.
>>
>> Regards,
>> Raúl.
>> On 18 Jul 2013 08:48, "Stefan Burkard"  wrote:
>>
>> > Hi Claus
>> >
>> > I'm using camel-hawtdb 2.9.6 and (according to the classpath) hawtdb
>> 1.6.
>> > The fact that hawtdb has no recovery tools but I need to build them by
>> > myself is bad news to me. After all I use the great Camel framework to
>> > avoid building general-purpose functionality like this by myself.
>> >
>> > How about LevelDB? Has it better tool support? And can I already use
>> > leveldb with a Camel 2.x release? I stumbled over LevelDB while
>> searching
>> > for recovery options for HawtDB, but I didn't find an example how to
>> use it
>> > with the aggregator. Is there a unittest or similar I can look at?
>> >
>> > Thanks
>> > Stefan
>> >
>> >
>> >
>> >
>> > 
>> > Von "aabändle" bis "zwüsche" - das umfangreichste Berndeutsch-Wörterbuch
>> > im Internet: http://www.berndeutsch.ch
>> > Ausserdem: Das Blog zur Website unter http://blog.berndeutsch.ch
>> > Facebook-Seite unter https://www.facebook.com/berndeutsch
>> > Google+ Seite unter http://www.google.com/+berndeutsch
>> >
>> >
>> > On Wed, Jul 17, 2013 at 10:10 AM, Claus Ibsen 
>> > wrote:
>> >
>> > > What version of Camel and HawtDB are you using?
>> > >
>> > > To try to recover you would possible need to write some java code with
>> > > the HawtDB API to load the corrupted file(s) and peak inside.
>> > >
>> > > Down the road we recommend using camel-leveldb instead of
>> > > camel-hawtdb. This uses LevelDB as the store instead which is a much
>> > > more mature and widespread used store.
>> > > https://code.google.com/p/leveldb/
>> > >
>> > > Apache ActiveMQ 5.9 offers leveldb out of the box, and is being
>> > > considered as the recommended/default store over its KahaDB store.
>> > >
>> > > The camel-leveldb has the same functionality as camel-hawtdb and is
>> > > very similar to setup.
>> > >
>> > >
>> > > On Tue, Jul 16, 2013 at 10:12 AM, Stefan Burkard 
>> > > wrote:
>> > > > Hi Camel users
>> > > >
>> > > > I have a component with 2 persistent aggregators. One receives all
>> > > messages,
>> > > > one only a part of them. After a lot of test runs without problems I
>> > had
>> > > > yesterday a serious problem with the aggregator persistence
>> (hawtdb).
>> > > >
>> > > > I don't know yet what causes the problems, but however, problems can
>> > > occur.
>> > > > My problem is that I cannot recover the data from the hawtdb-files.
>> > > >
>> > > > Im my logs, I got first of all about 8 stacktraces like the attached
>> > > > "stacktrace1.txt". The number in the error message "The requested
>> page
>> > > was
>> > > > not an extent: 35" is growing from stacktrace to stacktrace from 35
>> to
>> > > 1163.
>> > >

Re: Camel Consumer in JAX-RS Web Service

2013-07-22 Thread traviskds
Thanks for responding Sergey.

I assume you mean adding the "to" part of the route.

I did this

camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {

from(MAIL_ENDPOINT_URI).routeId("myRoute")
.bean(mailBean, "processMail")
.to("log:mail");
}
});

and no impact. Then I did this

camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {

from(MAIL_ENDPOINT_URI).routeId("myRoute")
.to("bean:mailBean?method=processMail");
}
});

and no impact. Note I registered the bean using SimpleRegistry before adding
it to the route in the 2nd set of code.

But in both instances, and even in my original code when I have
Thread.sleep(1); it works.

I am really stuck at this point as what I plan to do is provide JAX-RS
services as an API Gateway and use Camel for various backend integration and
if I cannot have Synchronous calls in JAX-RS, it is a show stopper for my
use cases.

In the Camel In Action book, in page 97-98, Service Activator Pattern, I was
under the impression when the BeanProcessor is used, then it will make a
Synchronous call.

I think maybe I am not understanding this correctly.

Any help is appreciated.

 




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Consumer-in-JAX-RS-Web-Service-tp5735968p5736023.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Consumer in JAX-RS Web Service

2013-07-22 Thread Sergey Beryozkin

I've been thinking more along these lines:

class ReadMail {

public Response read(...) {

   MailBean bean = new MailBean();
   new Thread().run(new MyRouteWrapper(bean));
   // block on the current thread
   bean.waitTillDone();



}

private MyRouteWrapper implements Runnable {
// here goes your mail route
// the last part of this route will call a MailBean method 
which will unblock a waiting readMail thread


}
}

Something like that...

Cheers, Sergey

On 22/07/13 13:00, traviskds wrote:

Thanks for responding Sergey.

I assume you mean adding the "to" part of the route.

I did this

camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {

from(MAIL_ENDPOINT_URI).routeId("myRoute")
.bean(mailBean, "processMail")
.to("log:mail");
}
});

and no impact. Then I did this

camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {

from(MAIL_ENDPOINT_URI).routeId("myRoute")
.to("bean:mailBean?method=processMail");
}
});

and no impact. Note I registered the bean using SimpleRegistry before adding
it to the route in the 2nd set of code.

But in both instances, and even in my original code when I have
Thread.sleep(1); it works.

I am really stuck at this point as what I plan to do is provide JAX-RS
services as an API Gateway and use Camel for various backend integration and
if I cannot have Synchronous calls in JAX-RS, it is a show stopper for my
use cases.

In the Camel In Action book, in page 97-98, Service Activator Pattern, I was
under the impression when the BeanProcessor is used, then it will make a
Synchronous call.

I think maybe I am not understanding this correctly.

Any help is appreciated.






--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Consumer-in-JAX-RS-Web-Service-tp5735968p5736023.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com


Re: Camel Consumer in JAX-RS Web Service

2013-07-22 Thread Claus Ibsen
You can look at using onCompletion or event notifier. Or even the NotifyBuilder.

You can find details on the Camel site using the search box on the front page.

On Sun, Jul 21, 2013 at 6:16 PM, traviskds  wrote:
> I find Camel easy for difficult use cases but hard to simple use cases. Or
> maybe I haven't still mastered it.
>
> I have a JAX-RS web service that when executed, will dynamically create a
> route that reads mail from an IMAP server and then gets processed via a
> bean.
>
> My problem is that I need to add Thread.sleep(1); so that the web
> service waits until the route completes.
>
> My issue is I want a better way to know if the route has completed instead
> of setting some arbitrary timer that has the potential for side effects.
> (e.g. waiting unnecessarily when the route might have already finished or
> even worse existing before the route has time to complete it's work.
>
> I am wondering how others might have done something similar to this
> requirement? Any ideas/suggestions are welcome as I have done everything
> possible including reading other posts in this forum, looking at the camel
> source code and test code without much success.
>
> My main code is below (note I have a JEE6 bootstrap class that starts
> CamelContext and which in turn is injected into the below jax-rs service)
>
> @Path("/Mail")
> public class ReadMail {
>
> private static final Logger logger = LoggerFactory
> .getLogger(ReadMail.class);
>
> @Inject
> CdiCamelContext camelContext;
>
> @Path("/read")
> @GET
> @Produces(MediaType.TEXT_HTML)
> public Response getUser(@Context UriInfo uriInfo) {
>
> try {
>
> logger.debug(">>> Reading mail from mail server ..");
> MultivaluedMap queryParameters = 
> uriInfo
> .getQueryParameters();
> String mailProtocol =
> queryParameters.getFirst("mailProtocol").toLowerCase();
> String mailHost = 
> queryParameters.getFirst("host").toLowerCase();
> String userName = 
> queryParameters.getFirst("username");
> String password = 
> queryParameters.getFirst("password");
>
> final String MAIL_ENDPOINT_URI = mailProtocol + "://" 
> + mailHost
> + "?username="+ userName + 
> "&password=" + password + "&delete=false"
> + 
> "&debugMode=true&unseen=true&consumer.delay=5000";
>
> final MailBean mailBean = new MailBean();
>
> camelContext.addRoutes(new RouteBuilder() {
> public void configure() throws Exception {
> 
> from(MAIL_ENDPOINT_URI).routeId("myRoute")
> .bean(mailBean, "processMail");
> }
> });
>
> Thread.sleep(1);
>
> return
> Response.status(Response.Status.OK).entity(mailBean.getMessageBody().toString())
> .build();
>
> } catch (Exception e) {
> e.printStackTrace();
> }
> finally {
> try {
> camelContext.stopRoute("myRoute");
> camelContext.removeRoute("myRoute");
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> return Response.status(Response.Status.NOT_FOUND)
> .entity("Requested search did not return any 
> results").build();
>
> }
>
> }
>
> My Bean class is
>
> public class MailBean {
>
> private StringBuilder messageBody = new StringBuilder();
>
> public void processMail(Exchange exchange) throws MessagingException,
> IOException {
>
> System.out.println(" Inside MailBean exchangeTest 
> ");
> System.out.println(" Message Id:"+
> exchange.getIn().getMessageId());
>
> this.setMessageBody(this.getMessageBody().append("Message Id:"+
> exchange.getIn().getMessageId()+ ""));
>
> if (exchange.getIn().getBody() instanceof String) {
>
> this.setMessageBody(this.getMessageBody().append(((String)
> exchange.getIn().getBody()).replaceAll("(\r\n|\n)", "")+ ""));
>
> } else if (exchange.getIn().getBody() instanceof Multipart) {
>
>
> this.setMessageBody(this.getMessageBody().append((Utility.getMultipartText((Multipart)
> exchange.getIn().getBody())).replaceAll("(\r\n|\n)","")+ ""));
>
> }
> }
>
> public StringBuilder getMessageBody() {
> return messageBody;
>

camel integration in servicemix

2013-07-22 Thread Geert Bozz
Hello all,

I 'm looking for information on how camel is integrated into servicemix and
I have two questions. I want to start by shortly explaining my
understanding, this might benefit others and it helps putting my questions
into its context. If I understand correctly,

1) Camel has an http component which is supposed to point to a jetty http
server, I can imagine this is an embedded http server when camel is used
stand-alone.
2) I 'm quite sure that ServiceMix fullsfulls the osgi http service
contract by using the pax web server, which also happens to be a jetty http
server.

My first question now is: has the camel-servicemix module been modified so
that it uses the servicemix http server? How was this done? Is it just a
matter of configuring the camel bundle?

If I want to get under the hood of the http server used by the pair
camel-servicemix, how do I best tackle this? Is it sufficient to look at
the default jetty server that comes with servicemix, or do I need to focus
on the configuration of the jetty component that comes with camel, and
documented here: http://camel.apache.org/jetty.html.


thanks,

geert


Re: camel integration in servicemix

2013-07-22 Thread Andreas Gies
Hi Geert, 

Perhaps there are other ways of doing it, but i found reusing the Camel
HTTP servlet right out of the box a bit un-OSGI-ish, so that would be true
for ServiceMix as well.
I have published a blog entry explaining in more detail what the issue was
and I addressed it:

http://www.wayofquality.de/index.php/en/blog/entry/using-the-camel-servlet-
component-in-an-osgi-blueprint-container


I am using pax-web as an HTTP service implementation, but the blog simply
assumes that you some form of http service and hopefully the
pax-web-extender installed.


Hope that helps 
Andreas



Andreas Gies


WoQ ­ Way of Quality UG

http://www.wayofquality.de


Geschäftsführer & CTO

eMail: andr...@wayofquality.de

Tel DE: +49 151 23470823



Tel UK: +44 755 1381918



Fax: +49 1805 006534 2114


Amtsgericht Landshut: HRB 8352
Ust.-Id.: DE274771254

Haftungsausschluss

Diese Email kann vertrauliche und/oder rechtlich geschützte Informationen
enthalten und ist ausschließlich für den/die benannten Adressaten
bestimmt. Sollten Sie nicht der beabsichtigte Empfänger sein oder diese
Email irrtümlich erhalten haben, ist es Ihnen nicht gestattet diese Mail
oder einen Teil davon ohne unsere Erlaubnis zu verbreiten, zu kopieren,
unbefugt weiterzuleiten oder zu behalten. Informieren Sie bitte sofort den
Absender telefonisch oder per Email und löschen Sie diese Email und alle
Kopien aus Ihrem System. Wir haften nicht für die Unversehrtheit von
Emails, nachdem sie unseren Einflussbereich verlassen haben.
Disclaimer

This email may contain confidential and/or privileged information and is
intended solely for the attention and use of the named addressee(s). If
you are not the intended recipient, or a person responsible for delivering
it to the intended recipient, you are not authorized to and must not
disclose, copy, distribute, or retain this message or any part of it
without our authority. Please contact the sender by call or reply email
immediately and destroy all copies and the original message. We are not
responsible for the integrity of emails after they have left our sphere of
control.








Am 7/22/13(30) 3:33 PM schrieb "Geert Bozz" unter :

>Hello all,
>
>I 'm looking for information on how camel is integrated into servicemix
>and
>I have two questions. I want to start by shortly explaining my
>understanding, this might benefit others and it helps putting my questions
>into its context. If I understand correctly,
>
>1) Camel has an http component which is supposed to point to a jetty http
>server, I can imagine this is an embedded http server when camel is used
>stand-alone.
>2) I 'm quite sure that ServiceMix fullsfulls the osgi http service
>contract by using the pax web server, which also happens to be a jetty
>http
>server.
>
>My first question now is: has the camel-servicemix module been modified so
>that it uses the servicemix http server? How was this done? Is it just a
>matter of configuring the camel bundle?
>
>If I want to get under the hood of the http server used by the pair
>camel-servicemix, how do I best tackle this? Is it sufficient to look at
>the default jetty server that comes with servicemix, or do I need to focus
>on the configuration of the jetty component that comes with camel, and
>documented here: http://camel.apache.org/jetty.html.
>
>
>thanks,
>
>geert




Re: Probleme with startorder

2013-07-22 Thread Bilgin Ibryam
Hi Bovas,

startupOrder will only guarantee that route 1 will start before route 2.
It wont guarantee that route one will find a file and that file will
reach the bean before route 2 message reaches the same bean.

If you have such a dependency in your routes, I'd suggest you change
your routing logic a little bit. May be you can start the second route
from the first route, once the bean has been initialized.
Or if you need some data from first file to process the second file,
may be you can use the aggregator pattern to merge both files and then
use the bean...

Bilgin


On 22 July 2013 16:04, Bovas  wrote:
> Hi everybody
>
> I use camel 2.11.0 and java/groovy DSL
>
> I explain my problem. I have a first route which runs a method bean, and my
> second route should start after the end of the first route.
>
> from("file://*Directory*?fileName=*myfile.txt*")
> .startupOrder(1)
> .to("bean://mymethods?method=*methode1*")
>
> from("file://*Directory2*?fileName=*filenameout*")
> .startupOrder(2)
> .to("bean://mymethods?method=*methode2*")
> .to(folder)
>
> I use startuporder but it doesn't work every time. My method 1 initialize a
> variable from the bean, and I need to use this variable in the second
> method.
>
> schema :
> from directory1>method1
>from
> directory2-->method2--->to folder
>
>
>
>
> -
> regards,
> Bovas
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Probleme-with-startorder-tp5736034.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


StreamCaching with slip not working

2013-07-22 Thread ramrubio
SampleProxySvc.zip
  

Camel version = 2.11.0
commons.httpclient version = 3.0.1

Attempting to implement a proxy service to route requests dynamically using
DynamicRouter pattern suggested by
http://camel.apache.org/dynamic-router.html.

I'm unsuccessful though in getting streamcaching to work.  I've enabled
streamcaching on the CamelContext but when the proxysvc forwards the POST
request to my endpoint the body is always empty.

Attached is my code with two projects. 

1.  sample.proxysvc - Contains camel proxy 
2.  sample.restsvc - Simple rest servicSampleProxySvc.zipe 


You will notice that proxysvc enables streamcaching on camel context in
camel-config.xml.  When a POST request is made to sample REST service body
is always empty. 

The only way i'm able to get it to work is by attaching a processor and
reading body into a string and setting setting in http request (Currently
this code is commented). 

I'm sure i'm doing something wrong to enable stream caching.  Hopefully it
is something easy that may be pointed out. 

Thank You. 

/Ramon



--
View this message in context: 
http://camel.465427.n5.nabble.com/StreamCaching-with-slip-not-working-tp5736044.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: After camelContext shutdown, is any way to exit the Java main() method?

2013-07-22 Thread bonnahu
Hi Willem,
After adding System.exit(1) after exchange.getContext().stop(); , it works
for me. Thanks again!



--
View this message in context: 
http://camel.465427.n5.nabble.com/After-camelContext-shutdown-is-any-way-to-exit-the-Java-main-method-tp5735993p5736042.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Probleme with startorder

2013-07-22 Thread Bovas
Hi everybody

I use camel 2.11.0 and java/groovy DSL

I explain my problem. I have a first route which runs a method bean, and my
second route should start after the end of the first route.

from("file://*Directory*?fileName=*myfile.txt*")
.startupOrder(1)
.to("bean://mymethods?method=*methode1*")

from("file://*Directory2*?fileName=*filenameout*")
.startupOrder(2)
.to("bean://mymethods?method=*methode2*")
.to(folder)

I use startuporder but it doesn't work every time. My method 1 initialize a
variable from the bean, and I need to use this variable in the second
method. 

schema :
from directory1>method1
   from
directory2-->method2--->to folder




-
regards,
Bovas
--
View this message in context: 
http://camel.465427.n5.nabble.com/Probleme-with-startorder-tp5736034.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Custom names for processors within routes

2013-07-22 Thread andreas


Hello,

I apologize if the following is a stupid question.

I have a Custom Routebuilder building a route within a Camel Context.  
The route itself works fine.


The code is relatively straight forward:

  @Override
  public void configure() throws Exception {
errorHandler(deadLetterChannel(getErrorUri()));

from(getEntryUri())
.process(getProcessor())
.process(new Processor() {
  @Override
  public void process(Exchange exchange) throws Exception {
exchange.setOut(exchange.getIn());

if (dispatcher == null) {
  throw new Exception("No dispatcher configured. Have you set  
the exit prefix ?");

}

dispatcher.dispatch(exchange);
  }
});
  }

I am using Java as I use an OSGI Managed Service to configure the  
duspatcher at runtime and also to inject a pre processor as a first  
step.
Also I found that injecting those into a Java route builder allowed me  
to unit test the processors more elegantly.


Back to the point...In JVisualVm I can see my processors in the tree  
beneath a folder named after my route identifier. Beneath this entry i  
see two processors named processor1 and processor2.


Is there any way to influence those last 2 names from my route builder  
? - Potentially I have overlooked something in the docs ...


For convenience I have attached a piece of my JVisualVM screenshot  
that shows the processors in question.


Best regards
Andreas





Re: Custom names for processors within routes

2013-07-22 Thread Claus Ibsen
Hi

Yep set the id of the processors. Then that id is used as part of the JMX name
http://camel.apache.org/camel-jmx.html

.process( ... ).id("nameOfMyProcessor")

On Mon, Jul 22, 2013 at 5:19 PM,   wrote:
>
> Hello,
>
> I apologize if the following is a stupid question.
>
> I have a Custom Routebuilder building a route within a Camel Context. The
> route itself works fine.
>
> The code is relatively straight forward:
>
>   @Override
>   public void configure() throws Exception {
> errorHandler(deadLetterChannel(getErrorUri()));
>
> from(getEntryUri())
> .process(getProcessor())
> .process(new Processor() {
>   @Override
>   public void process(Exchange exchange) throws Exception {
> exchange.setOut(exchange.getIn());
>
> if (dispatcher == null) {
>   throw new Exception("No dispatcher configured. Have you set the
> exit prefix ?");
> }
>
> dispatcher.dispatch(exchange);
>   }
> });
>   }
>
> I am using Java as I use an OSGI Managed Service to configure the duspatcher
> at runtime and also to inject a pre processor as a first step.
> Also I found that injecting those into a Java route builder allowed me to
> unit test the processors more elegantly.
>
> Back to the point...In JVisualVm I can see my processors in the tree beneath
> a folder named after my route identifier. Beneath this entry i see two
> processors named processor1 and processor2.
>
> Is there any way to influence those last 2 names from my route builder ? -
> Potentially I have overlooked something in the docs ...
>
> For convenience I have attached a piece of my JVisualVM screenshot that
> shows the processors in question.
>
> Best regards
> Andreas
>
>
>



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Camel Thread does not terminate

2013-07-22 Thread SyedBhai
Hi Everyone,
  I have the following code snippet.

  CamelContext cc=new DefaultCamelContext();
cc.addRoutes(new RouteBuilder()  {
   public void configure()  {
   from("direct:start1").

to("cxf://http://localhost:8080/JAXWS1/MyInterfaceImpl?serviceClass=com.syed.MyInterface&serviceName={http://syed.com/}MyInterfaceImplService&portName={http://syed.com/}MyInterfaceImplPort";);
 
   }
 }
);
cc.start();
ProducerTemplate t=cc.createProducerTemplate();
int annsal=t.requestBody("direct:start1", 8, Integer.class);
System.out.println("rudrish's annsal:"+annsal);
cc.stop();

  I am able to get the output successfully.  But to my surprise the program
does not terminate.  It keeps running even after I stopped the camel
context.  And for your information, this is the only code I have in main
method.  And I don't have any other code.

  Can anyone help?  This may cause severe memory leaks in my project.

Thanks,
Syed.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Thread-does-not-terminate-tp5736045.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: StreamCaching with slip not working

2013-07-22 Thread ramrubio
Stepping through code noticed that InputStreamRequestEntity is used during
post request.

A call to InputStreamRequestEntity.getContentLength leads to a call to
bufferContent because contentLength is set to CONTENT_LENGTH_AUTO.  The type
of inputStream that is set in InputStreamRequestEntity is of type
InputStreamCache.  

Because position is set to the end of the inputstream (see below) the call
to bufferContent results in buffer set to empty and the size is updated to
0.  This causes POST request to always have an empty body.

thisInputStreamRequestEntity  (id=169)  
buffer  null
content InputStreamCache  (id=146)  
buf  (id=154)   
count   10  
mark0   
pos 10  
contentLength   -2  
contentType "application/json" (id=172)

Is this expected?

/Ramon





--
View this message in context: 
http://camel.465427.n5.nabble.com/StreamCaching-with-slip-not-working-tp5736044p5736047.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Quartz and enrich seem not to work together...

2013-07-22 Thread roger_rabbit
Hi,

I read a few things about the subject, but since most of them were 3 years
old, I guess there are new features that may have changed the issue... so
here's my 2013 problem.

First of all, I am quite new to camel (20 days experience).

In a previous project, I managed to use a quartz-triggered route to get some
informations from a http site and send them as messages on a bus topic
(Fuse).
This worked fine for me.

Now, I am trying to use the same kind of process to manage a file, in such a
way I read the file at a time pointed out by a cron expression, and use the
content of the file to trigger several messages on bus (basicely : one
message will be triggerd per line in file).

Very basicely, this should look like (from my RouteBuilder-implementing
class) :
from("quartz:mytimer?0+0/2+*+*+*")
.enrich("file:/my/directory/?fileName=myFile.pair&noop=true")
.split("\n",1)
.to("activemq:my.topic.out");

My problem is that the file is processed only for the first quartz event,
and then, never processed again... (even if I change file's content). 
So, what I guess is that it is "consumed" (thus, never read, and that's why
the route failed during the next quartz events),  and that I have to keep
the content of the file in some ... place (topic?/seda?/other?) and enrich
my quartz route from that place without consuming the message...
My problem is, as a noobie, I don't know how to that.
I tried to set a previous route such as :

  
from("file:/my/directory/?fileName=myFile.pair&noop=true").to("direct:file");

and then use as as my enrichment source :

from("quartz:mytimer?0+0/2+*+*+*")
.enrich("direct:file")
.split("\n",1)
.to("activemq:my.topic.out");

... but the problem was the same... since obviously it is still consumed.

I also tried to use a ConsumerTemplate from a processor to enrich the
exchange with stg like :

Process(Exchange ex){
...
Exchange newEx =
template.receive("file:/my/directory/?fileName=myFile.pair&noop=true");
ex.setIn(newEx);
}
... but all the same...

So I tried many things and ended up thinking I .. think the wrong way. So
any tip here would be welcome.


Thanks in advance




--
View this message in context: 
http://camel.465427.n5.nabble.com/Quartz-and-enrich-seem-not-to-work-together-tp5736046.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Example Restlet JDBC Master

2013-07-22 Thread tKronos
I am trying to get the example called Camel Example Restlet JDBC Master
working. But everytime I try running it, I get the following error:

Could not instantiate listener
org.springframework.web.context.ContextLoaderListener

Plus a bunch of other errors following that with the class not being found
and such.

I think it is a versioning problem with some of the dependencies or
something. If someone knows what dependencies and what versions I need to
make this example work I would be very grateful.

I am using Camel version 2.11.0.

Thank you very much.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Example-Restlet-JDBC-Master-tp5736048.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Leveraging CXF Asynchronous processing when MEP is InOut

2013-07-22 Thread gilboy
Hi 

I also had the same query. Would be very interested to hear any response on
this query

Thanks





--
View this message in context: 
http://camel.465427.n5.nabble.com/Leveraging-CXF-Asynchronous-processing-when-MEP-is-InOut-tp5735904p5736049.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Thread does not terminate

2013-07-22 Thread bonnahu
Maybe you can try by adding System.exit() after cc.stop();



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Thread-does-not-terminate-tp5736045p5736051.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Is it possible to import Endpoints from a xml file like routeContextRef?

2013-07-22 Thread bonnahu
Hey guys,
We can import routes from other XML files by using routeContextRef. Does
anyone know whether we could do the same for EndPoints?

thanks





--
View this message in context: 
http://camel.465427.n5.nabble.com/Is-it-possible-to-import-Endpoints-from-a-xml-file-like-routeContextRef-tp5736053.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Example Restlet JDBC Master

2013-07-22 Thread Willem jiang
Hi,
How did you find the the example? I don't think we ship this example within 
Apache Camel kit.
If it is using maven, it could be easy to check the dependency issue by using 
mvn dependency:tree.


--  
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 Tuesday, July 23, 2013 at 3:17 AM, tKronos wrote:

> I am trying to get the example called Camel Example Restlet JDBC Master
> working. But everytime I try running it, I get the following error:
>  
> Could not instantiate listener
> org.springframework.web.context.ContextLoaderListener 
> (http://web.context.ContextLoaderListener)
>  
> Plus a bunch of other errors following that with the class not being found
> and such.
>  
> I think it is a versioning problem with some of the dependencies or
> something. If someone knows what dependencies and what versions I need to
> make this example work I would be very grateful.
>  
> I am using Camel version 2.11.0.
>  
> Thank you very much.
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-Example-Restlet-JDBC-Master-tp5736048.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).





Re: NPE with splitter, aggregator and JMS - properties and transferExchange option

2013-07-22 Thread Willem jiang
I suggest you clean up the exchange properties before trying to marshall the 
properties.
From the stack trace, it looks like there are some trouble to marshall the CXF 
XMLMessage which could be store into the exchange properties.


--  
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 Monday, July 22, 2013 at 6:42 PM, Martin Stiborský wrote:

> Fortunately I can solve the problem with kind of workaround - not passing
> exchange to JMS and use just Exchange headers. That works for me.
> Anyway i'd like to know what is wrong with the transferExchange=true
> solution.
>  
>  
> On Mon, Jul 22, 2013 at 12:01 PM, Martin Stiborský <
> martin.stibor...@gmail.com (mailto:martin.stibor...@gmail.com)> wrote:
>  
> > Hello guys,
> > I have a route, where List from Exchange body is splitted and each item is
> > sent to JMS, the main route waits for response, performs some more
> > transformation and then continue with next item from the list in the same
> > way.
> > All the response are aggregated into another list, which is processed once
> > the splitter get its job done.
> >  
> > In the JMS route, I need to use some Exchange properties, so I used
> > tranferExchange=true option for both JMS producer and consumer endpoint.
> >  
> > But I have strange problem there, sometime it works, sometimes not and the
> > NPE exception is raised.
> > I can't find the wrong point, it seems that the problem is with properties
> > when transferring the exchange to JMS route.
> >  
> > I broke the code into smaller pieces and wrote some unit tests to locate
> > the problem.
> > Here is link to the test, the routes there describes what I'm doing, in
> > simplified version:
> > https://gist.github.com/stibi/6052674
> >  
> > Here is the jaxrs service resource class:
> > https://gist.github.com/stibi/6052697
> >  
> > Could you guys try to run the test?
> > Or if you spot something completely wrong there, please let me know.
> >  
> > Sometimes the route works, the second test pass green (the first one
> > without transferring the exchange always pass), but sometimes this
> > exception occur:
> > https://gist.github.com/stibi/6052726
> >  
> > I'm running Camel 2.11.0. Maybe it could be related to this issues:
> > https://issues.apache.org/jira/browse/CAMEL-6218
> >  
> > --
> > S pozdravem / Best regards
> > Martin Stiborský
> >  
> > Jabber: st...@njs.netlab.cz (mailto:st...@njs.netlab.cz)
> > Twitter: http://www.twitter.com/stibi
>  
>  
>  
>  
>  
> --  
> S pozdravem / Best regards
> Martin Stiborský
>  
> Jabber: st...@njs.netlab.cz (mailto:st...@njs.netlab.cz)
> Twitter: http://www.twitter.com/stibi





FTP endpoint failure

2013-07-22 Thread Richa
Hi, 
I have a small camel route where my input endpoint is FTP. I want to handle
the scenario when FTP is down or the FTP credentials are wrong. But I
checked that FTP does not throw exception on the consumer side, instead it
just keeps on retrying after every 5 seconds. Can you please tell me how to
handle the scenario when FTP is down?



--
View this message in context: 
http://camel.465427.n5.nabble.com/FTP-endpoint-failure-tp5736059.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Thread does not terminate

2013-07-22 Thread SyedBhai
No.  That doesn't help.  Because it will shutdown the jvm.
My project is a web app.  It keeps serving incoming requests.  For serving
each request it uses camel framework.
I am creating a thread for each request.  The problem I may be facing is
that this thread does not terminate because of using camel.  So I wanted to
know how to stop this thread.
Can someone help please?

Thanks,
Syed.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Thread-does-not-terminate-tp5736045p5736060.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Leveraging CXF Asynchronous processing when MEP is InOut

2013-07-22 Thread Claus Ibsen
cxf is asynchronous.

If a thread is blocking somewhere it can be because you use direct
component and what calls that may be blocking.

On Fri, Jul 19, 2013 at 1:39 PM, Edwin  wrote:
> Hi Folks,
>
> I have a route which looks like this:
>
> from("direct:start").setExchangePattern("InOut").to("cxf:myEndpoint").to("bean:myDAO,method:updateRecord")
>
> When the response is received from myEndpoint, the database record is
> updated.
>
> myEndpoint typically takes about 5secs to generate a response so I would
> prefer to send the requests asynchronously and not hold up the executing
> thread while it waits for a response.
>
> I know the cxf component attempts to do this by default however since the
> MEP is InOut, I believe the thread waits for a response.
>
> Is there anyway to achieve asynchronous sending of the requests while
> keeping the MEP at InOut?
>
> Any thoughts are much appreciated.
>
> Thanks,
> Edwin
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Leveraging-CXF-Asynchronous-processing-when-MEP-is-InOut-tp5735904.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen