X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.activemq%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fjms%2FJmsAgentProxy.java;h=d3027c93dba717cd308fead2bd5ccf93b5901309;hb=a181e3d059185a9dc108e81f38c66f48f4e4aac8;hp=1c8c88709c4d950e3c68ff328390efce6a64483d;hpb=0bcca59c19e554f94ec03af0dc7c44047a2eade7;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java index 1c8c88709..d3027c93d 100644 --- a/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java +++ b/runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java @@ -29,6 +29,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.slc.SlcException; import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.execution.ExecutionProcess; import org.argeo.slc.msg.ExecutionAnswer; import org.argeo.slc.msg.MsgConstants; import org.argeo.slc.process.SlcExecution; @@ -53,6 +54,10 @@ public class JmsAgentProxy implements SlcAgent { this.jmsTemplate = jmsTemplate; } + public String getAgentUuid() { + return agentUuid; + } + public ExecutionModuleDescriptor getExecutionModuleDescriptor( final String moduleName, final String version) { return (ExecutionModuleDescriptor) sendReceive(new AgentMC( @@ -70,7 +75,15 @@ public class JmsAgentProxy implements SlcAgent { } public void runSlcExecution(SlcExecution slcExecution) { - sendReceive(new AgentMC("runSlcExecution", slcExecution)); + process(slcExecution); + } + + public void process(ExecutionProcess executionProcess) { + if (!(executionProcess instanceof SlcExecution)) + throw new SlcException("Unsupported process type " + + executionProcess.getClass()); + sendReceive(new AgentMC("runSlcExecution", + (SlcExecution) executionProcess)); } public boolean ping() { @@ -90,8 +103,10 @@ public class JmsAgentProxy implements SlcAgent { res = sendReceive(messageCreator, true); } finally { if (log.isTraceEnabled()) - log.trace("Agend proxy send/receive in " - + (System.currentTimeMillis() - begin) + " ms"); + log.trace("To agent #" + agentUuid + " in " + + (System.currentTimeMillis() - begin) + " ms, query '" + + messageCreator.getQuery() + "', correlationId " + + messageCreator.getCorrelationId()); } return res; } @@ -125,11 +140,6 @@ public class JmsAgentProxy implements SlcAgent { protected void send(AgentMC messageCreator) { jmsTemplate.send(requestDestination, messageCreator); - if (log.isTraceEnabled()) - log.debug("Sent query '" + messageCreator.getQuery() - + "' with correlationId " - + messageCreator.getCorrelationId() + " to agent " - + agentUuid); } protected Object processResponse(AgentMC messageCreator, @@ -154,10 +164,6 @@ public class JmsAgentProxy implements SlcAgent { else return null; } - if (log.isTraceEnabled()) - log.debug("Received response for query '" + query - + "' with correlationId " + correlationId + " from agent " - + agentUuid); try { return fromMessage(responseMsg); @@ -201,9 +207,7 @@ public class JmsAgentProxy implements SlcAgent { msg = session.createTextMessage(); else msg = toMessage(body, session); - msg - .setStringProperty(MsgConstants.PROPERTY_SLC_AGENT_ID, - agentUuid); + msg.setStringProperty(MsgConstants.PROPERTY_SLC_AGENT_ID, agentUuid); msg.setStringProperty(JmsAgent.PROPERTY_QUERY, query); msg.setJMSCorrelationID(correlationId); setArguments(msg);