I am publishing a message into the JMS queue as part of one of the flyway migration scripts. Once the message is published, the JMS Listener thread immediately tries to process the message by executing flyway migrations. But this is leading to a conflict wherein both the main thread and the listener thread are trying to execute the same flyway migration. Is there a way to determine as to when all the flyway migrations are complete so that I can then start the listener thread to process the messages?
One solution which is mentioned in How do I stop the JMS Listener thread until the spring is completely initialized: I've created a seperate JMS Container Factory with autoStartup = False and assigned it to the JMS Listeners which are taking part in flyway migrations. But inorder to start the listeners, how do I know that flyway migrations are complete?