grails-plugins / grails-rabbitmq

Grails RabbitMQ Plugin
Apache License 2.0
33 stars 29 forks source link

autoStart configuration for rabbitmq plugin #24

Open rubindersingh opened 8 years ago

rubindersingh commented 8 years ago

Currently, rabbitmq plugin create and start listeners at bootstrap time. It would be more convenient if autoStart configuration could be added like "disableListening" to configure that if we want to start consumers to consume messages at the time of creation or not. We are facing issue that when rabbitmq is configured and started, it starts consuming messages and then call services to perform operations. Many a times, service class beans are not yet initialized which lead to errors in processing messages. If we could stop consumers to read from queue until manuall start at later point of time in grails application bootstrap's init block. Then, this problem can be avoided. As consumers will not start reading messages from queues until directed. If you did not understand problem or need further inputs, please revert.

Regards, Rubinder Singh

ronicthomas commented 8 years ago

There's already an option called "disableListening" that will disable all listeners. However, this will not register the listener beans as well. Either of the two options should be sufficient for your case:

Personally, I like the second option since it gives you more control. I could put in a PR for the same.