Spring Framework Event Handling: Difference between revisions
Jump to navigation
Jump to search
(→Event) |
|||
Line 10: | Line 10: | ||
One of application context's capabilities is to handle events. <span id='Synchronous_Events'></span>The events are by default synchronous, which has a few advantages, one of them being the fact that the listener is able to participated in the publisher's transaction context. | One of application context's capabilities is to handle events. <span id='Synchronous_Events'></span>The events are by default synchronous, which has a few advantages, one of them being the fact that the listener is able to participated in the publisher's transaction context. | ||
=Threading Consideration= | =Threading Consideration= |
Revision as of 20:58, 23 November 2018
External
Internal
Overview
One of application context's capabilities is to handle events. The events are by default synchronous, which has a few advantages, one of them being the fact that the listener is able to participated in the publisher's transaction context.
Threading Consideration
Spring event handling is single threaded and synchronous in nature. If an event is published, until and unless all receivers get the message, the processes are blocked and the flow will not continue.
Event
Events are instances extending ApplicationEvent.
Custom Event
Publisher
Events can be published using publishers. Any custom publisher should inject an ApplicationEventPublisher object.
Application Event Listener
Listeners should implement the ApplicationListener interface.