You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by John Smith <js...@googlemail.com> on 2015/09/09 07:39:19 UTC
Specifying Netty remote host at runtime
Hello,
I'd like to "ping" a server on port 22 but I only have the server's IP at
run time Is there a way to override the remote host address? e.g. something
like there is in the http4 component with the Exchange.HTTP_URI header
I tried the below but it doesn't seem to override the addres set in the
endpoint uri.
*.setHeader("CamelNettyRemoteAddress", simple("192.168.1.17:22"))
.doTry()
.to("netty4:tcp://foo?sync=false&connectTimeout=1000")
.doCatch(java.net.ConnectException.class)
.setHeader("ServerInfoRouteOperationException", exceptionMessage())
.end()*
--
View this message in context: http://camel.465427.n5.nabble.com/Specifying-Netty-remote-host-at-runtime-tp5771365.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Specifying Netty remote host at runtime
Posted by Claus Ibsen <cl...@gmail.com>.
You can use a dynamic to
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html
On Wed, Sep 9, 2015 at 7:39 AM, John Smith <js...@googlemail.com> wrote:
> Hello,
>
> I'd like to "ping" a server on port 22 but I only have the server's IP at
> run time Is there a way to override the remote host address? e.g. something
> like there is in the http4 component with the Exchange.HTTP_URI header
>
> I tried the below but it doesn't seem to override the addres set in the
> endpoint uri.
>
> *.setHeader("CamelNettyRemoteAddress", simple("192.168.1.17:22"))
>
> .doTry()
> .to("netty4:tcp://foo?sync=false&connectTimeout=1000")
> .doCatch(java.net.ConnectException.class)
> .setHeader("ServerInfoRouteOperationException", exceptionMessage())
> .end()*
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Specifying-Netty-remote-host-at-runtime-tp5771365.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition
Re: Specifying Netty remote host at runtime
Posted by Andrew Block <an...@gmail.com>.
John,
The Netty component does not support the injection of the host and port values from a header. An alternative solution would be to use a Recipient List [1] where these values are specified on the endpoint as dynamic values [2] from a source such as a message header.
From your example, if the endpoint address was specified in a header called netty_addr, it can be written as follows:
recipientList(simple(netty:tcp://${header.netty_addr}?sync=false&connectTimeout=1000))
- Andy
[1] - http://camel.apache.org/recipient-list.html
[2] - http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
--
Andrew Block
On September 9, 2015 at 1:39:30 AM, John Smith (jszjsmith@googlemail.com) wrote:
I'd like to "ping" a server on port 22 but I only have the server's IP at