camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Threadsafety of Camel FTP
Date Tue, 19 May 2009 15:06:20 GMT
Hi Oliver

Thanks for reporting back so promptly and providing how you test it.

Basically some endpoints in Camel are singletons and others are not
(eg prototype in Spring lingo).
An endpoint implements IsSingleton and provide whether its singleton or not.

The problem is that we dont have a setter for controlling this so you
can decide. So if you use only one FTP producer at the time you can
set it to singleton. Or as you want to use concurrent ftp producers
you can set it to prototype. As you would do if you configured it in
Spring XML.

So I am wondering if we should expose such a configuration, so you can
override the default behvior for FTP which is singleton.

So basically its just appending: &isSingleton=false on the URI.
We could maybe rename it to something more IoC ish and use an enum to
define the types

So its either
?scope=singleton
?scope=prototype









On Tue, May 19, 2009 at 4:02 PM, ohecker
<oliver.hecker@capgemini-sdm.com> wrote:
>
> Hi Claus,
>
> we are using Camel 2.0-M1 at the moment.
> The scenario consists of a simple route with one direct-endpoint as consumer
> and a single FTP-endpoint as producer. We send an Exchange to the
> direct-endpoint from two parallel running threads. This should simulate the
> scenario where the route is either triggered from a servlet, or where we do
> asynchronous processing using multiple threads in parallel.
>
> We implemented a test case in the same way as the Camel FTP unit tests.
> The relevant parts of the code (stripped down to show the idea of the
> scenario):
>
> RouteBuilder:
>
>    protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            public void configure() throws Exception {
>                from("direct:startHere").to(getFtpUrl());
>            }
>        };
> (getFtpUrl() just delivers a constant as in the other CamelFTP test cases)
>
> The test itself:
>
>        for (int i = 0; i < 2; i++) {
>            threads[i] = new Thread() {
>                public void run() {
>                    try {
>                         String url = "direct:startHere";
>                         // body and filename are some other strings....
> (not of interest here)
>                         template.sendBodyAndHeader(url, body,
> Exchange.FILE_NAME, filename);
>                    } catch (Exception e) {
>                        e.printStackTrace();
>                    }
>                }
>            };
>            threads[i].start();
>       }
> I can provide the complete unit test class if you like.
>
> Thanks
>
> Oliver
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> What version of Camel are you using?
>>
>> Are they accessing the same FTP endpoint URI? Or do they use different
>> FTP endpoint URIs
>> ....
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Threadsafety-of-Camel-FTP-tp23615932p23617064.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message