You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by liugang <cl...@gmail.com> on 2013/01/14 09:59:34 UTC

Multiple Endpoint URLs defined at one component

Hi All:

I'd like to know it's there any Camel component which support to define
multiple consumer(provider?) endpoint urls in it? For example:

	from("XXX:direct:a, direct:b, direct:c,jms:queue:a,...").to("...");

in this case, the "from" can handle the massage no matter it sends to
"direct:a", "direct:b", "direct:c" or "jms:queue:a".


Thanks
GangLiu



Re: Multiple Endpoint URLs defined at one component

Posted by Christian Müller <ch...@gmail.com>.
It's what you described to do.
Your suggestion (putting all endpoint uri strings into one) doesn't work.
With the example I sent to you, you can send a message to endpoint
"direct:a", "direct:b", "direct:c" and "direct:d" and all routed in the
same way. Wasn't this your question?

Best,
Christian

On Tue, Jan 15, 2013 at 3:26 AM, liugang <cl...@gmail.com> wrote:

> Hi Christian:
>
> I'm not sure it's the same meaning: one is a single string; one is multiple
> strings.
>
> But anyway, thanks for your response.
>
> Thanks.
> GangLiu
>
> -----Original Message-----
> From: Christian Müller [mailto:christian.mueller@gmail.com]
> Sent: Tuesday, January 15, 2013 6:13 AM
> To: users@camel.apache.org
> Subject: Re: Multiple Endpoint URLs defined at one component
>
> Why you didn't try it out? It's so simple:
>
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Test;
>
> public class CamelMultipleEndpointsTest extends CamelTestSupport {
>
>     @Test
>     public void test() throws Exception {
>         MockEndpoint mock = getMockEndpoint("mock:end");
>         mock.expectedBodiesReceived("a", "b", "c", "d");
>
>         context.addRoutes(new RouteBuilder() {
>             public void configure() {
>                 from("direct:a", "direct:b", "direct:c", "direct:d")
>                     .to("mock:end");
>             }
>         });
>
>         template.sendBody("direct:a", "a");
>         template.sendBody("direct:b", "b");
>         template.sendBody("direct:c", "c");
>         template.sendBody("direct:d", "d");
>
>         mock.assertIsSatisfied();
>     }
> }
>
> And yes, it's possible (with a slightly different syntax).
>
> Best,
> Christian
>
>
> On Mon, Jan 14, 2013 at 9:59 AM, liugang <cl...@gmail.com> wrote:
>
> > Hi All:
> >
> > I'd like to know it's there any Camel component which support to define
> > multiple consumer(provider?) endpoint urls in it? For example:
> >
> >         from("XXX:direct:a, direct:b,
> direct:c,jms:queue:a,...").to("...");
> >
> > in this case, the "from" can handle the massage no matter it sends to
> > "direct:a", "direct:b", "direct:c" or "jms:queue:a".
> >
> >
> > Thanks
> > GangLiu
> >
> >
> >
>
>
> --
>
>


--

RE: Multiple Endpoint URLs defined at one component

Posted by liugang <cl...@gmail.com>.
Hi Christian:

I'm not sure it's the same meaning: one is a single string; one is multiple
strings.

But anyway, thanks for your response.

Thanks.
GangLiu

-----Original Message-----
From: Christian Müller [mailto:christian.mueller@gmail.com] 
Sent: Tuesday, January 15, 2013 6:13 AM
To: users@camel.apache.org
Subject: Re: Multiple Endpoint URLs defined at one component

Why you didn't try it out? It's so simple:

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

public class CamelMultipleEndpointsTest extends CamelTestSupport {

    @Test
    public void test() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:end");
        mock.expectedBodiesReceived("a", "b", "c", "d");

        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("direct:a", "direct:b", "direct:c", "direct:d")
                    .to("mock:end");
            }
        });

        template.sendBody("direct:a", "a");
        template.sendBody("direct:b", "b");
        template.sendBody("direct:c", "c");
        template.sendBody("direct:d", "d");

        mock.assertIsSatisfied();
    }
}

And yes, it's possible (with a slightly different syntax).

Best,
Christian


On Mon, Jan 14, 2013 at 9:59 AM, liugang <cl...@gmail.com> wrote:

> Hi All:
>
> I'd like to know it's there any Camel component which support to define
> multiple consumer(provider?) endpoint urls in it? For example:
>
>         from("XXX:direct:a, direct:b,
direct:c,jms:queue:a,...").to("...");
>
> in this case, the "from" can handle the massage no matter it sends to
> "direct:a", "direct:b", "direct:c" or "jms:queue:a".
>
>
> Thanks
> GangLiu
>
>
>


--


Re: Multiple Endpoint URLs defined at one component

Posted by Christian Müller <ch...@gmail.com>.
Why you didn't try it out? It's so simple:

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

public class CamelMultipleEndpointsTest extends CamelTestSupport {

    @Test
    public void test() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:end");
        mock.expectedBodiesReceived("a", "b", "c", "d");

        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("direct:a", "direct:b", "direct:c", "direct:d")
                    .to("mock:end");
            }
        });

        template.sendBody("direct:a", "a");
        template.sendBody("direct:b", "b");
        template.sendBody("direct:c", "c");
        template.sendBody("direct:d", "d");

        mock.assertIsSatisfied();
    }
}

And yes, it's possible (with a slightly different syntax).

Best,
Christian


On Mon, Jan 14, 2013 at 9:59 AM, liugang <cl...@gmail.com> wrote:

> Hi All:
>
> I'd like to know it's there any Camel component which support to define
> multiple consumer(provider?) endpoint urls in it? For example:
>
>         from("XXX:direct:a, direct:b, direct:c,jms:queue:a,...").to("...");
>
> in this case, the "from" can handle the massage no matter it sends to
> "direct:a", "direct:b", "direct:c" or "jms:queue:a".
>
>
> Thanks
> GangLiu
>
>
>


--