[Design of JBoss jBPM] - Re: jBPM 4 Emails Sync vs Async
by bradsdavis
The email object itself contains the destination properties.
An email itself depending on its type [simple, mime, html] has different content types. The base email object always has to, cc, bcc.
See: http://commons.apache.org/email/userguide.html
The sending of multiple emails is to add flexibility. Generally you will want to produce one email with multiple to/cc/bccs defined. However, there is a business case where the email producer could produce multiple emails with one to address. An example would be a customer facing email.
Let's say a healthcare company needs to produce an email to all of its patients. They could create a custom email producer that produces multiple emails, one for each patient, personallized to that patient. Each email containing one to address, the patients. Maybe the business process is as follows.
Office closed business process.
1) Send email to each patient telling them their appointment has been cancelled, and to call us.
2) Send email to all practitioners to tell them not to come in.
For the patient emails, the email maybe should read "Brad Davis, your appointment for 10:00 AM has been canceled due to inclement weather." But this should be per patient. So, yours reads "Tom Baeyens, your appointment for 11:00 AM has been canceled due to inclement weather." and so on and so forth.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224075#4224075
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224075
15 years, 1 month
[Design of JBoss jBPM] - Re: jBPM 4 Emails Sync vs Async
by tom.baeyens@jboss.com
"bradsdavis" wrote : 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.
|
i agree.
but in development we need to go step by step.
let's first develop the synchronous mail functionality. and in a subsequent iteration, add the ability to send them asynchronously.
and then let's work on the configuration options in the global jbpm.cfg.xml and in the jpdl process files.
"bradsdavis" wrote : 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.
| ...
| By making it plugable, anyone can create a producer that extends our base type and adds attachments as needed.
|
such a framework is good and should be build before this interface. the base class should use this MailSession to send emails. Users should be able to configure their customized SendMail activity. The basic SendMail should be designed for inheritence and customization.
but again. let's go step by step. let's first get the basics working and then add the advanced features like this in subsequent iterations.
"bradsdavis" wrote : 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.
i don't see why you want to send multiple emails and get rid of the destination properties. can you elaborate on that ?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224066#4224066
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224066
15 years, 1 month
[Design of JBoss jBPM] - Re: jBPM 4 Emails Sync vs Async
by bradsdavis
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#4224061
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224061
15 years, 1 month
[Design of JBoss jBPM] - Re: jBPM 4 Emails Sync vs Async
by tom.baeyens@jboss.com
"bradsdavis" wrote : OK. I think I have a solution to this.
|
| Both the synchronous and asynchronous emailer will implement the same interface, so they will be interchangeable. The asynchronous will use the synchronous emailler under the hood, it will just be called by the job executor.
Close. I discussed with Alejandro yesterday:
we need a MailSession interface for that. mail session would look something like this
interface MailSession {
| Mail createMail();
| }
|
| interface Mail {
| 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);
|
| void send(boolean sendAsync);
| }
we thought it was easiest to develop something like the interface shown above.
Activies can get a MailSession from the current environment. But we don't need 2 different implementations.
Clients of this code (Activities) would need to determine if sending needs to be done asynchronous or not. this should eventually be based on a global process engine configuration that specifies the default and jpdl attributes that allow to overwrite this default.
Does this match with your expectations, Brad ?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224054#4224054
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224054
15 years, 1 month