I am new to TIBCO and trying to communicate with EMS Server using loadrunner.
The communication between the client and server takes place generally over TCP.
I have following details with me:
Did any one try publishing messages on EMS Server with Loadrunner.
Please suggest on how can I start scripting?
After searching it on google and trying out with different protocols, i found out a simple way to publish message on EMS server.
As EMS is an extension of JMS(java messaging service) we have to use jms protocol to communicate with EMS.
Using a java vuser in VUGEN is the best option.
Below is the code you can paste in actions.java file.
public int action() throws Throwable {
String serverUrl = "tcp://localhost:7222";
String userName = "admin";
String password = "admin";
String queueName = "your queue name";
try {
System.out.println("Sending JMS message to server " + serverUrl + "...");
QueueConnectionFactory factory = new TibjmsQueueConnectionFactory(serverUrl);
QueueConnection connection = factory.createQueueConnection(userName, password);
QueueSession session = connection.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
// Use createQueue() to enable sending into dynamic queues.
Queue senderQueue = session.createQueue(queueName);
QueueSender sender = session.createSender(senderQueue);
/* publish messages */
TextMessage jmsMessage = session.createTextMessage("your message");
//String text = (String) data.elementAt(i);
//jmsMessage.setText(text);
sender.send(jmsMessage);
System.out.println("Sent message!");
connection.close();
} catch (JMSException e) {
e.printStackTrace();
System.exit(0);
}
return 0;
}//end of action