Apache Camel Netty -- How to Know Client Disconnection

2012-04-17 Thread sambardar
I am using Camel netty component as a consumer binding to IP and port...
from uri =
netty:tcp://localhost:1556?decoder=#xihMediationFrameDecoderamp;sync=false
/

Are there any callback methods to know when a client connects and
disconnects ?

--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-How-to-Know-Client-Disconnection-tp5646718p5646718.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-16 Thread Mark Webb
I've been looking into this
(https://issues.apache.org/jira/browse/CAMEL-1077), it will require
large modifications to the existing netty component I believe.



On Fri, Mar 9, 2012 at 6:20 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 On Thu, Mar 8, 2012 at 10:59 PM, sambardar sanjay_ambar...@yahoo.com wrote:
 Yes, the issue was related to Context not up and now it works fine. I have a
 need to create a binary stream over the TCP connection. Means , in client
 server mode, I want to send a message to the server(that will run on a
 particular ip/port) over TCP socket to say start and then server should
 start streaming the binary data over the socket(and this would continue 24x7
 unless we re-start). After this client doesn't send anything to server but
 keep on receiving binary data from server over the socket. Is this
 achievable through Camel Netty component?


 No this is not possible to keep the connection live and receive data ad-hoc.
 There is some JIRA tickets to add such functionality.

 You can use the Netty API to build this yourself.


 Thanks
 Sanjay

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5549012.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/


Re: Apache Camel Netty

2012-03-14 Thread sambardar
Thanks. I have it working now. It was just a mismatch of encoders/decoders.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5565388.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-13 Thread Ashwin Karpe
Hi,

There is no requirement that the Producer be a Camel Netty producer to
communicate with a Camel Netty consumer. A straight Netty producer should
work with Camel Netty Consumer just fine.

It is more important to ensure that the communication handshake (one-way or
request/reply) are properly addressed by both sides. The Camel Netty
consumer simply locks on to the TCP/UDP port specified in the Netty URL and
supports either one-way mode or request/reply mode. 

You do however need to take care that the proper encoders and decoders are
used to get at the message correctly.

Cheers,

Ashwin... 

-
-
Ashwin Karpe
Apache Camel Committer  Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
-
--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5563476.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-12 Thread sambardar
Yes, i think i can add the concession to have Camel netty component as
consumer.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5558173.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-12 Thread sambardar
What do i need to consider when I have a Netty consumer on Camel side and i
want somebody to send me messages over the socket so. Meaning i have a netty
consumer, for example, as below. The program sending me the messages over
the socket isn't a camel component but a plain netty program. When i send
the message to this socket(after successfully connecting to it) using
ChannelStateEvent.getChannel.write() in my netty program , i can't see
message arriving at consumer. Does the producer have to be a camel component
as well? 


 public void configure() {

String netty_ssl_endpoint =
   
netty:tcp://localhost:1565?serverPipelineFactory=#spf;

from(netty_ssl_endpoint).process(new Processor()
{
public void process(Exchange e)
{
System.out.println(Exchanged!!! + 
e.getIn().getBody());

}
}); 

--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5558441.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-09 Thread Claus Ibsen
On Thu, Mar 8, 2012 at 10:59 PM, sambardar sanjay_ambar...@yahoo.com wrote:
 Yes, the issue was related to Context not up and now it works fine. I have a
 need to create a binary stream over the TCP connection. Means , in client
 server mode, I want to send a message to the server(that will run on a
 particular ip/port) over TCP socket to say start and then server should
 start streaming the binary data over the socket(and this would continue 24x7
 unless we re-start). After this client doesn't send anything to server but
 keep on receiving binary data from server over the socket. Is this
 achievable through Camel Netty component?


No this is not possible to keep the connection live and receive data ad-hoc.
There is some JIRA tickets to add such functionality.

You can use the Netty API to build this yourself.


 Thanks
 Sanjay

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5549012.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/


Re: Apache Camel Netty

2012-03-09 Thread Ashwin Karpe
Hi,

If you are trying to implement some kind of of callback mechanism it is an
higher level application requirement and beyond the communication
facilitation focus of the Netty component.

That said, it is easily do-able, if you make the following concession...

  1 The client sends a TCP request to the Netty server with a callback
destination/address of where to send responses/messages.
  2 The client meanwhile sets up a Netty consumer route that listens on
that destination/address..
  3 The server sends on-way messages to that address from that point on.
  4 The client route processes the incoming messages from the server.

Obviously this requires that the server be able to support such a
requirement (i.e parse the payload to retrieve the callback address). 

Hope this helps.

Cheers,

Ashwin...

-
-
Ashwin Karpe
Apache Camel Committer  Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
-
--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5550432.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-08 Thread Claus Ibsen
Hi

Have you created a NettyComponent by yourself?
If so then it must be started before creating an endpoint.



On Wed, Mar 7, 2012 at 10:35 PM, sambardar sanjay_ambar...@yahoo.com wrote:
 First time Camel User and trying to use Netty Component. I was running some
 of the sample code from Netty test in my own classes and got an exception
 from this statement. I am looking at it to figure out the problem but i do
 appreciate any help.

 Poetry response = (Poetry)
 producerTemplate.requestBody(netty:tcp://localhost:1521?sync=true,
 poetry);

 The exception is:
 Exception in thread main org.apache.camel.ResolveEndpointFailedException:
 Failed to resolve endpoint: netty://tcp://localhost:1521?sync=true due to:
 timer must be specified
        at
 org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:450)
        at
 org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:424)
        at
 org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:135)
        at
 org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:284)
        at
 com.xih.mediation.SyncTest.testTCPObjectInOutWithNettyConsumer(SyncTest.java:71)
        at com.xih.mediation.SyncTest.main(SyncTest.java:101)
 Caused by: java.lang.IllegalArgumentException: timer must be specified
        at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:280)
        at
 org.apache.camel.component.netty.NettyEndpoint.doStart(NettyEndpoint.java:83)
        at 
 org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
        at
 org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:1675)
        at
 org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:910)
        at
 org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:446)
        ... 5 more

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5545678.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/


