[rabbitmq-discuss] Sample example with Enqueue
Steve Powell
steve at rabbitmq.com
Wed Mar 21 11:13:10 GMT 2012
Bamboula,
It really is not clear what you (or your boss) need.
Queues (in AMQP) are places to store messages published over the AMQP
protocol. A queue is where they are stored prior to delivery to a
consumer client.
In AMQP no client Enqueues to a queue, instead she will Publish a
message to an Exchange, and depending upon how the exchange is set up,
this may result in the message being placed on a queue.
AMQP clients register interest in certain queues (becoming consumers),
and the AMQP protocol will deliver those messages that arrive there to
the consumer, either upon client demand, or as they (and the consumer)
are available. Asking for messages one at a time (on demand) is not very
efficient, and requires polling the queue.
To receive messages as they are available, you need to supply an
implementation of the Consumer interface in the Java client.
Because the Java client needed an efficient way to receive messages, but
still wanted to get messages on-demand, RabbitMQ implemented a
QueueingConsumer and this used a Java Queue object which stored messages
from AMQP as they arrived (the efficient way) for the client application
to get them on-demand. This is the queue that client applications can
'dequeue' from. The client application will not 'enqueue' to this queue,
because that happens in the Java client's implementation of the
QueueingConsumer. The examples that use a QueueingConsumer will
'dequeue' messages from the consumer's queue.
A similar implementation is given in the dot-net-client, and for exactly
the same reasons. There is where you might see implementations of
Enqueue() and Dequeue() operations.
So you can see we are confused by your request for an example using
'Enqueue'. You should not need to Enqueue to anything. If you want to
send a message to an AMQP queue, then you need to publish it (to an
exchange) and it will end up on an AMQP queue (enqueued onto it) if the
exchange rules permit this. We do not recommend you explicitly enqueue
messages onto the QueueingConsumer internal Queue, as you will break the
logic of the queueing consumer and it cannot be guaranteed to function
correctly after this.
I hope this helps you.
Steve Powell (a happy bunny)
----------some more definitions from the SPD----------
chinchilla (n.) Cooling device for the lower jaw.
socialcast (n.) Someone to whom everyone is speaking but nobody likes.
On 18 Mar 2012, at 08:45, Bamboula wrote:
>
> My boss wants me to show him an example using ....Enqueue(object o).
>
> I've read these tutorials, it didn't help me
>
> Alvaro Videla-2 wrote:
>>
>> Well. Basic publish puts a message on the queue… so it will "enqueue" it.
>>
>> Have you read the rest of the tutorials? Specifically take a look at this
>> one: http://www.rabbitmq.com/tutorials/amqp-concepts.html
>>
>> -Alvaro
>>
>> On Mar 18, 2012, at 9:27 AM, Bamboula wrote:
>>
>>>
>>> It's not really clear. How can I do Enqueue using basicPublish?
>>>
>>> thanks
>>>
>>> Alvaro Videla-2 wrote:
>>>>
>>>> See here:
>>>>
>>>> http://www.rabbitmq.com/tutorials/tutorial-one-java.html
>>>>
>>>> It's called basicPublish
>>>>
>>>> -Alvaro
>>>>
>>>> On Mar 18, 2012, at 9:11 AM, Bamboula wrote:
>>>>
>>>>>
>>>>> Hy,
>>>>>
>>>>> Is there any easy example using the Enqueue() method (with Java or C#)?
>>>>>
>>>>> I only found example with Dequeue
>>>>>
>>>>> It would really help me
>>>>>
>>>>> Thanks
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Sample-example-with-Enqueue-tp33525430p33525430.html
>>>>> Sent from the RabbitMQ mailing list archive at Nabble.com.
>>>>>
>>>>> _______________________________________________
>>>>> rabbitmq-discuss mailing list
>>>>> rabbitmq-discuss at lists.rabbitmq.com
>>>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>>
>>>> Sent form my Nokia 1100
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> rabbitmq-discuss mailing list
>>>> rabbitmq-discuss at lists.rabbitmq.com
>>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Sample-example-with-Enqueue-tp33525430p33525476.html
>>> Sent from the RabbitMQ mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> rabbitmq-discuss mailing list
>>> rabbitmq-discuss at lists.rabbitmq.com
>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>
>> Sent form my Nokia 1100
>>
>>
>>
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.rabbitmq.com
>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Sample-example-with-Enqueue-tp33525430p33525507.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
>
> _______________________________________________
> 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