I think you chooses a suitable solution.

Best,
Christian

On Mon, Dec 17, 2012 at 7:51 AM, kiranreddykasa <[email protected]>wrote:

> Hi
>
> What I meant is the second client should be denied by the server,
>
> I achieved this by checking the no of opened connections in 'channelOpen'
> method in 'ServerChannelHandler' and whenever  a new connection opens I
> will
> just close that connection.
>
> I even added a new property to the 'NettyConfiguration' to check whether
> the
> netty endpoint is of this single connection type or normal type.
>
> Here is the following code
>
>         @Override
>         public void channelOpen(ChannelHandlerContext ctx,
> ChannelStateEvent e)
>                         throws Exception {
>                 if (LOG.isTraceEnabled()) {
>                         LOG.trace("Channel open: {}", e.getChannel());
>                 }
>                 if (consumer.getConfiguration().isSingleConnection()) {
>                         if (consumer.getAllChannels().size() > 1) {
>                                 System.out.println("closed");
>                                 e.getChannel().disconnect();
>                                 return;
>                         }
>                 }
>                 // to keep track of open sockets
>                 consumer.getAllChannels().add(e.getChannel());
>         }
>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-netty-restrict-connections-tp5723951p5724195.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Reply via email to