Short circuit a pipeline
Trustin Lee
trustin at gmail.com
Mon Jan 3 22:39:38 EST 2011
You could trigger a downstrream event in the MessageValidatorDeoder:
Channels.write(ctx, Channels.future(...), quickResponse);
Which is a shortcut of ChannelHandlerContext.sendDownstream(...).
--
Trustin Lee - http://gleamynode.net/
Sent from a mobile device - please excuse the brevity.
On Dec 14, 2010, at 1:06 AM, Abraham Menacherry <abrahammenacherry at gmail.com> wrote:
>
> Hi Folks,
>
> I need some help with configuring my pipeline....
>
> I have a server pipeline which looks like this
>
> Upstream
> 1.MessageHeaderDecoder 2. MessageValidatorDecoder 3. Deserializer 4.
> Business Handler
>
> Downstream
> 5. MessageHeaderEncoder 6. MessageValidationEncoder 7. Serializer
>
> Now in the upstream handler sometimes at step 2 itself I understand that
> this is not really a valid message. In this scenario I need to just write
> back the latest state stored back to the connection.
>
> Current solution(hack?) I have done is to insert an upstream handler at step
> 3 which would notice that this is an invalid message, and write a boolean
> to the channel. This boolean in-turn would act like a signal to the
> Serializer(first downstream handler) to turn off. Then
> MessageValidationEncoder which is state aware and picks the latest state and
> writes it to output.
>
> Is there a more elegant solution to this? I think the above is a bit crude,
> since if I add any more downstream handlers to my pipeline before step 6,
> they all need to have the logic that the Serializer has, i.e to ignore the
> boolean.
>
> Thanks,
> Abraham.
> --
> View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Short-circuit-a-pipeline-tp5831239p5831239.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
More information about the netty-users
mailing list