You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gsilverman <gs...@dispensingsolutionsinc.com> on 2012/01/12 03:29:39 UTC

What's best practice for running Camel 2.9.0 in JBOSS 5.X

I want to run a camel route in a JBOSS 5.X instance in order to send messages
via a Camel proxy to a remote service which is running an activemq broker. 

Should I put the route and accompanying proxy interface in a jar file and
launch it in the JBoss instance lib directory, or package it as a war file
and deploy it to the instance. I know I don't need camel-jboss.jar with the
2.9.0 version, so that's a plus. 

Packaging and deploying as a war file gives me greater control over managing
the route, but then, how would my other components communicate with the
proxy, other than through an http post or get, which adds an unwanted extra
transport layer. 

Any ideas on how to "bootstrap" this would be appreciated.

--
View this message in context: http://camel.465427.n5.nabble.com/What-s-best-practice-for-running-Camel-2-9-0-in-JBOSS-5-X-tp5138775p5138775.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Can I use RoutePolicySupport to ensure a ftp set of transfers is complete before return?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

In Camel 2.9 we added a new option sendEmptyMessageWhenIdle which you
can set to true.

Then when Camel polls from the FTP server, and there are *no* files,
then an empty message is sent out.
Then you can just filter this message, and shutdown your application.

This can also be done using a route policy, so you do not need to add
a filter eip to your route etc.

Just implement the logic in the route policy, where you detect the
empty message, and do that you do in the halt processor.
And then stop your application.



On Thu, Jan 12, 2012 at 10:45 AM, David Wynter <da...@yahoo.com> wrote:
> Hi,
>
> Tried several methods of trying to achieve this:
> FTP download with one or many files ( wildcard fileName ) one shot, no polling and do not exit the thread until all files are downloaded (could be 1 1K file or a hundred 1MB files).
>
> Claus suggested PollingConsumer but also stated "The Polling Consumer will poll 1 file at a time" so not suitable for many files.
>
> So now I have this:
>
>                routeD.from(sourcePath);
>        routeD.to(localPath+"?fileExist=Override");
>         HaltProcessor pHalt = new HaltProcessor();
>         pHalt.setContext(camelContext);
>         routeD.routeId(sourcePath);
>        pHalt.setRouteId(sourcePath);
>         routeD.process(pHalt);
>            camelContext.addRouteDefinition(routeD);
>
>                 camelContext.startRoute(routeD);
>
>
> where the HaltProcessor has this:
>
> public void process(Exchange exchange) throws Exception {
> if(context!=null && routeId != null) {
>         // remove myself from the in flight registry so we can stop this route without trouble
>         context.getInflightRepository().remove(exchange);
>         // stop this route
>         context.stopRoute(routeId);
> }
> }
>
> This still seems to exit before the files are completely downloaded. I want it to wait until they are complete.
>
> So will adding a PolicyRoute and using onExchangeDone allow me to interrogate the ftp endpoint to know that it has for example found 24 files that match the fileName with wildcards and that it has completed all of them?
>
> It is clear what onExchangeDone means in the context of a message like a JMS etc. but not in the context of a file in the process of being downloaded via ftp.
>
> thanks,
>
> David



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Can I use RoutePolicySupport to ensure a ftp set of transfers is complete before return?

Posted by David Wynter <da...@yahoo.com>.
Hi,

Tried several methods of trying to achieve this:
FTP download with one or many files ( wildcard fileName ) one shot, no polling and do not exit the thread until all files are downloaded (could be 1 1K file or a hundred 1MB files).

Claus suggested PollingConsumer but also stated "The Polling Consumer will poll 1 file at a time" so not suitable for many files.

So now I have this:

               routeD.from(sourcePath);
       routeD.to(localPath+"?fileExist=Override");
        HaltProcessor pHalt = new HaltProcessor();
        pHalt.setContext(camelContext);
        routeD.routeId(sourcePath);
       pHalt.setRouteId(sourcePath);
        routeD.process(pHalt);
           camelContext.addRouteDefinition(routeD);

                camelContext.startRoute(routeD);


where the HaltProcessor has this:

public void process(Exchange exchange) throws Exception {
if(context!=null && routeId != null) {
        // remove myself from the in flight registry so we can stop this route without trouble
        context.getInflightRepository().remove(exchange);
        // stop this route
        context.stopRoute(routeId);
}
}

This still seems to exit before the files are completely downloaded. I want it to wait until they are complete.

So will adding a PolicyRoute and using onExchangeDone allow me to interrogate the ftp endpoint to know that it has for example found 24 files that match the fileName with wildcards and that it has completed all of them? 

It is clear what onExchangeDone means in the context of a message like a JMS etc. but not in the context of a file in the process of being downloaded via ftp.

thanks,

David

Re: What's best practice for running Camel 2.9.0 in JBOSS 5.X

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

I think you can consider to use the camel-vm component[1] to 
communication with your other components across the war without 
introducing other transport.

[1]http://camel.apache.org/vm.html
On 1/12/12 10:29 AM, gsilverman wrote:
> I want to run a camel route in a JBOSS 5.X instance in order to send messages
> via a Camel proxy to a remote service which is running an activemq broker.
>
> Should I put the route and accompanying proxy interface in a jar file and
> launch it in the JBoss instance lib directory, or package it as a war file
> and deploy it to the instance. I know I don't need camel-jboss.jar with the
> 2.9.0 version, so that's a plus.
>
> Packaging and deploying as a war file gives me greater control over managing
> the route, but then, how would my other components communicate with the
> proxy, other than through an http post or get, which adds an unwanted extra
> transport layer.
>
> Any ideas on how to "bootstrap" this would be appreciated.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/What-s-best-practice-for-running-Camel-2-9-0-in-JBOSS-5-X-tp5138775p5138775.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang