Broker 10.5 | webMethods Broker Documentation | webMethods Broker Messaging Programmer's Guide | Coding Messaging Client Applications | A Basic JMS Sender-Receiver Client | Coding Messaging Objects | Message Sender
 
Message Sender
Following is the code used for creating the messaging objects in the sender application:

conn = factory.createConnection();
Session session = conn.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer sender = session.createProducer(destination);
To create the connection object, call the createConnection() method on the factory object. To create the session object, call the createSession() method on the connection. The createSession() method takes the following two parameters:
*Transaction mode. Here, the transaction mode is set to false, indicating that transactions will not be used.
*Acknowledgment mode. In this example, the mode is set to AUTO_ACKNOWLEDGE, indicating that the session automatically acknowledges a client's receipt of a message.
You create a message producer by executing the createProducer() method on a session. createProducer() takes a single parameter, the destination to which the message will be sent.