Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/main/groovy/bpipe/agent/JMSAgent.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,19 @@ class JMSAgent extends Agent {
this.session = connection.createSession(false,
acknowledgeMode == 'read' ? Session.AUTO_ACKNOWLEDGE : ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE)
this.queue = session.createQueue((String)config.commandQueue)
this.consumer = session.createConsumer(queue)


if (config.containsKey('userMessageSelector') && config['userMessageSelector']) {
String username = System.getProperty('user.name')
String messageSelector = "user='$username'"
File userHome = new File(System.getProperty('user.home'))
assert userHome.canRead() && userHome.canonicalPath.endsWith(username), "Directory $userHome is not readable or does not reconcile with $username"
log.info("Creating consumer for queue=${queue.queueName} with messageSelector=$messageSelector")
this.consumer = session.createConsumer(queue, messageSelector)
} else {
log.info("Creating consumer for queue=${queue.queueName}")
this.consumer = session.createConsumer(queue)
}

log.info "Connected to ActiveMQ $config.commandQueue @ $config.brokerURL"
}

Expand Down