Configure this event to indicate when a transmission fails or was not confirmed. For example, when a transmission fails, you can use this event to insert a row in an audit table or to send a push notification.
The following table details the parameters that can be captured using the error_handler event:
| Script parameter | Type | Description |
|---|---|---|
| request_option (out) | Integer |
Controls what the Notifier does to the push request after the error handler returns. The output can be one of the following values:
|
| error_code (in) | Integer |
Use one of the following values for the error code:
|
| request_id (in) | Integer | Identifies the request. |
| gateway (in) | Varchar | Specifies the gateway associated with the push request. |
| address (in) | Varchar | Specifies the address associated with the push request. |
| subject (in) | Varchar | Specifies the subject associated with the push request. |
| content (in) | Varchar | Specifies the content associated with the push request. |
This event requires the use of a system procedure. You can not configure this event directly using Sybase Central. See MobiLink server settings for server-initiated synchronization.
In the following example, you create a table called CustomError and log errors to the table using a stored procedure called CustomErrorHandler. The output parameter Notifier_opcode is always 0, which means that default Notifier handling is used.
CREATE TABLE CustomError(
error_code integer,
request_id integer,
gateway varchar(255),
address varchar(255),
subject varchar(255),
content varchar(255),
occurAt timestamp not null default timestamp
);
CREATE PROCEDURE CustomErrorHandler(
out @Notifier_opcode integer,
in @error_code integer,
in @request_id integer,
in @gateway varchar(255),
in @address varchar(255),
in @subject varchar(255),
in @content varchar(255)
)
BEGIN
INSERT INTO CustomError(
error_code,
request_id,
gateway,
address,
subject,
content)
VALUES(
@error_code,
@request_id,
@gateway,
@address,
@subject,
@content
);
SET @Notifier_opcode = 0;
END |
To use this ml_add_property system procedure with a SQL Anywhere consolidated database, run the following command:
call ml_add_property(
'SIS',
'Notifier(myNotifier)',
'error_handler',
'call CustomErrorHandler(?, ?, ?, ?, ?, ?, ?)'); |
Alternatively, you can fire this event by adding the following line to a Notifier configuration file:
Notifier(myNotifier).error_handler = call CustomErrorHandler(?, ?, ?, ?, ?, ?, ?) |
Run the file using the mlsrv11 -notifier option. For more information on how to configure a Notifier configuration file, see Configuring server-side settings using the Notifier configuration file.
| Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |