You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Stefan Kok <st...@centilliard.io> on 2022/10/12 08:30:42 UTC

Camel Producer receiving messages asynchronously from Web Socket Server

Hi All

Background:

I have a custom camel producer receiving messages asynchronously from a
web socket server.  The next phase requires that we respond to events
emitted from the web socket server which we did not initiate from a
client perspective on the open web sockets.

Question:
When we receive such an event on the Producer Task implementation what
would be the correct camel way to process it? In other words, how do I
send the received event to where it is needed? 

Here are some of my ideas based on my limted knowledage and exprience:

1) Use the camel context, create a new exhange and send the message
directly to an endpoint from the producer task.  In ASCI art:
incoming web socket event --> producer task (create new exchange) -->
send to some endpoint like SEDA

2)  Send a rest client resquest from the producer task to the intended
destination directly from the producer task. (Seems like a bad idea
from the start to me)
incoming web socket event --> producer task (create new exchange) --> 
send with rest client to

As always
Thank you in advance.

Regards Stefan

Re: Camel Producer receiving messages asynchronously from Web Socket Server

Posted by ski n <ra...@gmail.com>.
In general, I wouldn't bother too much about the Camel Context, Exchanges
and producer tasks. Sound the best way to do this is by just chaining
various Camel routes and use direct or seda endpoints between them.

Raymond

On Wed, Oct 12, 2022 at 10:31 AM Stefan Kok <st...@centilliard.io>
wrote:

> Hi All
>
> Background:
>
> I have a custom camel producer receiving messages asynchronously from a
> web socket server.  The next phase requires that we respond to events
> emitted from the web socket server which we did not initiate from a
> client perspective on the open web sockets.
>
> Question:
> When we receive such an event on the Producer Task implementation what
> would be the correct camel way to process it? In other words, how do I
> send the received event to where it is needed?
>
> Here are some of my ideas based on my limted knowledage and exprience:
>
> 1) Use the camel context, create a new exhange and send the message
> directly to an endpoint from the producer task.  In ASCI art:
> incoming web socket event --> producer task (create new exchange) -->
> send to some endpoint like SEDA
>
> 2)  Send a rest client resquest from the producer task to the intended
> destination directly from the producer task. (Seems like a bad idea
> from the start to me)
> incoming web socket event --> producer task (create new exchange) -->
> send with rest client to
>
> As always
> Thank you in advance.
>
> Regards Stefan
>