You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by SUNIL <su...@gmail.com> on 2014/12/22 22:56:43 UTC

Camel WebSocket WsEndpoint not forwarding messages

Hello,

We are using Camel Websocket component and AHC-WS component to chain
Multiple WebSockets to stream the messages. But we ran in to some issues
with WsEndpoint class which is not forwarding the messages which it
receiving from other websocket. 

Let me explain clearly what we are doing :

We have iPad WebSocket client which sends the messages to my application
which is developed using Camel WebSocket component. 

from("*websocket://myEndPoint*").choice().
     when(body().contains("ACK from external websocket")).
       to("direct:ipad")
                .otherwise().
                   to("direct:otherWebSocket");
Above route will act like producer and consumer.Also this endpoint will
receive messages from iPad WebSocket as well as some other external
Application WebSocket component which is developed using Netty. 

Below route will be used to  forward the iPad messages to some other
external WebSocket component.

        from("direct:*otherWebSocket*").log("Forwarding message to other
external WebSocket").to("ahc-ws://xxxxxx:39000/externalWebSocket");

Below will be used to send the ACK's back to iPad which it is receiving from
external WebSocket. 

        from("*direct:ipad*").log("Sending ACK message to iPad
").to("websocket://myEndPoint?sendToAll=true");

Above routes are working fine in one way that means iPad able to send the
messages to //myEndPoint and //myEndPoint is able to forward the messages to
external WebSocket component . *But external WebSocket Component sending the
ACKs back to Camel Framework WsEndpoint class but not to //myEndPoint route
.* Please help me why Camel Framework WsEndpoint class is not forwarding
those messages to my route //myEndPoint .

But same configuration is working fine if  external WebSocket also uses the
Camel WebSocket component which is weird. *Does this mean camel websocket
AHC-WS component only works if external Websockets developed using Camel
Components*?





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-WebSocket-WsEndpoint-not-forwarding-messages-tp5760996.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel WebSocket WsEndpoint not forwarding messages

Posted by Aki Yoshida <el...@gmail.com>.
I didn't see the from endpoint using ahc-ws in your description, so I
thought you didn't have the corresponding inbound ahc-ws endpoint. If you
have one and it is working when your server-side ws is jetty and not
working whe it is netty, we need to find out if and how the server is
writing back on the socket. Sorry for my delay in responding. If the debug
trace doesn't generate enough info, is it possible for you to debug the
code?
Thanks.
Aki


On Tuesday, January 6, 2015, SUNIL <su...@gmail.com> wrote:

> Additional Info: Am receiving message till WsEndpoint class but not to my
> from endpoint class.
>
>
> below is the log message :
>
> *[            New I/O worker #19] WsEndpoint                     INFO
> received message --> my external WebSocket *
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-WebSocket-WsEndpoint-not-forwarding-messages-tp5760996p5761345.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel WebSocket WsEndpoint not forwarding messages

Posted by SUNIL <su...@gmail.com>.
Additional Info: Am receiving message till WsEndpoint class but not to my
from endpoint class. 


below is the log message :

*[            New I/O worker #19] WsEndpoint                     INFO 
received message --> my external WebSocket *



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-WebSocket-WsEndpoint-not-forwarding-messages-tp5760996p5761345.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel WebSocket WsEndpoint not forwarding messages

Posted by SUNIL <su...@gmail.com>.
Thanks a lot for the response Aki! 

Actually i already have the from endpoint to receive the message from
external websocket but still we are not getting message to the from endpoint
that i have specified in Route . FYI: Same code is working fine if i use
external websocket as a Jetty based webscoket but not working if we use
Netty or any other technology. . 


Any help on this would be greatly appreciated!




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-WebSocket-WsEndpoint-not-forwarding-messages-tp5760996p5761344.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel WebSocket WsEndpoint not forwarding messages

Posted by Aki Yoshida <el...@gmail.com>.
If you are expecting acks returned from the external web socket
server, you will need to add the corresponding from-endpoint. Take a
look at the route configuration of this ahc-ws request/response test.
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob;f=components/camel-ahc-ws/src/test/java/org/apache/camel/component/ahc/ws/WsProducerConsumerTest.java;h=54d8b0928e9a5a219855e776f2403a050837fe04

2014-12-23 6:56 GMT+09:00 SUNIL <su...@gmail.com>:
> Hello,
>
> We are using Camel Websocket component and AHC-WS component to chain
> Multiple WebSockets to stream the messages. But we ran in to some issues
> with WsEndpoint class which is not forwarding the messages which it
> receiving from other websocket.
>
> Let me explain clearly what we are doing :
>
> We have iPad WebSocket client which sends the messages to my application
> which is developed using Camel WebSocket component.
>
> from("*websocket://myEndPoint*").choice().
>      when(body().contains("ACK from external websocket")).
>        to("direct:ipad")
>                 .otherwise().
>                    to("direct:otherWebSocket");
> Above route will act like producer and consumer.Also this endpoint will
> receive messages from iPad WebSocket as well as some other external
> Application WebSocket component which is developed using Netty.
>
> Below route will be used to  forward the iPad messages to some other
> external WebSocket component.
>
>         from("direct:*otherWebSocket*").log("Forwarding message to other
> external WebSocket").to("ahc-ws://xxxxxx:39000/externalWebSocket");
>
> Below will be used to send the ACK's back to iPad which it is receiving from
> external WebSocket.
>
>         from("*direct:ipad*").log("Sending ACK message to iPad
> ").to("websocket://myEndPoint?sendToAll=true");
>
> Above routes are working fine in one way that means iPad able to send the
> messages to //myEndPoint and //myEndPoint is able to forward the messages to
> external WebSocket component . *But external WebSocket Component sending the
> ACKs back to Camel Framework WsEndpoint class but not to //myEndPoint route
> .* Please help me why Camel Framework WsEndpoint class is not forwarding
> those messages to my route //myEndPoint .
>
> But same configuration is working fine if  external WebSocket also uses the
> Camel WebSocket component which is weird. *Does this mean camel websocket
> AHC-WS component only works if external Websockets developed using Camel
> Components*?
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-WebSocket-WsEndpoint-not-forwarding-messages-tp5760996.html
> Sent from the Camel - Users mailing list archive at Nabble.com.