No subject
Tue Apr 12 10:32:41 BST 2011
queues, one from which the monitor reads MGMT messages and one from which
something else reads HB messages. You could imagine binding both of those
queues to a topic exchange and have your producer use routing keys to land
your messages in the desired place.
Make sense?
Best regards,
Jerry
----- Original Message -----
From: "Paul M. Bell" <pbell at syncsort.com>
To: "RabbitMQ List" <rabbitmq-discuss at lists.rabbitmq.com>
Sent: Friday, February 10, 2012 3:36:47 PM
Subject: [rabbitmq-discuss] Naive Question
All,
Hi again.
Only after trying to think through a real world scenario did I realize that my grasp of certain fundamental AMQP concepts is tenuous.
Specifically, given a producer and a consumer, is the normative behavior for only *one* of them to declare (create?) the queue over which they communicate? As I look over the examples that I've "written" ("copied" would be more accurate), I see my producer doing this:
RabbitAdmin admin = new RabbitAdmin(rabbitTemplate.getConnectionFactory());
Exchange ex = new FanoutExchange(routingKey, true, false);
admin.declareExchange(ex);
admin.declareQueue(new Queue(this.queueName));
And I see my consumer doing this:
ConsumerSimpleMessageListenerContainer container = new ConsumerSimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setQueueNames(this.queueName);
container.setConcurrentConsumers(this.onOfConsumer);
container.setMessageListener(new MessageListenerAdapter(new ConsumerHandler(), new SimpleMessageConverter()));
container.startConsumers();
What would happen if each declared a queue of the same name and type - would that give rise to two distinct queues, leaving the producer and consumer unable to communicate?
If it's normative for only one party to create the queue and the other to bind to it, what will happen if, when I try to bind to the queue, it doesn't yet exist?
Here's what I am trying to get to (I assume it requires a topic exchange):
a. a queue that holds two different message types, call them "MGMT" and "HB."
b. a producer writes MGMT messages to this queue
c. something called a "monitor" writes HB messages to this queue
d. consumer reads HB messages from this queue
e. monitor reads MGMT messages from this queue
Schematically I think it looks like this:
Producer(MGMT) -> monitor
Monitor(HB) -> consumer
How would I define these relationships via RabbitMQ? Who does what to whom?! I suspect it's simple, but after two solid weeks of 10 hour days, I am fried.
Thank you for your help.
-Paul
PS: What follows is not an attempt to curry favor - but this is a really fine list; folks are friendly, knowledgeable, and eager to help. I really appreciate it.
ATTENTION: -----
The information contained in this message (including any files transmitted with this message) may contain proprietary, trade secret or other confidential and/or legally privileged information. Any pricing information contained in this message or in any files transmitted with this message is always confidential and cannot be shared with any third parties without prior written approval from Syncsort. This message is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any use, disclosure, copying or distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and/or Syncsort and destroy all copies of this message in your possession, custody or control.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list