Emitting XML messages in Common Event Base format to a JMS queue (deprecated)

You can emit XML events to a JMS queue for processing by monitor model applications.

A message-driven bean is packaged in the IBM_WBM_EMITTER SERVICE application. When you install IBM® Business Monitor, the message-driven bean is created. When the application is started, the message-driven bean acts as a listener for incoming messages on a predefined JMS queue named MonitorEventEmitterQueue.

Event XML is emitted as a JMS TextMessage into the MonitorXmlEmitterQ. The JMS event emitter listens for the messages on the queue and then wraps the event XML in a Common Base Events envelope. The message-driven bean places the event XML into the xs:any slot of the Common Base Events and submits the Common Base Events to the common event infrastructure (CEI) server, which then forwards the event to the monitor model application.

If the JMS event emitter is using a WebSphere MQ messaging provider, a WebSphere MQ message is created and is mapped to a JMS queue when it is received. The sender must set MQMD.format='MQSTR' for the created WebSphere MQ message to map it to a JMS TextMessage.

The JMS queue supports transactions and rollbacks, so you need to send the events only once. You do not need to deal with retries or potentially duplicated events.

The JMS event emitter does not validate Common Base Events.

The following code snippet shows an example of sending an XML message in Common Base Event format using JMS.
String xml = null; //initialize with the XML you want to send

// Connect to the server
Context jndiContext = new InitialContext();

// Get the connection factory via its JNDI name
QueueConnectionFactory connectionFactory = (QueueConnectionFactory) jndiContext.lookup(
   "jms/MonitorEventEmitter/ActivationSpec");

// Create a connection
QueueConnection jmsConnection = connectionFactory.createQueueConnection();

// Start a session
QueueSession session = jmsConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

// Create your message
TextMessage jmsMessage = session.createTextMessage(xml);

// Get the queue via its JNDI name
Queue jmsQueue = (Queue) jndiContext.lookup("jms/MonitorEventEmitter/Queue");

// Send the messsage to the queue
QueueSender sender = session.createSender(jmsQueue);
sender.send(jmsMessage);

// Cleanup
sender.close();
session.close();
jmsConnection.close();

See the related information links for programming information about how to emit XML events to a JMS queue.