Ask a Question

EMS receiving reply from temporary topic/queue

SOLVED
qazwsx
Occasional 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?

7 REPLIES 7
nmrao
Champion Level 2

How are you using the endpoing?


Regards,
Rao.
qazwsx
Occasional Contributor

I'm using the following endpoint: readyjms://EMS::topic_<topicName>::topic_ 

 

According to what I found this topic_ should create a temporary topic for a reply. Is it correct?

nmrao
Champion Level 2

No topic name mentioned. That means listens on the temporary queue for the reply.


Regards,
Rao.
qazwsx
Occasional Contributor

Yes, but JMS header JMSReplyTo is not set. Therefore component doesn't know where to send the reply.

image.png

 

Can you advise how can set temporary topic in JMSReplyTo and the listen on it for a reply?

qazwsx
Occasional Contributor

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?

nmrao
Champion Level 2

Why no use groovy step then(instead of other type of test step)?


Regards,
Rao.
qazwsx
Occasional Contributor

I'm just curious if it's possible to do the same using JMS Request test set.

cancel
Showing results for 
Search instead for 
Did you mean: