You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Christian Mueller (JIRA)" <ji...@apache.org> on 2010/05/12 15:13:43 UTC

[jira] Created: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

camel-netty: Add a registry based option for a custom ChannelPipelineFactory
----------------------------------------------------------------------------

                 Key: CAMEL-2713
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
             Project: Apache Camel
          Issue Type: Improvement
    Affects Versions: 2.3.0
         Environment: All
            Reporter: Christian Mueller
             Fix For: 2.4.0


We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.

As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.

{code}
public class TimeClientPipelineFactory implements ChannelPipelineFactory {

    public ChannelPipeline getPipeline() {
        ChannelPipeline pipeline = Channels.pipeline();
        pipeline.addLast("handler", new TimeClientHandler());
        return pipeline;
    }
}
{code}

In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:

{code}
    channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
{code}

If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).

Thanks,
Christian

P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61132#action_61132 ] 

Claus Ibsen commented on CAMEL-2713:
------------------------------------

Ashwin looks fine. Although I think your unit tests should ensure that the custom pipeline factories is really used. Currently they have just duplicated the code from  the defaults.

You can for example just use a boolean to check if the custom factory method was invoked.
And then in the unit test method check if the boolean is now true.
This is a easy trick.



> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on CAMEL-2713 started by Ashwin Karpe.

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashwin Karpe updated CAMEL-2713:
--------------------------------

    Attachment:     (was: camel-2713-netty.zip)

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: camel-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61285#action_61285 ] 

Claus Ibsen commented on CAMEL-2713:
------------------------------------

Great work Ashwin. Do you mind updating the Netty wiki page with details about this new feature?


> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: camel-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashwin Karpe updated CAMEL-2713:
--------------------------------

    Attachment: camel-2713-fix.diff
                camel-2713-netty.zip

Hi Claus,

I have made the changes you recommended, modified the tests, run sourcecheck and verified that the fix is ready for check-in.

Please let me know if you have any further comments. If not, I will check-in the code...

Cheers,

Ashwin... 

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: camel-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61258#action_61258 ] 

Ashwin Karpe commented on CAMEL-2713:
-------------------------------------

Committed to SVN repository as version r986850.

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: camel-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashwin Karpe updated CAMEL-2713:
--------------------------------

    Attachment:     (was: CAMEL-2713-fix.diff)

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: camel-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashwin Karpe updated CAMEL-2713:
--------------------------------

    Attachment: CAMEL-2713-fix.diff
                camel-2713-netty.zip

Hi Claus,

I have provided a fix for this feature enhancement where it should now be possible to add a user defined custom pipeline factory (both client-side and server-side) to Netty which can be invoked to create a custom set of handlers, encoders, decoders etc thereby giving full control over the handler/interceptor chain.

Can you please let me know if I can go ahead and commit. I have run all the unit tests and added a couple of unit tests to prove the capability.

Cheers,

Ashwin...

BTW, can you also let me know if yo have had a chance to look at CAMEL-2943 (Camel-sip component). I would like to commit this in as well. It is a pretty cool telecom centric protocol component.

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61287#action_61287 ] 

Ashwin Karpe commented on CAMEL-2713:
-------------------------------------

Sure thing, Claus. I will update the Netty wiki page right away.

Cheers,

Ashwin...

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: camel-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Christian Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59412#action_59412 ] 

Christian Mueller commented on CAMEL-2713:
------------------------------------------

May be I was a little vague with my description. In [1.7.3.  The Second Solution |http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e1062] in the Netty documentation it's a sample, in which the FrameDecoder is used:

{code}
package org.jboss.netty.example.time;

public class TimeDecoder extends FrameDecoder {

  @Override
  protected Object decode(
    ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) {
            
    if (buffer.readableBytes() < 4) {
      return null; 
    }
        
    return buffer.readBytes(4);
  }
}
{code}

The FrameDecoder has the annotation @ChannelPipelineCoverage("one")) which means it is state full. This means, you cannot share an instance of the FrameDecoder in multiple channels. The guided solution for this is to use a ChannelPipelineFactory and create a new instance of the FrameDecoder for each channel:

{code}
package org.jboss.netty.example.time;

public class TimeClientPipelineFactory implements ChannelPipelineFactory {

  public ChannelPipeline getPipeline() {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("handler", new TimeClientHandler());
    return pipeline;
  }
}
{code}

I think this is the same for the encoders and decoders...
In Camel Netty the handler, encoder and decoder are all shared which not fits the needs described before.

{code}
        List<ChannelUpstreamHandler> decoders = producer.getConfiguration().getDecoders();
        for (int x = 0; x < decoders.size(); x++) {
            channelPipeline.addLast("decoder-" + x, decoders.get(x));
        }

        List<ChannelDownstreamHandler> encoders = producer.getConfiguration().getEncoders();
        for (int x = 0; x < encoders.size(); x++) {
            channelPipeline.addLast("encoder-" + x, encoders.get(x));
        }

        if (producer.getConfiguration().getHandler() != null) {
            channelPipeline.addLast("handler", producer.getConfiguration().getHandler());
        } else {
            channelPipeline.addLast("handler", new ClientChannelHandler(producer));
        }
{code}

Please let me know, if I'm right or not.

Thanks,
Christian

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>             Fix For: 2.4.0
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashwin Karpe reassigned CAMEL-2713:
-----------------------------------

    Assignee: Ashwin Karpe

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashwin Karpe resolved CAMEL-2713.
---------------------------------

    Resolution: Fixed

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: camel-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Ashwin Karpe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61257#action_61257 ] 

Ashwin Karpe commented on CAMEL-2713:
-------------------------------------

Hi Claus,

Since your comments were more about unit tests (which I have modified) and since they work fine, I will check in the code and will incorporate any change if you see anything else.

Cheers,

Ashwin... 

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Ashwin Karpe
>             Fix For: 2.5.0
>
>         Attachments: camel-2713-fix.diff, camel-2713-netty.zip
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2713) camel-netty: Add a registry based option for a custom ChannelPipelineFactory

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-2713:
-------------------------------

    Fix Version/s: 2.5.0
                       (was: 2.4.0)

> camel-netty: Add a registry based option for a custom ChannelPipelineFactory
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-2713
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2713
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>         Environment: All
>            Reporter: Christian Mueller
>             Fix For: 2.5.0
>
>
> We will build an ims-component to communicate with our [IMS|http://en.wikipedia.org/wiki/Information_Management_System] system.
> As described in the Netty documentation in chapter [1.7.2.  The First Solution|http://docs.jboss.org/netty/3.1/guide/html_single/index.html#d0e865], I assume that we need a state full SimpleChannelHandler (class annotated with @ChannelPipelineCoverage("one")). The proposed solution is to use a ChannelPipelineFactory which creates a new ChannelPipeline and a new SimpleChannelHandler for each Channel.
> {code}
> public class TimeClientPipelineFactory implements ChannelPipelineFactory {
>     public ChannelPipeline getPipeline() {
>         ChannelPipeline pipeline = Channels.pipeline();
>         pipeline.addLast("handler", new TimeClientHandler());
>         return pipeline;
>     }
> }
> {code}
> In the current implementation, this is not possible IMO. The custom handler, which is looked up from the registry, is shared between all channels:
> {code}
>     channelPipeline.addLast("handler", consumer.getConfiguration().getHandler());
> {code}
> If I'm right, I would like to provide the patch (but unfortunately not in the next two weeks).
> Thanks,
> Christian
> P.S: Very nice/clean code inside this component... :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.