WebSphere Business Monitor JMS API to send a BAM event

public void sendJMSMessage(String xmlToSend, String jmsQueue, String jmsQueueConnectionFactory)

{

// get the Connection Factory

Context context = new InitialContext();

ConnectionFactory qConnectionFactory = (ConnectionFactory) context

.lookup(jmsQueueConnectionFactory);

Connection connection = qConnectionFactory.createConnection();

// get the queue

Queue queue = (Queue) context.lookup(jmsQueue);

// Create session, producer, and message.

// get a session

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

// get the producer

MessageProducer producer = session.createProducer(queue);

// build the TextMessage

TextMessage message = session.createTextMessage(xmlToSend);

// send the message

producer.send(message);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: