cancel
Showing results for 
Search instead for 
Did you mean: 

how to work EventService and how to config any event

Former Member
0 Kudos
465

Hello EveryOne,

Could you explain how to configure and work EventService, in details

Thanks M Imam

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Event is a simple class, can be triggered using eventService and handled by EventListener.

Steps :

1) Create a java class by extending AbstractEvent

2) Create EventListener by extending AbstractEventListener and override onEvent method. inside this method you can write your business logic. register bean for listener in spring.xml

3)Trigger event from any class by using eventService.publishEvent(new SampleEvent)

Have a look into RegisterEvent in OOTB. Here system will send notification mail to customer after creation of new account.

RegisterEvent will be triggered from register method of CustomerAccountService after successfull creation of new customer, then onEvent method of RegistrationEventListener will be executed, here you have logic to send notification to customer about account creation.

Former Member
0 Kudos

Hello all,

Thanks for your explanation, In additional to this, Hybris provide to developers create an event/Listener at run time. and without rebuilding your system.

ScriptingEventService provide you the possibility to add/remove your EventListener at run time using dynamic scripting. BR

Answers (0)