Develop > Controller layer > Integrate with back-end systems and external applications > Outbound services > Send services
Message content setting services
You can either use the composition service or set the message content directly.
The following APIs are from SendMsgCmd command.
To use the messaging system composition service, use the following service:
- public void compose( String viewName, CommandContext cmdContext, TypedProperty inParms)
- This method accesses the composer functionality. It allows users to set the message content through the use of JSP pages. The cmdContext parameter provides the necessary context information to the composer. The viewName parameter allows the user to determine the JSP that will be accessed by the composer. If viewName is null, the default viewName associated with the message type will be used. The default viewName can be found in MSGTYPES.VIEWNAME. The inParms parameter represents the data to be passed to the JSP. There are rules governing what values can be placed in the TypedProperty object. Using this method will allow the language to be determined from the command context. However, if the addMemberId(Long aMember) is called the language preferences of the userId will be used. If multiple members are added there could potentially be generated content for multiple languages.
To set the message content directly, use the following services:
- public void setContent(Integer transportId, String languageId, byte[] msgContent)
- This method allows you to set the content of a message directly using the msgContent parameter. The other two parameters must be present, but can be null. The transportID parameter allows you to set the content for a specific transport. The languageID parameter allows you to set the content for a specific language. For maximum flexibility in setting the content for multiple languages, it is suggested that you use the compose method to run a JSP.
- public void setContent(Integer transportId, String languageId, String msgContent)
- This setContent method performs the same function as the one described above, except it allows you to enter the content in String format rather than as an array of bytes.
Related concepts
Related tasks
Related reference
Error handling in the messaging system composition service
Example: Using the messaging system composition service
Invoke the messaging system compose method