Re: Apache Camel Netty

2012-03-08 Thread Ashwin Karpe
Hi,

Do you have a Netty consumer or for that matter any application listening on
the host/port. The trouble is that you are staring a Producer in a non-lazy
mode and it tries to establish a connection with the server that is not
listening on the host/port at the time.

If you are rolling your own context ensure that the context running your
consumer is up and running before the producer or start the producer in lazy
mode...

Cheers,

Ashwin...

-
-
Ashwin Karpe
Apache Camel Committer  Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
-
--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5548749.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-08 Thread sambardar
Yes, the issue was related to Context not up and now it works fine. I have a
need to create a binary stream over the TCP connection. Means , in client
server mode, I want to send a message to the server(that will run on a
particular ip/port) over TCP socket to say start and then server should
start streaming the binary data over the socket(and this would continue 24x7
unless we re-start). After this client doesn't send anything to server but
keep on receiving binary data from server over the socket. Is this
achievable through Camel Netty component?

Thanks
Sanjay

--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5549012.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Apache Camel Netty

2012-03-07 Thread sambardar
First time Camel User and trying to use Netty Component. I was running some
of the sample code from Netty test in my own classes and got an exception
from this statement. I am looking at it to figure out the problem but i do
appreciate any help.

Poetry response = (Poetry)
producerTemplate.requestBody(netty:tcp://localhost:1521?sync=true,
poetry);

The exception is:
Exception in thread main org.apache.camel.ResolveEndpointFailedException:
Failed to resolve endpoint: netty://tcp://localhost:1521?sync=true due to:
timer must be specified
at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:450)
at
org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:424)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:135)
at
org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:284)
at
com.xih.mediation.SyncTest.testTCPObjectInOutWithNettyConsumer(SyncTest.java:71)
at com.xih.mediation.SyncTest.main(SyncTest.java:101)
Caused by: java.lang.IllegalArgumentException: timer must be specified
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:280)
at
org.apache.camel.component.netty.NettyEndpoint.doStart(NettyEndpoint.java:83)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
at
org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:1675)
at
org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:910)
at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:446)
... 5 more

--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5545678.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-07 Thread Claus Ibsen
Hi

What version of Camel are you using?


On Wed, Mar 7, 2012 at 10:35 PM, sambardar sanjay_ambar...@yahoo.com wrote:
 First time Camel User and trying to use Netty Component. I was running some
 of the sample code from Netty test in my own classes and got an exception
 from this statement. I am looking at it to figure out the problem but i do
 appreciate any help.

 Poetry response = (Poetry)
 producerTemplate.requestBody(netty:tcp://localhost:1521?sync=true,
 poetry);

 The exception is:
 Exception in thread main org.apache.camel.ResolveEndpointFailedException:
 Failed to resolve endpoint: netty://tcp://localhost:1521?sync=true due to:
 timer must be specified
        at
 org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:450)
        at
 org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:424)
        at
 org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:135)
        at
 org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:284)
        at
 com.xih.mediation.SyncTest.testTCPObjectInOutWithNettyConsumer(SyncTest.java:71)
        at com.xih.mediation.SyncTest.main(SyncTest.java:101)
 Caused by: java.lang.IllegalArgumentException: timer must be specified
        at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:280)
        at
 org.apache.camel.component.netty.NettyEndpoint.doStart(NettyEndpoint.java:83)
        at 
 org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
        at
 org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:1675)
        at
 org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:910)
        at
 org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:446)
        ... 5 more

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5545678.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/


Re: Apache Camel Netty

2012-03-07 Thread sambardar
Camel 2.9.0

--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5545791.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-07 Thread sambardar
What i see is that the URL  gets screwed in producer template. In the
exception you can see URL as

netty://tcp://localhost:1521?sync=true

whereas it should have been netty:tcp://localhost:1521?sync=true

--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5545794.html
Sent from the Camel - Users mailing list archive at Nabble.com.