Re: Publisher - Subscriber pattern for Tapestry Service
"Thiago H. de Paula Figueiredo" <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.user |
|---|---|
| Message-ID | <CAE_88GbAiMwWHAwOoYy-t97t4+OUS-JokHra5ZEO+4LBQV_iyQ@mail.gmail.com> |
On Sun, Jun 18, 2017 at 12:52 PM, abangkis <[email protected]> wrote: > Lets say I have a hashtag entity that i stored in the database and managed > by HashtagDAO (a tapestry service). And then i have a TwitterParserService > that check if a tweet contain a hashtag that i saved in the database. The > problem, if someone add or changed the hashtag in the database i want the > TwitterParserService to immediately know about the change and check the > tweet using the new hashtags. > > In j2se it will be a straight forward pub-sub/observer pattern. Just create > an interface for the listener, let the TwitterParserService implement it > and set as the default listener, and invoke it from HashtagDAO. But i don't > think it would work with tapestry services class. > Why wouldn't it work? Tapestry itself uses this: LinkCreationHub, RegistryStartup, InvalidationEventHub, RegistryShutdownHub, UpdateListenerHub, and that's just the ones I've found in a two-minute search. It would all be synchrononous, though, and messaging services, as far as I know, are asynchronous. -- Thiago