Spring Cloud Stream reads messages before Camunda is ready

I am working on a Camunda BPM Spring Boot Application where the application reads messages from rabbitmq queue using Spring Cloud Stream. Once the message is received, the application invokes a process instance in Camunda.

If there are messages already in the rabbitmq queue during application startup, the cloud stream listener starts reading messages even before Camunda is initialized.

I have already implemented a solution based on this thread - Stop Spring Cloud Stream @StreamListener from listening until receipt of some Spring Event - Stack Overflow by blocking the cloud stream listener from listening to the queue till some event is fired - in this case PostDeployEvent.

Would appreciate if you can provide any inputs if there is a better way to handle this

Thanks!!