Grails, Grails RabbitMQ plugin, Java ,Spring AMQP - Multiple clients -
i have developed simple grails rest web service uses grails rabbitmq plugin , sends message queue.
grails - config.groovy
queues = { exchange name: 'my.topic', type: topic, durable: false, { foo durable: true, binding: 'test.#' } }
on java desktop app seek hear message using spring amqp
main.java
public static void main(string[] args) { cachingconnectionfactory cf = new cachingconnectionfactory("localhost"); cf.setusername("guest"); cf.setpassword("guest"); rabbitadmin admin = new rabbitadmin(cf); simplemessagelistenercontainer container = new simplemessagelistenercontainer(cf); object listener = new object() { public void handlemessage(string foo) { system.out.println(foo); } }; messagelisteneradapter adapter = new messagelisteneradapter(listener); container.setmessagelistener(adapter); container.setqueuenames("foo"); container.start(); }
when run multiple clients (say two) 1 recive "message" , another. how can both clients recive "message" on every "send" (i send messsage index grails controller reloading page).
what prefered way ? newbie :)
each consumer needs own queue bound exchange.
multiple consumers on same queue compete messages.
java grails rabbitmq grails-plugin spring-amqp
No comments:
Post a Comment