Understanding the Order of Event Triggers in Mongock and Spring #23
|
Could you please provide an explanation of the order in which events are triggered by Mongock in relation to Spring events? For example, I'm aware of the Spring event called 'ApplicationReadyEvent.' Could you clarify whether this event occurs before or after the 'SpringMigrationSuccessEvent' provided by Mongock? |
Replies: 0 comments 1 reply
|
Hello @ahmadsab95 , The Note that Springboot is the one responsible of guaranteeing this, you just need to read the documentation about ApplicationRunner and InitializingBean and use the one that better fits your requirements. For further details about Mongock's events please take a look to the Springboot runner events section in out documentation website. Hope this helps. |
Hello @ahmadsab95 , The
SpringMigrationSuccessEvent/SpringMigrationFailureEventevents are triggered at the end of the Mongock's migration. As Mongock's execution happens within application startup (and before Springboot finish its startup), the Mongock's events will be triggered before Springboot'sApplicationReadyEventevent.Note that Springboot is the one responsible of guaranteeing this, you just need to read the documentation about ApplicationRunner and InitializingBean and use the one that better fits your requirements.
For further details about Mongock's events please take a look to the Springboot runner events section in out documentation website.
Hope this helps.