Develop > Controller layer > Integrate with back-end systems and external applications > Outbound services
Send 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 WebSphere 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 WebSphere MQ-JMS transport, 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 = MessageMapperGroup.getObjectForMessage(xmlResponse,"WCS.INTEGRATION");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.
- Initialization services
These methods, from the SendMsgCmd command, set the initial parameters that identify which messaging profile is used for the current message. These parameters retrieve the information created and maintained in the Administration Console.
- Configuration of transport services used for a message
Use the following generic methods of the SendMsgCmd command to configure the transport services used for the message:
- Enable additional transports
Not all transports are enabled by default. You can enable additional transports by using the Configuration Manager.
- Other outbound messaging services
The following methods outline the other services offered by the outbound messaging system.
- Message content setting services
You can either use the composition service or set the message content directly.
- Add e-mail parts or attachments services
The standard e-mail transport, as well as some other transports, allow attachments to be added to messages.
Related concepts
Related tasks
Related reference
Error handling in the messaging system composition service
Example: Using the messaging system composition service