qazwsx
6 years agoOccasional Contributor
EMS receiving reply from temporary topic/queue
Can you please advise how to receive a reply from a temporary topic/queue using JMS Request?
- 6 years ago
I managed to achieve this using Groovy script.
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint import hermes.Hermes import javax.jms.* def jmsEndpoint = new JMSEndpoint("jms://LOCAL::topic_<topicName>::topic_"); def hermes = HermesUtils.getHermes(context.testCase.testSuite.project, jmsEndpoint.sessionName); def jmsConnectionHolder = new JMSConnectionHolder( jmsEndpoint, hermes, false, null ,null ,null); Session jmsSession = jmsConnectionHolder.getSession(); Topic temporatyTopic = jmsSession.createTemporaryTopic(); Topic topicPublisher = jmsConnectionHolder.getTopic(jmsConnectionHolder.getJmsEndpoint().getSend()); MessageProducer messageProducer = jmsSession.createProducer(topicPublisher); TextMessage textMessageSend = jmsSession.createTextMessage(); textMessageSend.setJMSReplyTo(temporatyTopic); textMessageSend.setText( "jms message from groovy"); messageProducer.send(textMessageSend); MessageConsumer messageConsumer = jmsSession.createConsumer(temporatyTopic); String receivedMessage = messageConsumer.receive().getBody(String.class); log.info(receivedMessage); jmsConnectionHolder.closeAll();
Can I archive the same functionality using JMS Request step?