File and Short Message Service (SMS) transports are two of the many WebSphere Commerce Messaging subsystem transports. To send a message to these transports, use the WebSphere Commerce Messaging subsystem API, SendMessageCmd.
File transports are used to create messages for the My Portal Alert portlet.
There are five steps to send a message using the WebSphere Commerce Messaging subsystem API, SendMesageCmd:
- Initializing messaging services.
- Setting the message content.
- Configuring transport attributes.
- Managing target lists for messages.
- Sending the message.
Initializing the messaging services
To initialize the messaging services you need to know the Message Type ID, the Store ID, and the Message Type priority. There are three Application Program Interfaces (APIs) used to set these parameters:
- public void setMsgType(String msgTypeName)
- public void setStoreID(Integer storeId)
- public void setPriority(Integer priority)
For File and WebSphere Everyplace Connection Manager transports, the priority is set to 200. The priority can be set to 0, or any number of 100 or greater.
Setting the message content
In this step, the message sender has two ways to compose the message content:
- The messaging system composition service, using the following service:
public void compose(String viewName, CommandContext cmdContext, TypedProperty inParms)
- The message content directly, using the following services:
public void setContent(Integer transportId, String languageId, byte[] msgContent) public void setContent(Integer transportId, String languageId, String msgContent)
Configuring transport attributes
In this step, there is only one generic API to set all the transport attributes:
public void setConfigData(String key, String value)
The Short Message Service (SMS) transport and File transport contain the following attributes:
Transport | Attribute | Description |
---|---|---|
SMS | URL (required) | The URL of the WebSphere Everyplace Connection Manager |
port (required) | The port number used to communicate with the WebSphere Everyplace Connection Manager. | |
Mode (required) | SMS message protocol. | |
Phone Number | List of SMS phone numbers. | |
Subject | The subject of the message. | |
Sender | The sender of the message. |
For information about the file transport attributes, see Configuration of transport services used for a message.
The message sender may not need to set up all of these attributes, since default values can be setup during the transport and message type configuration. For example, port and Mode can be setup in the transport configuration steps. This information should not change once configured. If the message sender uses this API to set the transport attributes, the default values that were setup during the transport configuration are ignored.
To send a personal message, the message sender does not need to configure any attributes, as a command called by the Portal.jsp will configure everything.
Failing to supply the required attributes (URL, port and mode) will cause an exception in the WebSphere Commerce Messaging subsystem adapter and the message will not be sent.
Managing target lists for messages
In this step, the message sender is provided with the API to add the member ID to the recipient list.
public void addMember(Long aMember)
Sending the message
In this final step, the message sender has two APIs to send the message:
public void sendImmediate() public void sendTransacted()