Forum Discussion
MatthiasBuck
12 years agoOccasional Contributor
Ok, I played around with this a bit more and got it functioning (without a very detailed java docs api)
Here is my working example:
Here is my working example:
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint
import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils
import hermes.Hermes
import javax.jms.*
// This is the name of the session from your hermes-config.xml. Search for 'session'. It also shows in the URL and in my case it's the Queue Manager name.
def hermesSssionName = "MySessionName";
List queues = ["MyQueueName1, MyQueueName2"];
queues.each{
def queueName = "${it}"
def jmsEndPoint = new JMSEndpoint("jms://" + hermesSssionName + "::-::queue_" + queueName);
def hermes = HermesUtils.getHermes(testSuite.getProject(), jmsEndPoint.getSessionName())
def jmsConnectionHolder = new JMSConnectionHolder(jmsEndPoint,hermes,false,null,null,null);
log.info("hermesSssionName:" + hermesSssionName);
log.info("queueName:" + queueName);
Session session = jmsConnectionHolder.getSession();
Queue queue = jmsConnectionHolder.getQueue(jmsConnectionHolder.getJmsEndpoint().getReceive());
MessageConsumer consumer = session.createConsumer(queue);
Message message = null;
while((message = consumer.receiveNoWait()) != null){
log.info(message);
//do nothing
}
jmsConnectionHolder.closeAll()
}
Related Content
- 3 years ago
Recent Discussions
- 19 days ago