[rabbitmq-discuss] Publish won't work without transaction?
Ben Hood
0x6e6562 at gmail.com
Mon Sep 22 23:21:18 BST 2008
Tsuraan,
On Mon, Sep 22, 2008 at 10:19 PM, tsuraan <tsuraan at gmail.com> wrote:
> Ok, that somewhat works. So now I must be flooding it with too much
> data, so it's dropping most of the messages (of the 1,000 I send,
> about 400 get enqueued). I guess that's the difference between using
> a reliable transaction and just flooding the server with messages
> then?
So how do you know whether they're enqueued or not?
> Is there a way that I can tell whether the message I sent was dropped
> by the server?
You can run rabbit_amqqueue:stat_all() in the shell.
> Getting rid of immediate did enqueue ~40% of the
> messages that I sent, in under a second, but I'd really like all my
> messages to be enqueued. Is there a way to do that that won't take
> over a minute?
That shouldn't take a minute even with a TX per message and logging to disk.
I think something may not be quite right with your setup.
>
> I guess my basic question is, what's the fastest way to send a message
> such that I will either know it's delivered to a queue or get an error
> saying it wasn't.
Either with a transaction or by setting up a return handler (and
setting the mandatory flag).
BTW, when I run this code:
#!/usr/bin/python2.5
import sys
from time import time
import amqplib.client_0_8 as A
q = "q-%d" % int(time())
conn = A.Connection("127.0.0.1", "guest", "guest")
chan = conn.channel()
chan.queue_declare(queue=q, auto_delete=True, durable=False)
for i in range(1000):
print i
m = A.Message(str(i), delivery_mode=1)
print chan.basic_publish(m, "", q, mandatory=True, immediate=False)
and then in the shell
rabbit at xlr8)3> rabbit_amqqueue:stat_all().
[{ok,{resource,<<"/">>,queue,<<"q-1222121318">>},1000,0}]
which would indicate that 1000 messages got enqueued.
And maybe this is a stupid question, but why are you enqueuing stuff?
Don't you want it to be delivered?
HTH,
Ben
More information about the rabbitmq-discuss
mailing list