camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: create NettyEndpoint Instance
Date Tue, 19 Feb 2013 19:06:53 GMT
On Thu, Feb 14, 2013 at 9:09 PM, Tyler Durvik <phangbyte@gmail.com> wrote:
> I would like to create a NettyEndpoint with a specified
> NettyConfiguration, but cannot find an example on how to do this.
>
> So I have the following:
>
> public class MyDataRoute extends RouteBuilder {
>
> @Override
> public void configure() throws Exception {
>
> // set up my decoders/encoders
>
> NettyConfiguration nettyConfig = new NettyConfiguration();
> nettyConfig.setProtocol("tcp");
> nettyConfig.setDecoders(decoders);
> nettyConfig.setEncoders(encoders);
> nettyConfig.setHost(remoteHost);
> nettyConfig.setPort(remotePort);
> nettyConfig.setSendBufferSize(sendBufferSize);
> nettyConfig.setReceiveBufferSize(recvBufferSize);
> nettyConfig.setSync(false);
>
> NettyComponent component = new NettyComponent( getContext() );
> component.setConfiguration(nettyConfig);
>
> // WHAT GOES IN THE FIRST PARAMETER ???
> NettyEndpoint endpoint = new NettyEndpoint("", component, nettyConfig);
>
>
> I see that the NettyEndpoint contructor takes a URI as an argument.  I
> am trying to build the "netty:tcp...." stuff using the
> NettyConfiguration instance so I am not sure why I need the URI
> parameter.  Any help would be appreciated.
>
> Thank you

Yeah most of the endpoints has a default no-arg constructor.
Though not all of them has. Also a vast majority of users use the
components / endpoints using the DSL.
Or grab the endpoint by an uri / part of the uri. And then configure it.

In your case the NettyEndpoint would be needed to be enhanced with the
no-arg ctr.
Let me see if we can get that in the code base.




-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message