You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Cox, Jeremy" <je...@progeny.net.INVALID> on 2022/10/26 18:16:51 UTC

Camel Netty multiplex same port

I have been trying to use camel-netty to send/receive on the same port by
writing multiple routes using the port.

 

This fails, seemingly because the names are the same, as demonstrated below.
It's not clear to me exactly what is happening under the hood.

 

I am wondering if I build the NettyEndpoint beans independently using Java
(and not simple string), will I run into the same problem?  As best I can
see, the Endpoint URI is used for the Endpoint name; I don't see a way to
make sure it is unique.  Will manually setting the Bean name with
@Bean("someName") work?

 

Thanks in advance!

Jeremy Cox

 

    from("netty:tcp://localhost:31234?clientMode=true")

        .autoStartup(isClient)

        .id("ClientReceive")

        .process(loggingProcessor);

 

    // every six seconds

    from("quartz://management/sendCTR?cron=0/6+*+*+*+*+?")

        .autoStartup(isClient)

        .id("ClientSend")

        .process(messageGeneratorProcessor)

 

        // the route will not work; URI identical

        .to("netty:tcp://localhost:31234?clientMode=true");

 

        // Eureka, changing the Endpoint name makes it work

        .to("netty:tcp://127.0.0.1:31234?clientMode=true");

 

 

 

 

Jeremy Cox

Developer Progeny Systems

M 859 322 3214 call or text

 


Re: Camel Netty multiplex same port

Posted by Claus Ibsen <cl...@gmail.com>.
clientMode is only for consumers, so use it only in the <from> route.

On Wed, Oct 26, 2022 at 8:17 PM Cox, Jeremy <je...@progeny.net.invalid>
wrote:

> I have been trying to use camel-netty to send/receive on the same port by
> writing multiple routes using the port.
>
>
>
> This fails, seemingly because the names are the same, as demonstrated
> below.  It’s not clear to me exactly what is happening under the hood.
>
>
>
> I am wondering if I build the NettyEndpoint beans independently using Java
> (and not simple string), will I run into the same problem?  As best I can
> see, the Endpoint URI is used for the Endpoint name; I don’t see a way to
> make sure it is unique.  Will manually setting the Bean name with
>  @Bean(“someName”) work?
>
>
>
> Thanks in advance!
>
> Jeremy Cox
>
>
>
>     from("netty:tcp://localhost:31234?clientMode=true")
>
>         .autoStartup(isClient)
>
>         .id("ClientReceive")
>
>         .process(loggingProcessor);
>
>
>
>     // every six seconds
>
>     from("quartz://management/sendCTR?cron=0/6+*+*+*+*+?")
>
>         .autoStartup(isClient)
>
>         .id("ClientSend")
>
>         .process(messageGeneratorProcessor)
>
>
>
>         // the route will not work; URI identical
>
>         .to("netty:tcp://localhost:31234?clientMode=true");
>
>
>
>         // Eureka, changing the Endpoint name makes it work
>
>         .to("netty:tcp://127.0.0.1:31234?clientMode=true");
>
>
>
>
>
>
>
>
>
> Jeremy Cox
>
> Developer Progeny Systems
>
> M 859 322 3214 call or text
>
>
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2