May I upstream self-created messages?
"이희승 (Trustin Lee)"
trustin at gmail.com
Wed Aug 25 22:28:40 EDT 2010
Hi Daniel,
On 08/25/2010 02:29 AM, Daniel Ferber wrote:
>
> Hi Bruno, thanks for your valuable advice.
>
> Regarding the first approach, do I need to create a new event? I think I may
> use MessageEvent to send my pojo upstream (to the business handler that
> knows how to handle it). From the documentation I understood that my handler
> may fire upstream any number of events created by itself. A received message
> may be decoded and split into several messages to be fired upstream. Of
> course, I have to be consistent: eg. prevent firing a spurious content
> message after the channel has been disconnected. There I see the advantage
> of declaring my own event type: it is less error prone since it prevents
> confusion with other events defined by Netty.
You (and your code posted in the previous message) are correct. It's
fine to use MessageEvent instead of defining a new event type as you
noticed.
> But I liked more your second approach. It is simpler but more flexible. It
> does not mess up the protocol nor does it require additional events (or
> messages) that complicate the state machine for the business handler. So
> obvious... but I was not able to workout the idea by myself.
Yep, that's another way to achieve the goal. :)
Cheers,
Trustin
--
what we call human nature in actuality is human habit
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 293 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100826/02b500d4/attachment.bin
More information about the netty-users
mailing list