Sending a Group Message or a Short Message Service message using WebSphere Everyplace Connection Manager

There are several prerequisite conditions that must be met before attempting to implement the following example:

The following is the sample code:

try
{
 com.ibm.commerce.messaging.commands.SendMsgCmd api =
 (com.ibm.commerce.messaging.commands.SendMsgCmd)
 CommandFactory.createCommand(SendMsgCmd.NAME, getStoreId());
 
 //Initialize the messaging services 
               
        api.setMsgType("OrderReceived");
 api.setStoreID(new Integer(201));
        // Use 0 for subscribable messages and 100 for unsubscribable messages
        // The value used here should be the same value used for severity when the message type
        // is assigned to the target transport (that is, File or/and SMS Transports)
 api. setPriority(new Integer(100));  // EWG transport priority

 // Build the message in a String object and then use the setContent().

 String OrderNotifyMsg =
 new String("Your order has been received. Thank you for shopping with us.");
        //Assuming TRANSPORT.TRANSPORT_ID for WebSphere Everyplace Connection Manager is 7.
        //or simply "null" for transport_id. Doing so will allow flexibility for site or store administrator
        //to change the transport by WebSphere Commerce Admin Console.
 api.setContent(null, null, OrderNotifyMsg);

 // Set the transport attributes using Configurable message data services
 // set up the recipients using addMember API
 api.addMember(new Long(20001001889));
 // Send out the message using sendImmediate send service.
 api.sendImmediate();
 // Set the command context obtained from the controller command.
 api.setCommandContext(getCommandContext());
 // Run the outbound messaging system services
 api.execute();
}
catch (Exception ex )
{
 //Catch WebSphere Commerce Messaging subsystem exceptions
}

Feedback