make from-address of service-email configurable
This commit is contained in:
parent
f52ab72b7a
commit
3b01d27a1d
@ -26,7 +26,7 @@ import javax.naming.InitialContext;
|
||||
|
||||
public class QueueServer extends QueueCommons implements MessageListener, ExceptionListener {
|
||||
|
||||
private static final String VERSION_NO = "1.1";
|
||||
private static final String VERSION_NO = "1.1.1";
|
||||
|
||||
private Logger logger;
|
||||
private QueueConnection conn;
|
||||
@ -37,6 +37,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
|
||||
private String jmsSystemQueue;
|
||||
private String jmsFactory;
|
||||
private String serviceEMail;
|
||||
private String fromEMail;
|
||||
|
||||
/**
|
||||
* Runs the QueueServer, using the arguments as ConnectionFactory
|
||||
@ -63,6 +64,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
|
||||
qServ.setJmsUserName(props.getProperty("hsadmin.jms.username"));
|
||||
qServ.setJmsPassWord(props.getProperty("hsadmin.jms.password"));
|
||||
qServ.setServiceEMail(props.getProperty("hsadmin.log.email"));
|
||||
qServ.setFromEMail(props.getProperty("hsadmin.log.from"));
|
||||
Logger logger = Logger.getLogger("de.hsadmin.core.qserv");
|
||||
logger.log(Level.CONFIG, "hsadmin-qserv " + VERSION_NO + " started using:"
|
||||
+ "\nqueue server: " + props.getProperty("hsadmin.jms.factory")
|
||||
@ -109,6 +111,14 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
|
||||
}
|
||||
}
|
||||
|
||||
private void setFromEMail(String emailAddress) {
|
||||
if (emailAddress == null || emailAddress.isEmpty()) {
|
||||
fromEMail = "hsadmin@hostsharing.net";
|
||||
} else {
|
||||
fromEMail = emailAddress;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean connect() {
|
||||
// create JMS connection and session
|
||||
try {
|
||||
@ -145,7 +155,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
|
||||
} catch (ProcessorException e) {
|
||||
logException(e);
|
||||
task.setException(e);
|
||||
SmtpHelper.send("hostmaster@hostsharing.net", serviceEMail, jmsSystemQueue, processor.logInfo());
|
||||
SmtpHelper.send(fromEMail, serviceEMail, jmsSystemQueue, processor.logInfo());
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
logException(throwable);
|
||||
|
Loading…
Reference in New Issue
Block a user