Re: [Mailman-Developers] (no subject)
On Dec 29, 2012, at 06:01 PM, Sandesh Agrawal wrote:
I have trying to inject many messages into lmtp queue using :
./bin/mailman inject abc@xyz.com -f message_file -q lmtp
But whenever i see the number of messages using:
from mailman.testing.helpers import get_queue_messages items = get_queue_messages('lmtp') len(items)
it always display 1 , and on executing :
print items[0].msg.as_string()
only the latest message is being displayed, where are other older messages going ?
A few things could be happening, but first, this isn't really the right way to get messages into the system. The lmtp runner isn't a queue runner, meaning it does not wake up periodically to scan files in var/queue/lmtp. This runner is really just a daemon process. The fact that it creates such a directory is a bug, which I've now filed (LP: 1095422).
If you really want to inject messages into the system by way of the LMTP
runner, use Python's smtplib module and connect to the running daemon (started
by bin/mailman start
) with an smtplib.LMTP() instance.
Even so, I injected two copies of the following test message, and I ended up with two .pck files in var/queue/lmtp as expected. Then the get_queue_messages('lmtp') dequeued them both and returned a length-2 list of items.
Don't forget you can always just ls -lR var/queue
to see what's actually
there.
Cheers, -Barry
While using this command : ./bin/mailman inject abc@xyz.com -f tempfile -q lmtp
I got to know that in /mailman/commands/inject.py , config.switchboards[lmtp].enqueue(msg, **msgdata) is being called, which in turn starts executing /mailman/app/config.py file.
mailman.cfg tell config.py that lmtp runner is in mailman/runners/lmptp.py [runner.lmtp] class: mailman.runners.lmtp.LMTPRunner
Hence at some point , lmtp.py __init__(self, slice=None, numslices=1): should be called.
But i tried putting print("12345") inside __init__() but nothing got printed on the terminal. This may mean lmtp.py is not being executed, but still the following shows a new message in the lmtp queue.
from mailman.testing.helpers import get_queue_messages items = get_queue_messages('lmtp') len(items)
So if lmtp.py is not executed, which file is being executed for injecting message int lmtp runner , if not lmtp.py ?
participants (2)
-
Barry Warsaw
-
Sandesh Agrawal