Can you show me the code that not worked ?

> On 02 Aug 2016, at 15:06, [email protected] wrote:
> 
> Hi,
> 
> I'd like to use a MessageToMessageDecoder to transform from one type to 
> another while sending a message from a client to a remote server.  The 
> MessageToMessage Encoder/Decoder allow this to be accomplished easily.  When 
> using UDP and an AddressedEnvelope to preserve remote address info, this is 
> not the case.  
> 
> The following snippet shows a simplified channel pipeline to hopefully 
> illustrate my use case.
> 
> ChannelInitializer<DatagramChannel> datagramChannelInitializer = new 
> ChannelInitializer<DatagramChannel>() {
>                     @Override
>                     public void initChannel(DatagramChannel ch) throws 
> Exception {
> 
>                                 ch.pipeline().addLast(new 
> DatagramPacketDecoder(new Type1Decoder()))
>                                 .addLast(new Type2MessageToMessageDecoder())
>                                 .addLast(new Type2MessageToMessageEncoder())
>                                 .addLast(new DatagramPacketEncoder<>(new 
> Type1Encoder()));
>                     }
> }
> 
> 
> During encoding, I wrap my type1 payload in an AddressedEnvelope to specify 
> the remote address.  The Type2MessageToMessageEncoder is never invoked 
> because AddressedEnvelope<Type1, SocketAddress> does not match Type2.  I 
> tried to create my own class AddressedEnvelopeMessageToMessageEncoder similar 
> to the DatagramPacketEncoder which delegates to a provided encoder but the 
> encode method is not visible.
> 
> What is the recommended approach for this kind of use case?  Any help 
> appreciated.
> 
> Thanks,
> 
> Joe
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/netty/788b5d49-63fa-4dff-b522-81d90118ada3%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/netty/788b5d49-63fa-4dff-b522-81d90118ada3%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/B68C802F-3651-4756-A8F4-373891BFAD82%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to