Customised Message Handler

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.

Configuration

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.

Handler Class Definition

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:
  • pre
  • store
  • post
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


storageOption

Return the value which defines what action is taken on receipt of a message -- legal return values are:

Arguments: none

Return type: String


preStore

Perform an action before storing the message in a message store.

Arguments:

auditIdString
userAddressString
messageIdString
senderString
recipientsList
subjectString
contentTypeString
headerString
msgString

Return type: the empty List ()


store

Process the supplied message instead of storing it in a message store.

Arguments:

auditIdString
userAddressString
messageIdString
senderString
recipientsList
subjectString
contentTypeString
headerString
msgString

Return type: String


postStore

Perform an action after storing the message in a message store.

Arguments:

auditIdString
userAddressString
messageIdString
senderString
recipientsList
subjectString
contentTypeString
headerString
msgString

Return type: the empty List ()


Contents Index Current topic: audit Related topics: databases