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 Antonio Fiol Bonnín <fi...@terra.es> on 2004/05/21 07:42:30 UTC

Integration into Tomcat

Hello,

This is my first post to the list, so "Hello to all!".

I was wondering if one can easily integrate James into Tomcat. I was 
thinking of something similar to what you can see in Wiki about JBoss.

By the way, that page deceived me, because the link referred to Tomcat, 
and then, Tomcat vanished ;-)

I imagine it is possible to add the mbean descriptor somewhere in 
Tomcat's server.xml. But before trying to do it the hard way, I was 
wondering whether someone else had done it before.

I am using Tomcat 5.0.18, if that matters, and I am not a James user 
yet, so I will accomodate to whatever configuration works.

Also, we are using Tomcat in a load-balanced configuration (for now, 
without session replication, only session stickyness). So, if it is 
possible to integrate James and Tomcat, it would also be useful to know 
if James can be clustered in such a way. I mean: If using a database for 
storing, should there be one or two instances of the database? If using 
a file system based storage, should it be local to each James instance 
or shared on NFS? (My guess, two DB instances, local storage, but I know 
very little about James)

Thank you very much for any pointer to the right way.

Antonio Fiol



P.S. My intentions, for the curious:
I would like to have all my webapps (four very different ones, 
comprising about a dozen Tomcat contexts) handling outgoing e-mails in a 
safe way. Safe handling simply means "not losing mails, retrying if 
smarthost fails".
I thought that I could re-use James spooling system and SMTP client to 
spool mails and relay to our smarthost.
I think I will have to code an "input" block (however that is called in 
James' vocabulary) so that I can directly get mails from my Java app to 
the spool in a synchronous way, so that I know for sure that the message 
is spooled and, hence, not lost.


RE: Integration into Tomcat

Posted by Daniel Perry <d....@netcase.co.uk>.
I had a go at this, and created what i'll describe as an 'alpha' version.

Basically, you stick the jar i made, a javamail jar, and activation jar into
classpath.

You need a properties file to tell it where the smtp host is, and settings
for the spool.

For examples of use have a look at SimpleTest.java.  It implements a
javamail Transport, so is used just as the normal smtp transport.  It spools
messages to disk when they are sent, and runs a background delivery thread
that picks these up and sends them.

A jar file containing classes and source, and the properties file is
available at:

http://www.netcase.co.uk/daniel/smtpspool/

Hope this is of some use to someone,

Daniel.

> -----Original Message-----
> From: Serge Knystautas [mailto:sergek@lokitech.com]
> Sent: 25 May 2004 15:43
> To: James Users List
> Subject: Re: Integration into Tomcat
>
>
> Daniel Perry wrote:
> > Well, this seems like a more complicated, but equally more
> useful approach.
>
> It's probably not more complicated as much as unfamiliar.
>
> > So, I figure, I implement a transport.
> >
> <snip>
> > Sound about right?
>
> Yup.
>
> > Looking through the JavaMail docs, it seems the smtp settings
> are included
> > in the MimeMail via session in Message.  Now I'm guessing that
> session wont
> > be stored if I use the writeTo method.  So, the mail server
> config used for
> > sending the messages will be lost?
>
> True, you would need to store the envelope info somewhere (maybe just at
> top of text message).  As for other session information, perhaps just
> stick with the same approach and store all session properties to the
> text file as well.
>
> > Another question: When I send mail, I am assuming that I will
> have to tell
> > Session to use a different transport (going to mean messing with
> > commons-sandbox-email because this is fixed to smtp).  If I use the same
> > session for sending mails, then I guess I will have to revert to smtp.
>
> Hmm, I think I understand how you're thinking of doing this.  I would
> probably just call the Sun SMTP impl directly, although by relaying on
> the transport rules, you could create layers of transports.
>
> --
> Serge Knystautas
> President
> Lokitech >> software . strategy . design >> http://www.lokitech.com
> p. 301.656.5501
> e. sergek@lokitech.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>


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


Re: Integration into Tomcat

Posted by Serge Knystautas <se...@lokitech.com>.
Daniel Perry wrote:
> Well, this seems like a more complicated, but equally more useful approach.

It's probably not more complicated as much as unfamiliar.

> So, I figure, I implement a transport.
> 
<snip>
> Sound about right?

Yup.

> Looking through the JavaMail docs, it seems the smtp settings are included
> in the MimeMail via session in Message.  Now I'm guessing that session wont
> be stored if I use the writeTo method.  So, the mail server config used for
> sending the messages will be lost?

True, you would need to store the envelope info somewhere (maybe just at 
top of text message).  As for other session information, perhaps just 
stick with the same approach and store all session properties to the 
text file as well.

> Another question: When I send mail, I am assuming that I will have to tell
> Session to use a different transport (going to mean messing with
> commons-sandbox-email because this is fixed to smtp).  If I use the same
> session for sending mails, then I guess I will have to revert to smtp.

Hmm, I think I understand how you're thinking of doing this.  I would 
probably just call the Sun SMTP impl directly, although by relaying on 
the transport rules, you could create layers of transports.

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

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


RE: Integration into Tomcat

Posted by Daniel Perry <d....@netcase.co.uk>.
Well, this seems like a more complicated, but equally more useful approach.

So, I figure, I implement a transport.

This transport spools MimeMessages into the filesystem.

Upon spooling, it checks for a delivery thread. If one doesn't exist, it
creates one.

The delivery thread then looks for any spooled messages, and if it finds any
it attempts to deliver them using suns smtp transport.  Any it delivers it
deletes.  Any failures it does nothing.

Once it reaches the end of the spool, it checks for spooled messages.  If it
finds any, it sleeps for X minutes, and repeats process.  If spool is empty,
it ends.

Sound about right?

Looking through the JavaMail docs, it seems the smtp settings are included
in the MimeMail via session in Message.  Now I'm guessing that session wont
be stored if I use the writeTo method.  So, the mail server config used for
sending the messages will be lost?

I guess the delivery thread could be handed the Session settings from the
first email that it attempts to deliver.  This would mean that after a
failure, it could not start delivery until a messages is injected into the
spool.

Another question: When I send mail, I am assuming that I will have to tell
Session to use a different transport (going to mean messing with
commons-sandbox-email because this is fixed to smtp).  If I use the same
session for sending mails, then I guess I will have to revert to smtp.

Any thoughts?

Daniel.


> -----Original Message-----
> From: Serge Knystautas [mailto:sergek@lokitech.com]
> Sent: 24 May 2004 17:39
> To: James Users List
> Subject: Re: Integration into Tomcat
>
>
> Daniel Perry wrote:
> > My favoured option is to write a struts plug-in, which uses a simple
> > database table to queue messages (reliable) or a vector (less
> reliable but
> > simpler), and implements an inject method, and this causes a
> thread to be
> > started if no thread exists that deals with delivery.  This thread
> > periodically find any messages, tries to send them, and if successful
> > deletes them.  At the end of it's attempts, if the queue is empty, it
> > finishes, otherwise it sleeps, and starts again.
>
> My suggestion is to implement a JavaMail Transport.  Have this transport
> use the existing SMTP transport, and if the delivery fails, spool
> messages to the local file system.  A thread will also need to run to
> check that spool and retry indefinitely.
>
> This approach is very easy to plugin to a number of environments, I
> would use disk over a DB since it is the easiest way to remove any
> remote system dependencies, and can still survive JVM crashes and
> restarts.  Reading and writing MimeMessage to disk is very easy, too.
>
> I would be very interested in this since I've been meaning to write
> something like for a while, but have about 20 of these projects and 0
> time. :(
>
> --
> Serge Knystautas
> President
> Lokitech >> software . strategy . design >> http://www.lokitech.com
> p. 301.656.5501
> e. sergek@lokitech.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>


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


Re: Direct all mails to custom class

Posted by Cadbury <co...@yahoo.com>.
regarding my question here earlier, do anyone here have a sample code on how to implement the AbstractRedirect mailet to function as I need..? 
 
thanx.
Cadbury <co...@yahoo.com> wrote:
it's ok tobe. regarding my q
> 2) then Apache James would email the (should be) recipient of the 
> email a message saying that he/she have got an email...
> 
 
what I actually want is just like Noel write down here. But honestly i have only a little idea on how to implement it.. where can I get the AbstractRedirect/AbstractNotifier mailet? 
 
thanx for helping.. 
------------------------------------------------------------------------------------------------------------
Cadbury wrote:
> what I actually want is a Mailet that will send notification to
> the receiver(user B) that the sender (user A) sends user B an email

You want a NotifyRecipient type mailet.  That is very easy to do.  You 
could
start with the AbstractRedirect / AbstractNotifier family of mailets.  
See
the source distribution.  Basically, you want to send a new e-mail to 
the
original recipient saying something about the other message, which I 
presume
you will stored elsewhere.  You could probably use an existing mailet, 
but
not if you want to provide a "pretty" message body with replaced 
fields.

Actually, it would be worthwhile to modify the notifier code to use the 
same
code we put into the new mailing list manager.  I'm thinking something 
along
the lines of ${<HEADER>} being replaced with the value of that header 
from
the original e-mail.

--- Noel

----------------------------------------------------------------------------------------------------------------
tobe <to...@swipnet.se> wrote: Sorry for taking so long, have been away:

Cadbury wrote:

>
> 2) then Apache James would email the (should be) recipient of the 
> email a message saying that he/she have got an email...
> 

