Spring Framework Event Handling: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 21: Line 21:


Spring event handling is single threaded and [[#Synchronous_Events|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.
Spring event handling is single threaded and [[#Synchronous_Events|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 [https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/ApplicationEvent.html ApplicationEvent].


=Application Event Listener=
=Application Event Listener=

Revision as of 20:55, 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.

ContextStartedEvent, ContextStoppedEvent, ApplicationListener.

Custom Events .

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.

Application Event Listener