You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Raul <lu...@gmail.com> on 2012/01/13 09:44:46 UTC

Re: tcp socket client consumer endpoint?

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?.

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.

Re: tcp socket client consumer endpoint?

Posted by j <br...@gmail.com>.
have anyone of you guys succeeded in preparing his own Component for this
scenario?

would you share some snippets?



--
View this message in context: http://camel.465427.n5.nabble.com/tcp-socket-client-consumer-endpoint-tp3276804p5725365.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: tcp socket client consumer endpoint?

Posted by vjboston <vj...@gmail.com>.
This is the exact functionality I am looking for.I want to connect to a
remote server.But mina tries to create a socket and fails with a bind
error.Has this new component out yet ? 



--
View this message in context: http://camel.465427.n5.nabble.com/tcp-socket-client-consumer-endpoint-tp3276804p5740075.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: tcp socket client consumer endpoint?

Posted by Chad Beaulac <ca...@gmail.com>.
Hi Vid,

You are correct. camel-mina and camel-mina2 do not support this behavior at
this time. camel-mina2 will do this shortly. I have that scenario working
in my sandbox but it is not pushed to the repository yet. I'm also running
that scenario with a a Google Protocol Buffers Mina2 codec that I wrote;
which supports multiple message types over a single connection and handles
the scenario you laid out below. Look forward to seeing more camel-mina2
asynchronous functionality soon.

Regards,
Chad Beaulac
Objective Solutions, Inc
www.objectivesolutions.com


On Tue, Apr 10, 2012 at 7:43 PM, vcheruvu <v_...@hotmail.com> wrote:

> Hi Chad,
>
>  Currently, I have to implement a tcp client that connects to a remote
> host. The following things takes place between client and remote host
>
> 1. Once connected to remote host, client send login message with a custom
> message format converted into bytes over wire. Remote host  will send
> sucessfull login code to client.
> 2. Once login is successfull,  TCP client send another  message that
> defines
> our interest to get data from remote host as asynchronous mode. The remote
> host will understand our message and publishes  data to our socket session.
> 3. While client is connected,  Remote host will send ping to Client for
> heartbeat check. Client must respond to the heartbeat for remote host
> within
> a time period, this is to ensure that remote host doesn't think that client
> is down otherwise socket session is closed after 3 tries.
>
> I am trying to see if above is possible with camel-mina2 with custom
> processors/handlers for sending/receiving messages to/from remote host.
>
> Kind regards,
> -Vid-
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/tcp-socket-client-consumer-endpoint-tp3276804p5631446.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: tcp socket client consumer endpoint?

Posted by vcheruvu <v_...@hotmail.com>.
Hi Chad,

  Currently, I have to implement a tcp client that connects to a remote
host. The following things takes place between client and remote host

1. Once connected to remote host, client send login message with a custom
message format converted into bytes over wire. Remote host  will send
sucessfull login code to client.
2. Once login is successfull,  TCP client send another  message that defines
our interest to get data from remote host as asynchronous mode. The remote
host will understand our message and publishes  data to our socket session.
3. While client is connected,  Remote host will send ping to Client for
heartbeat check. Client must respond to the heartbeat for remote host within
a time period, this is to ensure that remote host doesn't think that client
is down otherwise socket session is closed after 3 tries.

I am trying to see if above is possible with camel-mina2 with custom
processors/handlers for sending/receiving messages to/from remote host. 

Kind regards,
-Vid-


--
View this message in context: http://camel.465427.n5.nabble.com/tcp-socket-client-consumer-endpoint-tp3276804p5631446.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: tcp socket client consumer endpoint?

Posted by Chad Beaulac <ca...@gmail.com>.
Hi,

The camel-mina2 component works just like camel-mina at the moment. Are you looking for full async producer and consumer can send any number of messages or something else camel-mina doesn't do now?
I've been working on the camel-mina2 component for awhile. The full async behavior is taking awhile since its done in my spare time, of which I have none. 
I intend to have full async behavior working within a couple months (caveats for other customer needs consuming my time). 

Regards
Chad 

Sent from my iPhone

On Apr 10, 2012, at 2:40 AM, vcheruvu <v_...@hotmail.com> wrote:

> Hi Camel riders,
> 
>  I have tried  tcp client consumer with camel-mina2 and confirmed that it
> doesn't support it yet. Will this feature be available in 2.10?
> 
> Kind regards,
> -Vid-
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/tcp-socket-client-consumer-endpoint-tp3276804p5629124.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: tcp socket client consumer endpoint?

Posted by vcheruvu <v_...@hotmail.com>.
Hi Camel riders,

  I have tried  tcp client consumer with camel-mina2 and confirmed that it
doesn't support it yet. Will this feature be available in 2.10?

Kind regards,
-Vid-

--
View this message in context: http://camel.465427.n5.nabble.com/tcp-socket-client-consumer-endpoint-tp3276804p5629124.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: tcp socket client consumer endpoint?

Posted by Chad Beaulac <ca...@gmail.com>.
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 <cl...@gmail.com> wrote:

> On Fri, Jan 13, 2012 at 9:44 AM, Raul <lu...@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: 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/
>

Re: tcp socket client consumer endpoint?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jan 13, 2012 at 9:44 AM, Raul <lu...@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: 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/