Is this mail sent through James? How does it get handled by the 
processor? Are your mails looping?

/tobe


---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Re: Direct all mails to custom class

Posted by Cadbury <co...@yahoo.com>.
it's ok tobe. regarding my q
> 2) then Apache James would email the (should be) recipient of the 
> email a message saying that he/she have got an email...
> 
 
what I actually want is just like Noel write down here. But honestly i have only a little idea on how to implement it.. where can I get the AbstractRedirect/AbstractNotifier mailet? 
 
thanx for helping.. 
------------------------------------------------------------------------------------------------------------
Cadbury wrote:
> what I actually want is a Mailet that will send notification to
> the receiver(user B) that the sender (user A) sends user B an email

You want a NotifyRecipient type mailet.  That is very easy to do.  You 
could
start with the AbstractRedirect / AbstractNotifier family of mailets.  
See
the source distribution.  Basically, you want to send a new e-mail to 
the
original recipient saying something about the other message, which I 
presume
you will stored elsewhere.  You could probably use an existing mailet, 
but
not if you want to provide a "pretty" message body with replaced 
fields.

Actually, it would be worthwhile to modify the notifier code to use the 
same
code we put into the new mailing list manager.  I'm thinking something 
along
the lines of ${<HEADER>} being replaced with the value of that header 
from
the original e-mail.

	--- Noel

