sql.firstRow |
jms.firstMessage("myQueue") { println it.text
}
|
jms.onMessage(topic:"mytopic"){ m -> }
jms.onMessage(topic: "mytopic",durable:false){m -> }
jms.onMessage(queue:"myQueue"){ m -> }
jms.onMessage(queue:"myQueue",topic: "mytopic"){ m -> } //subscribe queue and topic at the same time
//onMessage supports only one listener per session; if you need multiple subscription, use core API subscribe method and specific different subscriptionName
jms.onMessage( topic: ['topic0', 'topic1']{ m -> }
jms.onMessage( queue: ['queue0', 'qeueu1']{ m -> }
jms.onMessage( topic:'mytopic', queue: ['queue0', 'qeueu1']{ m -> }
jms.stopMessage( topic:"myTopic") // unsubscribe the listener
jms.stopMessage( topic:['myTopic','myTopic2']) //TODO not implemented |
sql.execute() |
def result = jms.receive( fromQueue:'myQueue', within:1000)
jms.receive( fromQueue: 'myQueue', within:1000)
{ println it }
jms.receive( fromQueue:['queue0','queue1'], within:1000, with:
{ println it}) |
fromTopic and fromQueue could be used together
fromQueue always call receiveAll (to be enhanced to take a parameter to return only 1 message)
if fromQueue has more than one queue, it return all messages of all queues
fromTopic is asynchronous durable subscription, if both fromQueue and fromTopic are used together, any immediately available messages in any fromQueue will return first, and new message will be delivered to the same with closure in a later time
either use jms.receive([:]){ } or jms.receive([xxx:yyy, with:{}]) ; the former override the later
within is a per queue timeout interval, not total; if there are more than one queue, each are retrieved in sequence |
sql.executeUpdate() |
jms.send( toTopic:'myTopic', message:[key:value], replyTo:'')
|
toTopic and toQueue could be used together
toTopic and toQueue support collection
|