Kishore, The wrapper approach makes absolute sense. Will it make sense to define a Stream to be a stream of Messages - each Message has an Event and the destination (key) it has to be sent to? An Event can then be dispatched on multiple keys - one Message per dispatch. As we don't dispatch a keyless Event (correct me if I am wrong), it should be okay. On receiving a Message, one can directly extract the key from it (without the need for KeyFinder).
What do you think? Thanks Karthik On Fri, Oct 14, 2011 at 4:57 PM, kishore g <[email protected]> wrote: > Yes, a event might be dispatched on multiple keys or it may be keyless. If > we put the key in the event, then s4 framework some how needs to extract > those keys from the event which means we have to enforce that event class > always implements a base class provided by s4. This may not be desirable in > all cases. For example the events may be generated by a system outside s4 > and has its own format/class. > > The other approach is to have EventWrapper which has streamName, key(s) and > event. This will avoid instrospection on the event. > > Also having key in event will sort of tie keys being known on the sending > side where in some cases we need it to be created on the receiving side. > > Having said that, having key in the event definitely helps avoid key and > keyFinder. But the hope is the we can have a generic KeyFinder which can > extract a key from a pojo which is the class most of the time. > > thanks, > Kishore G > > On Fri, Oct 14, 2011 at 12:40 PM, Leo Neumeyer <[email protected] > >wrote: > > > Remember that an event may be dispatched with several keys. That's why we > > tie the key to the stream which delivers to a specific PE prototype. Let > me > > think a bit more. > > > > -leo > > > > > > On Oct 14, 2011, at 12:03, Karthik Kambatla <[email protected]> > > wrote: > > > > > Also, if we make Key a first class member of Event, do we really need > > other > > > classes - Key and KeyFinder - to determine the value of key of a > > particular > > > event? > > > > > > Thanks > > > Karthik > > > > > > On Fri, Oct 14, 2011 at 1:01 PM, Karthik Kambatla < > > [email protected]>wrote: > > > > > >> Hello > > >> > > >> Given that every event has an associated key (e.g. CountEvent.key), > > >> wouldn't it make sense to add it to the Event class itself? > > >> > > >> The key in every Event, can be used directly for routing decisions. > > Also, I > > >> believe it will prove to be very handy if people consider each PE > > instance > > >> serving multiple keys (for scalability) or want to write their own > > >> extensions for persisting the events. > > >> > > >> Implementation: To facilitate different types of keys (Strings, Ints > > etc.), > > >> we might want to make Event generic - Event<Key> with certain > properties > > on > > >> key. > > >> > > >> Thanks > > >> Karthik > > >> > > >
