1 package org
.argeo
.slc
.jms
;
6 import javax
.jms
.Destination
;
7 import javax
.jms
.JMSException
;
8 import javax
.jms
.Message
;
10 import org
.argeo
.slc
.msg
.ReferenceList
;
11 import org
.argeo
.slc
.runtime
.SlcAgent
;
12 import org
.argeo
.slc
.runtime
.SlcAgentFactory
;
13 import org
.springframework
.jms
.core
.JmsTemplate
;
14 import org
.springframework
.jms
.core
.MessagePostProcessor
;
16 public class JmsAgentProxyFactory
implements SlcAgentFactory
{
17 private Destination requestDestination
;
18 private Destination responseDestination
;
19 private Destination pingAllDestination
;
20 private JmsTemplate jmsTemplate
;
22 public SlcAgent
getAgent(String uuid
) {
23 return new JmsAgentProxy(uuid
, requestDestination
, responseDestination
,
27 public void pingAll(List
<String
> activeAgentIds
) {
28 ReferenceList referenceList
= new ReferenceList(activeAgentIds
);
29 jmsTemplate
.convertAndSend(pingAllDestination
, referenceList
,
30 new MessagePostProcessor() {
32 public Message
postProcessMessage(Message message
)
34 message
.setJMSCorrelationID(UUID
.randomUUID()
36 message
.setStringProperty(JmsAgent
.PROPERTY_QUERY
,
37 JmsAgent
.QUERY_PING_ALL
);
43 public void setRequestDestination(Destination requestDestination
) {
44 this.requestDestination
= requestDestination
;
47 public void setResponseDestination(Destination responseDestination
) {
48 this.responseDestination
= responseDestination
;
51 public void setJmsTemplate(JmsTemplate jmsTemplate
) {
52 this.jmsTemplate
= jmsTemplate
;
55 public void setPingAllDestination(Destination pingAllDestination
) {
56 this.pingAllDestination
= pingAllDestination
;