You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Bosco So <bo...@despammed.com> on 2003/07/15 22:44:34 UTC

long running mailets

What are some strategies for dealing with long running mailets? If I'm 
personalizing messages for a list of 65,000 people, that thread is bound 
to take some time. Should I break the list into chunks and spawn 
separate threads to handle the chunks? Or stay in one thread and assume 
the spooler will spawn off multiple threads for actual delivery?

How do I deal with external events like James shutdown? Should I set a 
flag in the destroy() method and check it when I'm looping through my 
members in service()?

What are some general best practices?

 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
BOSCO SO                                   www.groundspring.org

Senior Software Engineer, Groundspring.org.  Growing nonprofits
with Internet tools and training.

DonateNow:  Accept credit card donations through your website
 EmailNow:  Send eNewsletters and communicate with supporters
    ebase:  Manage your stakeholder relationships

Groundspring.org, P.O. Box 29256, San Francisco, CA 94129-0256
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .



---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: long running mailets

Posted by "Noel J. Bergman" <no...@devtech.com>.
> What are some strategies for dealing with long running mailets?

The spooler does use multiple threads, but there is a fixed size thread
pool.  And you don't need parallel execution of lots of personalizers.

For the timing being, I would recommend modeling it as a cross between
RemoteDelivery and ToProcessor.  You'll take the message out of the spool,
put it on an internal work queue, process it on a separate worker thread,
and then post it back into the pipeline in a new processor [*but see below*]

It might be a good idea if we had a suitable abstract class for that
behavior, so that people don't roll too many of their own solutions, and so
that we can optimize that functionality in James v3, when we should have a
new spooler.

Personally, I think that there is a good case for making a custom
RemoteDelivery mailet that embeds customization.  That way you don't
re-insert 1000s of messages.  You just personalize them on the way out the
door.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org