07-19-2012 06:11 AM
07-19-2012 06:23 AM
07-19-2012 07:43 AM
07-19-2012 08:50 AM
07-19-2012 09:42 AM
07-20-2012 03:30 AM
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.inject.Inject;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import org.activiti.engine.ProcessEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/jms/queue/activitiJobExecutor"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
public class JobExecutorBean implements MessageListener {
protected static Logger log = LoggerFactory.getLogger(JobExecutorBean.class);
@Inject
protected ProcessEngine processEngine;
@Override
public void onMessage(Message message) {
String jobId = getJobIdFromMessage(message);
if (jobId != null) {
processEngine.getManagementService().executeJob(jobId);
}
}
protected String getJobIdFromMessage(Message message) {
if (message instanceof TextMessage) {
try {
TextMessage textMessage = (TextMessage) message;
log.debug("Recevied message over JMS: '{}'", textMessage.getText());
return textMessage.getText();
} catch (JMSException e) {
log.error("Error occured while reading JMS TextMessage", e);
return null;
}
}
return null;
}
}
07-20-2012 03:54 AM
07-20-2012 03:58 AM
08-01-2012 12:28 PM
08-02-2012 06:26 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.