You can use a direct endpoint to create a client to send messages. Just
ignore the types of messaging I'm sending.

// here's my Spring config
  <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring";>

    <route>
            <!-- here we route from or mina endpoint we have defined above
-->
      <from ref="myMinaEndpoint"/>
      <process ref="fooEndpointProcessor"/>
      <to uri="mock:result"/>
    </route>

    <route>
      <from uri="direct:mina_client"/>
      <to ref="myMinaEndpoint"/>
    </route>
  </camelContext>

// Here's my unit test
   @Test
    public void testMinaSpringProtobufEndpointDirect() throws Exception {
        MockEndpoint result = getMockEndpoint("mock:result");
        result.expectedMessageCount(1);

        int fooValue = 15;

        FoobarProto.Foo foo =
FoobarProto.Foo.newBuilder().setFoo(fooValue).setExtension(
            FoobarProto.Bar.bar, "Apache MINA").build();
        FoobarProto.Foo fooResponse = (FoobarProto.Foo)
template.requestBody("direct:mina_client", foo);

        assertMockEndpointsSatisfied();

        List<Exchange> list = result.getReceivedExchanges();
        FoobarProto.Foo fooResult =
list.get(0).getIn().getBody(FoobarProto.Foo.class);
        assertEquals((fooValue + 1), fooResponse.getFoo());
        assertEquals((fooValue + 1), fooResult.getFoo());
    }

Mina(1) implements a request-response handshake. If sync is true in the
URI, it expects a result from the other end. One result for each message
sent. The Mina2 component will be full async allowing "n" messages sent and
"m" responses.

Regards,
Chad
www.objectivesolutions.com



On Wed, Jan 18, 2012 at 2:13 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:

> On Fri, Jan 13, 2012 at 9:44 AM, Raul <ludala...@gmail.com> wrote:
> > Hello,
> >
> > I'm in the same situation. I need a client consumer. Has this requeriment
> > (client consumer) solution today?
> >
> > I read the documentation, and I undertand that when I make a route like
> > that:
> >
> >
> from("mina:tcp://localhost:port....").process(miProcesador).to("seda:distribucion")
> >
> > I am making a TCP server and it's not posible indicate that I want a
> Client
> > TCP. Isn't it?.
>
> Yes not currently possible with camel-mina.
>
> There is some JIRA tickets to allow what you want, eg
> from("mina:tcp://remoteServer:port") ....
>
> We will most likely add such functionality to camel-mina2 component,
> as camel-mina is being kept as is.
>
>
>
> >
> > Thank you again.
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/tcp-socket-client-consumer-endpoint-tp3276804p5142063.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Reply via email to