----------------------------------------------------------------------------------------------------------------
tobe <to...@swipnet.se> wrote:Sorry for taking so long, have been away:

Cadbury wrote:

>
> 2) then Apache James would email the (should be) recipient of the 
> email a message saying that he/she have got an email...
> 

Is this mail sent through James? How does it get handled by the 
processor? Are your mails looping?

/tobe

		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Re: Direct all mails to custom class

Posted by tobe <to...@swipnet.se>.
Sorry for taking so long, have been away:

Cadbury wrote:

>
> 2) then Apache James would email the (should be) recipient of the 
> email a message saying that he/she have got an email...
>  

Is this mail sent through James? How does it get handled by the 
processor? Are your mails looping?

/tobe

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


Re: Direct all mails to custom class

Posted by Cadbury <co...@yahoo.com>.
thank God tobe for replying to my question..really thought nobody was replying when what actually happened was most of my emails went to bulk mail folder..don't know why.. anyway here's the code for UnavailableMessageSave. actually i got all this from http://www-106.ibm.com/developerworks/java/library/j-james2.html 
actually what i'm actually trying to do is:
1) when Apache James receive any email, instead of it deliver the email to the intended recipient, it will just store the email in the server and no more processing of the email should be done.
2) then Apache James would email the (should be) recipient of the email a message saying that he/she have got an email...
 
hope you understand my question..really need someone to help me since I've been at this thing for more than a week...thanx again for helping..
 
--------------------------------------------------------------------------------------------------------------------------------
Note the way we deal with exceptions. The log() method is used to ensure that problems are reported, but you'll have to check the logs if you don't see the behavior you expected. Also, notice that we set the state for the e-mail to GHOST. This stops processing on the sent e-mail, because we'll be storing it ourselves and no additional action is required by the e-mail server. 
Listing 5. UnavailableMessageSave: Saving messages sent to unavailable@emailserver

