Hello,
I would like to create an Email Action class in my pipeline processing.
Can someone show me some sample code which emails in a simple POJO class
below is my code WHICH IS NOT COMPLETE:
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import org.apache.log4j.Logger;
import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.Email;
import org.jboss.soa.esb.message.Message;
public class EmailAction extends AbstractActionPipelineProcessor {
private static final Logger logger = Logger.getLogger(EmailAction.class);
public EmailAction (ConfigTree config) {
}
/**
* Put the message on the Email
*/
public Message process (Message message) throws ActionProcessingException {
Email email = null;
try {
String messageString = new String(message.getBody().getByteArray());
String sendTo = "some_one@old.com";
String sendFrom = "jboss_ebs_emailer@old.com";
String subject = "TEST EMAIL FROM JBOSS ESB SERVER";
email.setSendTo(sendTo);
email.setFrom(sendFrom);
email.setSubject(subject);
email.setMessage(messageString);
logger.info("***** EMAIL SENT *************");
} catch (Exception e) {
logger.error("process", e);
} finally {
try {
} catch (Exception e) {
logger.error("process{finally}", e);
}
}
return message;
}
}
Thanks