Sending services

The following methods are provided with the outbound messaging system sending services:

public void sendImmediate()
This method sends the message immediately to recipients. The caller is blocked until the message has been sent.
public void sendTransacted()
This method stores the message in the MSGSTORE database table. At a predetermined time, the WebSphere Commerce scheduler invokes a job that sends all messages stored in batch mode. Using this method ensures that a send occurs only after the caller has committed or terminated successfully. This method should be used if blocking a call using the sendImmediate() method cannot be tolerated.
public void sendReceiveImmediate()
This method is used to perform a request-reply send. This type of send is used with the IBM MQ-JMS transport for back-end integration messages. The content of the reply is stored internally and can be accessed via the getReply() method. Hint: To perform a send-receive using the IBM MQ-JMS transport, you must ensure that you have set the mode attribute appropriately, using either the Administration Console or the setConfigData() method in the configurable message data services.
public byte[] getResult()
This method is used to retrieve the result of the sendReceiveImmediate() method. To obtain the result, it should be called after the performExecute() method, which executes the SendMsgCmd command. If the SendReceiveImmediate sending service is used, the calling command can optionally get the result (that is, the reply message) back. If the response is an XML message, users can process the reply message this way:

... byte[] result = sendMsgCmd.getResult(); String xmlResponse = new 
String(result); CommandProperty cmd = 
where WCS.INTEGRATION is the name of the message mapper.

To do the preceding step requires defining the message content in the user_template.xml file and the corresponding DTD, just like adding a new inbound XML message to the Messaging system. The command name can be a dummy command name.

if (cmd != null) { TypedProperty tp = cmd.getRequestProperties(); 
where tp contains all the mapped parameters.