package com.claudeduguay.mailets;import java.io.*;import java.util.*;import javax.mail.*;import javax.mail.internet.*;import org.apache.mailet.*;public class UnavailableMessageSave  extends UnavailableMessageBase{  protected String subject;  protected String content;    public void init(MailetConfig config)    throws MessagingException  {    super.init(config);    subject = getInitParameter("subject");    content = getInitParameter("content");  }    public void service(Mail mail)    throws MessagingException  {    MailAddress sender = mail.getSender();    Collection recipients = mail.getRecipients();    MailAddress address = getFirstAddress(recipients);    MailetContext context = getMailetContext();    try    {      MimeMessage msg = (MimeMessage)mail.getMessage();      store.storeMessage(sender, msg);      mail.setState(Mail.GHOST);    }    catch (IOException e)    {      log("Unable to store user message", e);    }    try    {      MimeMessage msg = createMessage(address, sender,
 subject, content);      Collection target = addressAsCollection(sender);      context.sendMail(address, target, msg);    }    catch (MessagingException e)    {      log("Unable to send confirmation message", e);    }  }}


tobe <to...@swipnet.se> wrote:
Where do the e-mails actually go that you send from your 
UnavailableMessageSave?

/tobe


		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Re: Direct all mails to custom class

Posted by tobe <to...@swipnet.se>.
Where do the e-mails actually go that you send from your 
UnavailableMessageSave?

/tobe

Cadbury wrote:

> hi all...
>  
> i've some problems here n any help are greatly appreciated...
> i want to try directing all emails to be handled by my custom class 
> instead of the default ToProcessor...
>  
> here's a part of my config.xml file for my james. What it does here 
> basically is any e-mails to unavailable@localhost 
> <ma...@localhost>  will be handled by 
> MatchSingleRecipient and UnavailableMessageSave, right?
>  
>  
>  <mailet match="MatchSingleRecipient=unavailable@localhost " 
> class="UnavailableMessageSave">
> <folder>C:/james-2.1.3/unavailable</folder>
> <subject>You have been marked as UNAVAILABLE</subject>
> <content>Send a message to available@localhost 
> <ma...@localhost> to reset.</content></mailet>
>  
> And here's another part of the config.xml:
>  
>  <mailet match="All" class="ToProcessor">
>             <processor> transport </processor>
>          </mailet>
>       </processor>
>  
> And basically what it does is here is it will handle all emails other 
> than to unavailable@localhost to be handled by ToProcessor, right?
> But what I need to do here is to direct _all_  e-mails to my custom 
> class UnavailableMessageSave.. so I did this...
>  
> * <mailet match="All " *
> *class="UnavailableMessageSave">*
> <folder>C:/james-2.1.3/unavailable</folder>
> <subject>You have been marked as UNAVAILABLE</subject>
> <content>Send a message to available@localhost 
> <ma...@localhost> to reset.</content></mailet> and I 
> deleted the
>  
>  <mailet match="All" class="ToProcessor">
>             <processor> transport </processor>
>          </mailet>
>       </processor>
>  
> tag...but it seems there's still a problem..cause when I checked my 
> inbox there should be the message "You have been marked as 
> UNAVAILABLE", right? But all my inbox are empty... so what really 
> should I do?
>  
> really need some help here.. i'm still a student and so much more to 
> learn...
>  
> thanx
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger 
> <http://messenger.yahoo.com/> 



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


Direct all mails to custom class

Posted by Cadbury <co...@yahoo.com>.
hi all... 
 
i've some problems here n any help are greatly appreciated...
i want to try directing all emails to be handled by my custom class instead of the default ToProcessor...
 
here's a part of my config.xml file for my james. What it does here basically is any e-mails to unavailable@localhost  will be handled by MatchSingleRecipient and UnavailableMessageSave, right?
 
 
 <mailet match="MatchSingleRecipient=unavailable@localhost " 
class="UnavailableMessageSave">
<folder>C:/james-2.1.3/unavailable</folder>
<subject>You have been marked as UNAVAILABLE</subject>
<content>Send a message to available@localhost to reset.</content></mailet>
 
And here's another part of the config.xml:
 
 <mailet match="All" class="ToProcessor">
            <processor> transport </processor>
         </mailet>
      </processor>
 
And basically what it does is here is it will handle all emails other than to unavailable@localhost to be handled by ToProcessor, right? 
But what I need to do here is to direct all  e-mails to my custom class UnavailableMessageSave.. so I did this...
 
 <mailet match="All " 
