Skip to content

Commit

Permalink
allow response queue for JMS agent to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ssadedin committed Jan 9, 2018
1 parent 310917a commit 453f9b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/main/groovy/bpipe/Utils.groovy
Expand Up @@ -1036,6 +1036,8 @@ class Utils {
} }


static closeQuietly(obj) { static closeQuietly(obj) {
if(obj == null)
return
try { try {
obj.close() obj.close()
} }
Expand Down
20 changes: 15 additions & 5 deletions src/main/groovy/bpipe/agent/JMSAgent.groovy
Expand Up @@ -154,9 +154,6 @@ class JMSAgent extends Agent {
if(!(config.containsKey('commandQueue'))) if(!(config.containsKey('commandQueue')))
throw new PipelineError("ActiveMQ configuration is missing required key 'queue'") throw new PipelineError("ActiveMQ configuration is missing required key 'queue'")


if(!(config.containsKey('responseQueue')))
throw new PipelineError("ActiveMQ configuration is missing required key 'responseQueue'")

log.info "Connecting to: ${config.brokerURL}" log.info "Connecting to: ${config.brokerURL}"


this.connection = new ActiveMQConnectionFactory(brokerURL: config.brokerURL).createConnection() this.connection = new ActiveMQConnectionFactory(brokerURL: config.brokerURL).createConnection()
Expand All @@ -170,8 +167,21 @@ class JMSAgent extends Agent {


@Override @Override
public WorxConnection createConnection() { public WorxConnection createConnection() {
Queue queue = this.session.createQueue(config.responseQueue) if(config.containsKey('responseQueue')) {
return new JMSWorxConnection(queue, session) Queue queue = this.session.createQueue(config.responseQueue)
return new JMSWorxConnection(queue, session)
}
else {
// Create a dummy connection that does not send anything
return new WorxConnection() {

void sendJson(String path, String json) {}

Object readResponse() { [:] }

void close() { }
}
}
} }


} }

0 comments on commit 453f9b0

Please sign in to comment.