X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.activemq%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fjms%2FJmsSlcExecutionNotifier.java;h=256e837abf11c67897c38daf2c3976496a6eb4dc;hb=719f374a748e531ae706115252978e06ad72c308;hp=801c6fae32a730fc9204dde886ec931f8e8b9cf5;hpb=8328dc992e509741b6b9a5036cc7c10089c116f2;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java index 801c6fae3..256e837ab 100644 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java +++ b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsSlcExecutionNotifier.java @@ -4,31 +4,39 @@ import java.util.List; import javax.jms.Destination; -import org.argeo.slc.SlcException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.argeo.slc.UnsupportedException; import org.argeo.slc.msg.process.SlcExecutionStatusRequest; +import org.argeo.slc.msg.process.SlcExecutionStepsRequest; import org.argeo.slc.process.SlcExecution; import org.argeo.slc.process.SlcExecutionNotifier; import org.argeo.slc.process.SlcExecutionStep; +import org.springframework.jms.JmsException; import org.springframework.jms.core.JmsTemplate; public class JmsSlcExecutionNotifier implements SlcExecutionNotifier { + private final static Log log = LogFactory + .getLog(JmsSlcExecutionNotifier.class); private JmsTemplate jmsTemplate; private Destination executionEventDestination; - //private Destination updateStatusDestination; + + // private Destination updateStatusDestination; public void updateStatus(SlcExecution slcExecution, String oldStatus, String newStatus) { SlcExecutionStatusRequest req = new SlcExecutionStatusRequest( slcExecution.getUuid(), newStatus); - jmsTemplate.convertAndSend(executionEventDestination, req); + convertAndSend(req); } public void addSteps(SlcExecution slcExecution, List additionalSteps) { - throw new UnsupportedException(); + SlcExecutionStepsRequest req = new SlcExecutionStepsRequest( + slcExecution.getUuid(), additionalSteps); + convertAndSend(req); } public void newExecution(SlcExecution slcExecution) { @@ -43,14 +51,19 @@ public class JmsSlcExecutionNotifier implements SlcExecutionNotifier { this.jmsTemplate = jmsTemplate; } - public void setExecutionEventDestination(Destination executionEventDestination) { + public void setExecutionEventDestination( + Destination executionEventDestination) { this.executionEventDestination = executionEventDestination; } - - -// public void setUpdateStatusDestination(Destination updateStatusDestination) { -// this.updateStatusDestination = updateStatusDestination; -// } - + protected void convertAndSend(Object req) { + try { + jmsTemplate.convertAndSend(executionEventDestination, req); + } catch (JmsException e) { + log.warn("Send request " + req.getClass() + " to server: " + + e.getMessage()); + if (log.isTraceEnabled()) + log.debug("Original error.", e); + } + } }