Accessing JMS Resources
To access JMS resources, create JMS Connection Factory and JMS
Destination properties. If you create a property named connectionFactory of
type JMS Connection Factory and a property named destination of type JMS
Destination, TIBCO Business Studio adds the following to the abstract
implementation class:
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
private ConnectionFactory connectionFactory;
@Property(name = "connectionFactory")
public void setConnectionFactory(ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
}
public ConnectionFactory getConnectionFactory() {
return connectionFactory;
}
private Destination destination;
@Property(name = "destination")
public void setDestination(Destination destination) {
this.destination = destination;
}
public Destination getDestination() {
return destination;
}
Procedure
Example
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
@Init
public void init() throws JMSException {
connection = getConnectionFactory().createConnection();
connection.start();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
System.out.println(session);
}
@Destroy
public void destroy() throws JMSException {
session.close();
connection.stop();
connection.close();
}
private String doPublish(String input ) throws JMSException {
MessageProducer producer = session.createProducer(getDestination());
TextMessage message = session.createTextMessage("Input from SOAP Request :" + input );
producer.send(message);
String msg_id = message.getJMSMessageID();
return msg_id;
}
Copyright © Cloud Software Group, Inc. All rights reserved.