use of org.broadleafcommerce.common.email.service.exception.EmailException in project BroadleafCommerce by BroadleafCommerce.
the class EmailServiceMDP method onMessage.
/*
* (non-Javadoc)
* @see javax.jms.MessageListener#onMessage(javax.jms.Message)
*/
@SuppressWarnings("unchecked")
public void onMessage(Message message) {
try {
HashMap props = (HashMap) ((ObjectMessage) message).getObject();
messageCreator.sendMessage(props);
} catch (MailAuthenticationException e) {
throw new EmailException(e);
} catch (MailPreparationException e) {
throw new EmailException(e);
} catch (MailParseException e) {
throw new EmailException(e);
} catch (MailSendException e) {
/*
* TODO find the specific exception that results from the smtp
* server being down, and throw this as an EmailException.
* Otherwise, log and then swallow this exception, as it may have
* been possible that this email was actually sent.
*/
throw new EmailException(e);
} catch (JMSException e) {
throw new EmailException(e);
}
}
use of org.broadleafcommerce.common.email.service.exception.EmailException in project BroadleafCommerce by BroadleafCommerce.
the class EmailServiceImpl method sendBasicEmail.
public boolean sendBasicEmail(EmailInfo emailInfo, EmailTarget emailTarget, Map<String, Object> props) {
if (props == null) {
props = new HashMap<String, Object>();
}
if (emailInfo == null) {
emailInfo = new EmailInfo();
}
props.put(EmailPropertyType.INFO.getType(), emailInfo);
props.put(EmailPropertyType.USER.getType(), emailTarget);
if (Boolean.parseBoolean(emailInfo.getSendEmailReliableAsync())) {
if (emailServiceProducer == null) {
throw new EmailException("The property sendEmailReliableAsync on EmailInfo is true, but the EmailService does not have an instance of JMSEmailServiceProducer set.");
}
emailServiceProducer.send(props);
} else {
messageCreator.sendMessage(props);
}
return true;
}
Aggregations