class="UnavailableMessageSave">
<folder>C:/james-2.1.3/unavailable</folder>
<subject>You have been marked as UNAVAILABLE</subject>
<content>Send a message to available@localhost to reset.</content></mailet> and I deleted the 
 
 <mailet match="All" class="ToProcessor">
            <processor> transport </processor>
         </mailet>
      </processor>
 
tag...but it seems there's still a problem..cause when I checked my inbox there should be the message "You have been marked as UNAVAILABLE", right? But all my inbox are empty... so what really should I do?
 
really need some help here.. i'm still a student and so much more to learn...
 
thanx 


		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Re: Integration into Tomcat

Posted by Serge Knystautas <se...@lokitech.com>.
Daniel Perry wrote:
> My favoured option is to write a struts plug-in, which uses a simple
> database table to queue messages (reliable) or a vector (less reliable but
> simpler), and implements an inject method, and this causes a thread to be
> started if no thread exists that deals with delivery.  This thread
> periodically find any messages, tries to send them, and if successful
> deletes them.  At the end of it's attempts, if the queue is empty, it
> finishes, otherwise it sleeps, and starts again.

My suggestion is to implement a JavaMail Transport.  Have this transport 
use the existing SMTP transport, and if the delivery fails, spool 
messages to the local file system.  A thread will also need to run to 
check that spool and retry indefinitely.

This approach is very easy to plugin to a number of environments, I 
would use disk over a DB since it is the easiest way to remove any 
remote system dependencies, and can still survive JVM crashes and 
restarts.  Reading and writing MimeMessage to disk is very easy, too.

I would be very interested in this since I've been meaning to write 
something like for a while, but have about 20 of these projects and 0 
time. :(

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

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


RE: Integration into Tomcat

Posted by Daniel Perry <d....@netcase.co.uk>.
> What I have now is Postfix running on "localhost", which is roughly
> equivalent. However, if Postfix dies, I have a problem because e-mails
> may be lost.
>
> With an integrated James, if James dies, my entire JVM dies, and ...
> a) I have a problem to solve anyway (my app is down) ;-)
> b) But no e-mail is lost.
> c) Other app servers will continue serving requests, so users will not
> notice.

Hmm... valid suggestion, but i'm not sure if it's practicle.  From what i
understand, james runs under phoenix.  I'm not sure how easy it would be to
embed it.  Secondly, a james dist is about 5mb, and on my server is using
about 40 mb of memory (30 active).


> >Am also beggining to write a more lightweight solution that implements a
> >simple queueing system, with mails periodically sent on to a gateway by a
> >background thread.
> >
> >
>
> And why have you discarded integrating James' spooling system? It's
> already done.
>
> Antonio Fiol

Not necessarily, currently weighing up options.

I havnt looked into extracting the bits of james i want, but i figure it's
going to be easier to write a lightweight solution from scratch.

My favoured option is to write a struts plug-in, which uses a simple
database table to queue messages (reliable) or a vector (less reliable but
simpler), and implements an inject method, and this causes a thread to be
started if no thread exists that deals with delivery.  This thread
periodically find any messages, tries to send them, and if successful
deletes them.  At the end of it's attempts, if the queue is empty, it
finishes, otherwise it sleeps, and starts again.

I reckon this is going to take two or three simple classes, and so should be
a lot simpler to implement than embedding james.

If you can see any flaws here, please do let me know :)

Daniel.


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


Re: Integration into Tomcat

Posted by Antonio Fiol Bonnín <fi...@terra.es>.
Hi Daniel,

Thanks for your reply.


Daniel Perry wrote:

>I've got a similar kind of thing going on in a webapp.
>
>However i'm just running james on the same server, and using commons-sandbox
>email to send messages to james via smtp.
>  
>

What I have now is Postfix running on "localhost", which is roughly 
equivalent. However, if Postfix dies, I have a problem because e-mails 
may be lost.

With an integrated James, if James dies, my entire JVM dies, and ...
a) I have a problem to solve anyway (my app is down) ;-)
b) But no e-mail is lost.
c) Other app servers will continue serving requests, so users will not 
notice.

>Am also beggining to write a more lightweight solution that implements a
>simple queueing system, with mails periodically sent on to a gateway by a
>background thread.
>  
>

And why have you discarded integrating James' spooling system? It's 
already done.

Antonio Fiol



