Alberto Soler
Alberto Soler

Reputation: 46

Listening spring event from tapestry component

First of all, sorry if I do something wrong, it's my first post on stackOverflow. Now, my question:

Is it possible to listen to an event thowed by Spring in Tapestry component? The event (ShopChangedEvent ) is published with ApplicationEventPublisher, from a Spring front service, and i want to listen to this event in a front Tapestry component. I tried adding"implements ApplicationListener" to my Tapestry component and overriding the onApplicationEvent method.

Thank for all,

Alberto

Upvotes: 1

Views: 80

Answers (1)

Dmitry Gusev
Dmitry Gusev

Reputation: 891

It's possible, but it's probably not what you want.

Tapestry components "live" in the scope of HTTP requests. Every time you use a UI component in a TML-markup Tapestry creates just one instance of that component and shares it across all HTTP requests.

So even if you subscribe your UI component to ApplicationEventPublisher you won't be able to properly "receive" an event in the right request cycle.

Upvotes: 1

Related Questions