John Peacock wrote:
I need to queue messages to different backends depending on various
characteristics of the incoming message, probably the contents of the
recipient field. I'm trying to put a dspam appliance into our system,
and I'd like to do it for a single domain to start with. I know I
could write a variant of smtp-forward which would return declined for
all domains except the one I am interested in. But I thought I would
try to do this in a more general fashion in the hopes someone else may
find it useful.
Before I start on this, I thought I'd document how I think this might
work, so ya'll can shoot holes in it before I waste too much time. ;-)
The file config/conditional_queue would look like this:
regex<TAB>priority<TAB>queue<TAB>queue-options
where the columns are defined as:
regex - a standard Perl regex (compiled using qr//) that is compared
against each recipient in turn; if all recipients match in the first
pass, the message is queued once and the backend is free to serialize
later. Otherwise, each recipient is treated independently and the
message will be serialized at this point (or something in between).
priority - multiple queues could be used for a single regex (to have a
fallback processing option), ordered by priority (which should be
monotonically increasing).
queue - the queue plugin to employ for all recipients matching this regex
queue-options - the same options available on the config/plugins line;
they are also used as keys to cache the configurations for later reuse.
I'm thinking of using something like the code in isa_plugin() to
create pre-compiled plugins which can then be dispatched from a common
hook_queue() call in the conditional_queue plugin.
Thoughts? Bricks? Rotten fruit?
John
p.s. I'm back!
I keep building on one queue plugin because I can keep
track of conditionals and dependencies that way, and
not evaluate the same conditionals over and over(who
is sender, was sender auth'd, is recipient here or not,
SRS alias).
Simple OK and decline would not work when there are
multiple recipients, some here some not. To make that
work I'd have to evaluate the same conditionals in
more than one plugin. So instead I just branch along
once. qmail can spool if there is a failure. I wrote code
to spool in local delivery if fail or for any other purpose
such as clustering, but haven't implemented spooling.
To implement I want to use IPC::DirQueue. That should
be flawless except when a node goes through shutdown
while holding a lock and fails to release the lock after
receiving a signal. Possibly when it came back up it
could tell that it shouldn't have any locks yet but had
a lock already.
It's site-specific spaghetti right now.
-Bob