>Daniel.
>
>  
>
>>-----Original Message-----
>>From: Antonio Fiol Bonnin [mailto:fiol.bonnin@terra.es]
>>Sent: 21 May 2004 06:43
>>To: James Users List
>>Subject: Integration into Tomcat
>>
>>
>>Hello,
>>
>>This is my first post to the list, so "Hello to all!".
>>
>>I was wondering if one can easily integrate James into Tomcat. I was
>>thinking of something similar to what you can see in Wiki about JBoss.
>>
>>By the way, that page deceived me, because the link referred to Tomcat,
>>and then, Tomcat vanished ;-)
>>
>>I imagine it is possible to add the mbean descriptor somewhere in
>>Tomcat's server.xml. But before trying to do it the hard way, I was
>>wondering whether someone else had done it before.
>>
>>I am using Tomcat 5.0.18, if that matters, and I am not a James user
>>yet, so I will accomodate to whatever configuration works.
>>
>>Also, we are using Tomcat in a load-balanced configuration (for now,
>>without session replication, only session stickyness). So, if it is
>>possible to integrate James and Tomcat, it would also be useful to know
>>if James can be clustered in such a way. I mean: If using a database for
>>storing, should there be one or two instances of the database? If using
>>a file system based storage, should it be local to each James instance
>>or shared on NFS? (My guess, two DB instances, local storage, but I know
>>very little about James)
>>
>>Thank you very much for any pointer to the right way.
>>
>>Antonio Fiol
>>
>>
>>
>>P.S. My intentions, for the curious:
>>I would like to have all my webapps (four very different ones,
>>comprising about a dozen Tomcat contexts) handling outgoing e-mails in a
>>safe way. Safe handling simply means "not losing mails, retrying if
>>smarthost fails".
>>I thought that I could re-use James spooling system and SMTP client to
>>spool mails and relay to our smarthost.
>>I think I will have to code an "input" block (however that is called in
>>James' vocabulary) so that I can directly get mails from my Java app to
>>the spool in a synchronous way, so that I know for sure that the message
>>is spooled and, hence, not lost.
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>For additional commands, e-mail: server-user-help@james.apache.org
>
>
>  
>


RE: Integration into Tomcat

Posted by Daniel Perry <d....@netcase.co.uk>.
I've got a similar kind of thing going on in a webapp.

However i'm just running james on the same server, and using commons-sandbox
email to send messages to james via smtp.

Am also beggining to write a more lightweight solution that implements a
simple queueing system, with mails periodically sent on to a gateway by a
background thread.

Daniel.

> -----Original Message-----
> From: Antonio Fiol Bonnin [mailto:fiol.bonnin@terra.es]
> Sent: 21 May 2004 06:43
> To: James Users List
> Subject: Integration into Tomcat
>
>
> Hello,
>
> This is my first post to the list, so "Hello to all!".
>
> I was wondering if one can easily integrate James into Tomcat. I was
> thinking of something similar to what you can see in Wiki about JBoss.
>
> By the way, that page deceived me, because the link referred to Tomcat,
> and then, Tomcat vanished ;-)
>
> I imagine it is possible to add the mbean descriptor somewhere in
> Tomcat's server.xml. But before trying to do it the hard way, I was
> wondering whether someone else had done it before.
>
> I am using Tomcat 5.0.18, if that matters, and I am not a James user
> yet, so I will accomodate to whatever configuration works.
>
> Also, we are using Tomcat in a load-balanced configuration (for now,
> without session replication, only session stickyness). So, if it is
> possible to integrate James and Tomcat, it would also be useful to know
> if James can be clustered in such a way. I mean: If using a database for
> storing, should there be one or two instances of the database? If using
> a file system based storage, should it be local to each James instance
> or shared on NFS? (My guess, two DB instances, local storage, but I know
> very little about James)
>
> Thank you very much for any pointer to the right way.
>
> Antonio Fiol
>
>
>
> P.S. My intentions, for the curious:
> I would like to have all my webapps (four very different ones,
> comprising about a dozen Tomcat contexts) handling outgoing e-mails in a
> safe way. Safe handling simply means "not losing mails, retrying if
> smarthost fails".
> I thought that I could re-use James spooling system and SMTP client to
> spool mails and relay to our smarthost.
> I think I will have to code an "input" block (however that is called in
> James' vocabulary) so that I can directly get mails from my Java app to
> the spool in a synchronous way, so that I know for sure that the message
> is spooled and, hence, not lost.
>
>


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