1 package org
.argeo
.slc
.jms
;
5 import javax
.jms
.Destination
;
7 import org
.apache
.commons
.logging
.Log
;
8 import org
.apache
.commons
.logging
.LogFactory
;
9 import org
.argeo
.slc
.UnsupportedException
;
10 import org
.argeo
.slc
.msg
.process
.SlcExecutionStatusRequest
;
11 import org
.argeo
.slc
.msg
.process
.SlcExecutionStepsRequest
;
12 import org
.argeo
.slc
.process
.SlcExecution
;
13 import org
.argeo
.slc
.process
.SlcExecutionNotifier
;
14 import org
.argeo
.slc
.process
.SlcExecutionStep
;
15 import org
.springframework
.jms
.JmsException
;
16 import org
.springframework
.jms
.core
.JmsTemplate
;
18 public class JmsSlcExecutionNotifier
implements SlcExecutionNotifier
{
19 private final static Log log
= LogFactory
20 .getLog(JmsSlcExecutionNotifier
.class);
22 private JmsTemplate jmsTemplate
;
24 private Destination executionEventDestination
;
26 // private Destination updateStatusDestination;
28 public void updateStatus(SlcExecution slcExecution
, String oldStatus
,
30 SlcExecutionStatusRequest req
= new SlcExecutionStatusRequest(
31 slcExecution
.getUuid(), newStatus
);
35 public void addSteps(SlcExecution slcExecution
,
36 List
<SlcExecutionStep
> additionalSteps
) {
37 SlcExecutionStepsRequest req
= new SlcExecutionStepsRequest(
38 slcExecution
.getUuid(), additionalSteps
);
42 public void newExecution(SlcExecution slcExecution
) {
43 throw new UnsupportedException();
46 public void updateExecution(SlcExecution slcExecution
) {
47 throw new UnsupportedException();
50 public void setJmsTemplate(JmsTemplate jmsTemplate
) {
51 this.jmsTemplate
= jmsTemplate
;
54 public void setExecutionEventDestination(
55 Destination executionEventDestination
) {
56 this.executionEventDestination
= executionEventDestination
;
59 protected void convertAndSend(Object req
) {
61 jmsTemplate
.convertAndSend(executionEventDestination
, req
);
62 } catch (JmsException e
) {
63 log
.warn("Send request " + req
.getClass() + " to server: "
65 if (log
.isTraceEnabled())
66 log
.debug("Original error.", e
);