[rabbitmq-discuss] Temp Queues

Gil Strauss gil.strauss at gmail.com
Sun Oct 23 19:31:09 BST 2011


Hi

Thank you for the very quick reply.

I ran the following scenario:

On publisher:
1.
    channel.exchangeDeclare(exchangeName, "direct")

    val queueName = channel.queueDeclare().getQueue()

    channel.queueBind(queueName, exchangeName, routingKey)
2.
 Publish message

3.
On subscriber:
    channel.exchangeDeclare(exchangeName, "direct")

    val queueName = channel.queueDeclare().getQueue()

    channel.queueBind(queueName, exchangeName, routingKey)

4.
Result: Subscriber is not getting the message

On the other hand, if I do 3 and only then 1 and 2: the subscriber is
getting the message.

So the questions are:
a. Am I doing something wrong
b. How can I ensure that the subscriber gets the message even if it
was published before it subscribed to it?

Thanks again.

Gil






On Oct 23, 6:11 pm, Alvaro Videla <videlalv... at gmail.com> wrote:
> Hi,
>
> When you publish to an AMQP exchange it doesn't uses "temp queues".
>
> An AMQP Exchange will check the bindings it has and then it will route messages to the destinations that match those bindings. So if you want that your messages to go somewhere then you need to have queues bound to the exchange _before_ you publish messages through it.
>
> Seehttp://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.3/html-sin...
>
> So if you have exchanges but you don't have any queues bound to it, then the exchange will act as a black hole for the messages you publish through it.
>
> Cheers,
>
> Alvaro
>
> On Oct 23, 2011, at 6:03 PM, Gil Strauss wrote:
>
>
>
>
>
>
>
>
>
> > Hello
>
> > I'm using exchange for pub-sub method and noticed that it uses temp
> > queues, hence if a publisher propagates a message before a listener is
> > subscribing to it, the latter won't receive that message.
>
> > What I need for my application is to keep published message for a
> > period of time and send the to new subscriber even after the message
> > was originally published.
>
> > Is it doable without doing it manually programmatically?
>
> > Thanks,
>
> > Gil
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-disc... at lists.rabbitmq.com
> >https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
> Sent form my Nokia 1100
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


More information about the rabbitmq-discuss mailing list