on ‎2018 Jan 30 7:06 AM
Hi ,
I am trying to understand how a listener will find when an event is triggered by "eventService.publichEvent()" ??
Thanks in advance.
Request clarification before answering.
hybris is using spring events under the hood. You can just as well use the spring mechanism directly. In addition to what spring provides hybris offers the possibility to send an event to other nodes in the cluster.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Hybris EventService is just a wrapper around Spring Application Events.
If you follow the calls down through org.springframework.context.support.AbstractApplicationContext.publishEvent to org.springframework.context.event.AbstractApplicationEventMulticaster you can see how it loops over registered listeners to find ones that support the type you are looking for and then invokes the listeners returned. Internally the lookup is cached so that it doesn't need to look through the entire list of registered listeners each time.
https://github.com/spring-projects/spring-framework/blob/master/spring-context/src/main/java/org/spr... https://github.com/spring-projects/spring-framework/blob/master/spring-context/src/main/java/org/spr... https://github.com/spring-projects/spring-framework/blob/master/spring-context/src/main/java/org/spr...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Listeners are the objects that are notified of events and perform business logic depending on the event that occured. Listeners are registered with the event service.
Whenever you register an event listener, the event system will scan the application context and automatically register all event listeners.
For more details, please check the below link: https://wiki.hybris.com/display/release5/Event+System#EventSystem-RegisteringEventListeners
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Sorav,
Thank you for the response. I am new to Hybris so i am bit struggling to understand how listener knows which kind of event it is and how it needs to be processed.
For example, Consider user places and order and order Model is save. Now i would like to send a notification to user via email with the order details.
To achieve this there must be a listener associated with the Order model ? is this how it works? and how do i implement the listener to make it associated with the Order and triggers a email process?
Many thanks in advance.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.