I personally think that in an enterprise environment, the majority of emails won't be
synchronous. I think we should make it asynchronous by default and only send synchronously
when defined as such.
Also, I think that the content [subject, body, attachments] should be separate from the
recipients. The actual produced content may change per a client's need.
The implementation I was working towards allowed email producers to produce one or more
base email type, which internally would be either:
1) Simple emails [think text]
2) Mime emails [think text with attachments]
3) Html emails [templated emails with images, etc]
By making it plugable, anyone can create a producer that extends our base type and adds
attachments as needed.
I think an activity should produce one or more emails and send them to the mail service,
which I think you are calling MailSession.
So, I think the interface should look more like:
| package org.jbpm.pvm.internal.email.service;
|
| import java.util.Collection;
|
| import org.apache.commons.mail.Email;
|
| public interface MailService {
| public void send(Collection<Email> emails);
| }
|
Because the emails at this point already have their email addresses [to, cc, bcc], body,
and attachments defined at the point they are sent to the mail service, there is no need
for the mail service to care about:
| Mail setTo(String to);
| Mail setCC(String cc);
| Mail setBCC(String bcc);
| Mail setSubject(String subject);
| Mail setBody(String subject);
| Mail addAttachment(String name, InputStream attachment, String mimeType);
|
It would literally just be for servicing the sending of the base class Email.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224061#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...