use of org.olat.course.certificate.model.JmsCertificateWork in project OpenOLAT by OpenOLAT.
the class CertificatesManagerImpl method onMessage.
@Override
public void onMessage(Message message) {
if (message instanceof ObjectMessage) {
try {
ObjectMessage objMsg = (ObjectMessage) message;
JmsCertificateWork workUnit = (JmsCertificateWork) objMsg.getObject();
doCertificate(workUnit);
message.acknowledge();
} catch (JMSException e) {
log.error("", e);
} finally {
dbInstance.commitAndCloseSession();
}
}
}
use of org.olat.course.certificate.model.JmsCertificateWork in project OpenOLAT by OpenOLAT.
the class CertificatesManagerImpl method sendJmsCertificateFile.
private void sendJmsCertificateFile(Certificate certificate, CertificateTemplate template, Float score, Boolean passed, boolean sendMail) {
QueueSender sender;
QueueSession session = null;
try {
JmsCertificateWork workUnit = new JmsCertificateWork();
workUnit.setCertificateKey(certificate.getKey());
if (template != null) {
workUnit.setTemplateKey(template.getKey());
}
workUnit.setPassed(passed);
workUnit.setScore(score);
workUnit.setSendMail(sendMail);
session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
ObjectMessage message = session.createObjectMessage();
message.setObject(workUnit);
sender = session.createSender(getJmsQueue());
sender.send(message);
} catch (JMSException e) {
log.error("", e);
} finally {
if (session != null) {
try {
session.close();
} catch (JMSException e) {
// last hope
}
}
}
}
use of org.olat.course.certificate.model.JmsCertificateWork in project openolat by klemens.
the class CertificatesManagerImpl method onMessage.
@Override
public void onMessage(Message message) {
if (message instanceof ObjectMessage) {
try {
ObjectMessage objMsg = (ObjectMessage) message;
JmsCertificateWork workUnit = (JmsCertificateWork) objMsg.getObject();
doCertificate(workUnit);
message.acknowledge();
} catch (JMSException e) {
log.error("", e);
} finally {
dbInstance.commitAndCloseSession();
}
}
}
use of org.olat.course.certificate.model.JmsCertificateWork in project openolat by klemens.
the class CertificatesManagerImpl method sendJmsCertificateFile.
private void sendJmsCertificateFile(Certificate certificate, CertificateTemplate template, Float score, Boolean passed, boolean sendMail) {
QueueSender sender;
QueueSession session = null;
try {
JmsCertificateWork workUnit = new JmsCertificateWork();
workUnit.setCertificateKey(certificate.getKey());
if (template != null) {
workUnit.setTemplateKey(template.getKey());
}
workUnit.setPassed(passed);
workUnit.setScore(score);
workUnit.setSendMail(sendMail);
session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
ObjectMessage message = session.createObjectMessage();
message.setObject(workUnit);
sender = session.createSender(getJmsQueue());
sender.send(message);
} catch (JMSException e) {
log.error("", e);
} finally {
if (session != null) {
try {
session.close();
} catch (JMSException e) {
// last hope
}
}
}
}
Aggregations