Pergunta

I am new to service integration bus. I have configured a bus, and added my websphere portal server as bus member. Next have created a topic connection factory, and have selected the created bus here, I want to send a message to service integration bus default topic space. I am not sure on how to send a message to the default topic space using JMS

Foi útil?

Solução

The only thing that remains is to create a new Topic (Resources > JMS > Topics > New) ,in which to choose the topic space you want to use, which in your case is Default.Topic.Space. After that you can send a message to your topic using code like this:

// Get the connection factory
connFactory=(ConnectionFactory)initCtx.lookup("jms/mycf");
// Get the destination used to send a message
destination = (Destination)initCtx.lookup("jms/mytopic");

Connection conn = connFactory.createConnection();
// Create a non-transacted session
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Create the message producer
MessageProducer msgProducer = session.createProducer(destination);
// Create the message
TextMessage txtMsg = session.createTextMessage("Hello There!!!");

 // Send the message
 msgProducer.send(txtMsg);
 session.close();
 conn.close();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top