...
- autoClose
- by default, all connection are closed at the end of an execution context, or after any operation for Groovy Messaging Service API.
- For Groovy Messaging Service API, if you need to do more than one operation, you have to set autoClose to false, and call close() explicitly
Code Block def jms = JMS.newInstance() jms.setAutoClose(false) jmsJMS.close();
- When using in execution context, it's unommon to disable autoClose. As one of the purpose of the execution context is to autoClose resource for you. If you need to use execution context and want to disable autoClose, one of the ways is:
Code Block def jms = new JMS(){ jms.setAutoClose(false) // your jms code } - Or you'd better directly use the JMS Category without setting up an execution context.
Code Block use(JMSCategory){ jms.session() ; // notice that you need to establish a session before doing anything with JMSCategory "queue".send("message") assertNotNull("queue".receive(waitTime:100)) }
...