Publisher - Subscriber pattern for Tapestry Service

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Publisher - Subscriber pattern for Tapestry Service

abangkis
Hi, can anyone tell me how to implement Pub - Sub pattern in tapestry
service? Does tapestry has some kind of 'lightweight MQ' for this kind of
case?

Thanks





--
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Publisher - Subscriber pattern for Tapestry Service

abangkis
Just realized my reply doesn't goes through the mailing list, reposted
here.


Hi, thanks for the reply. Sorry If I'm not clear enough with my question.

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.

I could do some kind of pooling mechanism. But i think a pub-sub mechanism
would be better. Using Rabbit MQ or JMS feels like an over engineer
solution for this simple case.

Thanks.

On Sun, Jun 18, 2017 at 7:17 PM, Basile Chandesris <[hidden email]> wrote:

> Le 18/06/2017 à 08:51, abangkis a écrit :
>
> Hi, can anyone tell me how to implement Pub - Sub pattern in tapestry
> service? Does tapestry has some kind of 'lightweight MQ' for this kind of
> case?
>
> Thanks
>
>
>
>
>
> https://issues.apache.org/jira/browse/TAP5-2383 Serverside publish /
> subscribe mechanism RESOLVED
>
> https://dzone.com/articles/tapestry-54-focus-javascript
>
> https://gist.github.com/hlship/1603920
>
> https://github.com/anjlab/anjlab-tapestry-commons/wiki/Publisher-API
>
> https://github.com/uklance/tapestry-atmosphere
>
On Sun, Jun 18, 2017 at 1:51 PM, abangkis <[hidden email]> wrote:

> Hi, can anyone tell me how to implement Pub - Sub pattern in tapestry
> service? Does tapestry has some kind of 'lightweight MQ' for this kind of
> case?
>
> Thanks
>
>
>
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>



--
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Publisher - Subscriber pattern for Tapestry Service

Thiago H. de Paula Figueiredo
On Sun, Jun 18, 2017 at 12:52 PM, abangkis <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Publisher - Subscriber pattern for Tapestry Service

abangkis
I was thinking because of how the Services implementation & instantiation
is managed by tapestry. How the service is injected instead of manually
created.

Thanks for the hint, I will look at those files source code.

On Mon, Jun 19, 2017 at 7:22 PM, Thiago H. de Paula Figueiredo <
[hidden email]> wrote:

> On Sun, Jun 18, 2017 at 12:52 PM, abangkis <[hidden email]> 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
>



--
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Publisher - Subscriber pattern for Tapestry Service

Thiago H. de Paula Figueiredo
On Wed, Jun 21, 2017 at 1:42 AM, abangkis <[hidden email]> wrote:

> I was thinking because of how the Services implementation & instantiation
> is managed by tapestry. How the service is injected instead of manually
> created.
>
> Thanks for the hint, I will look at those files source code.
>

There's absolutely nothing special in these classes' sources. They just
receive the observers as their distributed configuration and keep them in a
List or Collection field. But even if you wanted to add or remove observers
on the fly (i.e. after the Registry is started and all services
initialized) that wouldn't be a problem at all.

--
Thiago
Loading...