A Carapace message store can be configured to perform customised actions upon receipt of a message. For example, instead of storing the message within a message store, the message can be processed and entered into a back-office system.
When configuring a message store, a custom message handler is set up to run:
A custom handler is an object with certain prescribed methods. This object can either be implemented in Carapace script or it can be a COM object.
A custom handler is configured using the administration UI. When a message store is configured, two optional parameters are used to set up a custom message handler:
| package name | name (if any) of a Carapace script package to load |
|---|---|
| handler class | this is either the name of a Carapace script class or a COM ProgID identifying the class to use |
Any class having the following methods is a suitable candidate for a handler class.
A valid handler class must require no arguments on creation and must support the following methods:
| method name | description |
|---|---|
storageOption |
returns the value which defines what action is taken on receipt of a message -- legal
return values are:
|
preStore |
action taken before storing the message in a message store |
store |
action taken instead of storing the message in a message store |
postStore |
action taken after storing the message in a message store |
In addition, if the handler is a Carapace script object, the following properties are also required:
| property name | property type | description |
|---|---|---|
db |
Db |
connection to the database |
user |
String |
name of the user owning this custom message handler |
mts |
MTS |
connection to the message transfer system |
storageOptionReturn the value which defines what action is taken on receipt of a message -- legal return values are:
pre
store
post
Arguments: none
Return type: String
preStorePerform an action before storing the message in a message store.
Arguments:
| auditId | String |
| userAddress | String |
| messageId | String |
| sender | String |
| recipients | List |
| subject | String |
| contentType | String |
| header | String |
| msg | String |
Return type: the empty List ()
storeProcess the supplied message instead of storing it in a message store.
Arguments:
| auditId | String |
| userAddress | String |
| messageId | String |
| sender | String |
| recipients | List |
| subject | String |
| contentType | String |
| header | String |
| msg | String |
Return type: String
postStorePerform an action after storing the message in a message store.
Arguments:
| auditId | String |
| userAddress | String |
| messageId | String |
| sender | String |
| recipients | List |
| subject | String |
| contentType | String |
| header | String |
| msg | String |
Return type: the empty List ()
| Contents | Index | Current topic: audit | Related topics: databases |