You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lleclerc <ll...@aim-rg.com> on 2013/04/08 15:31:42 UTC

Simple case of multithreading with camel and wildcard.

Hi,

I have a dynamic list of process to do and want to end it with an
aggregation strategy. 

What is the approach I should be taking ? 

I tried to use direct and the wildcard endpoint, but I am getting this
exception :
Caused by: org.apache.camel.CamelExchangeException: No consumers available
on endpoint: Endpoint[direct://tz]. Exchange[Message: Go!]



Please share any idea. Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Simple-case-of-multithreading-with-camel-and-wildcard-tp5730501.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Simple case of multithreading with camel and wildcard.

Posted by lleclerc <ll...@aim-rg.com>.
Here is more details of what I am trying to do. In an osgi framework, I
resolve everything that implements IMyService. Which have the method
putDocuments(String path)

I want to call this method for those X services and then transfer the files
from hard drive.

        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from(quartzUri).process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception
{
                        for(IMyService service : services) {
                            service.putDocuments(path);
                        }
                    }
                });
                from("file:" + path).to(sftpUri);
            }
        });

So it would be done in 2 roads without parallel processing and from there I
will do some errorhandling.

I still had like to trigger the file transfert with quartz, but I don't
think I can do it without dynamically adding and removing routes. Am I right
?



--
View this message in context: http://camel.465427.n5.nabble.com/Multithreading-dynamic-process-list-with-direct-and-wildcard-tp5730501p5730660.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Simple case of multithreading with camel and wildcard.

Posted by lleclerc <ll...@aim-rg.com>.
Do this X times : 
Thread t = new MyThread()
t.start();
list.add(t);

Then :
for(Thread t2 : list) {
t2.join();
}

Continue process. 

As you can see, this can lock and there is no error handling, I want to do
that using camel.




--
View this message in context: http://camel.465427.n5.nabble.com/Multithreading-dynamic-process-list-with-direct-and-wildcard-tp5730501p5730591.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Simple case of multithreading with camel and wildcard.

Posted by Christian Müller <ch...@gmail.com>.
I don't' understand your requirements.

Sent from a mobile device
Am 08.04.2013 15:32 schrieb "lleclerc" <ll...@aim-rg.com>:

> Hi,
>
> I have a dynamic list of process to do and want to end it with an
> aggregation strategy.
>
> What is the approach I should be taking ?
>
> I tried to use direct and the wildcard endpoint, but I am getting this
> exception :
> Caused by: org.apache.camel.CamelExchangeException: No consumers available
> on endpoint: Endpoint[direct://tz]. Exchange[Message: Go!]
>
>
>
> Please share any idea. Thanks
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Simple-case-of-multithreading-with-camel-and-wildcard-tp5730501.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>