You can implement this property to catch situations where a transmission failed or was not confirmed. For example, when a transmission fails you can cause a line to be inserted in an audit table or a notification sent to someone.
You can capture the following information. You can use all of the parameters or a subset. This property requires the use of a stored procedure.
| Script parameter | Description |
|---|---|
| request_option (out) |
Integer. Controls what the Notifier does to the request after the handler returns. Can be one of:
|
| error_code (in) |
Integer. Can be one of:
|
| request_id (in) | Integer. Identifies the request. |
| gateway (in) | Varchar. Gateway associated with the request. |
| address (in) | Varchar. Address associated with the request. |
| subject (in) | Varchar. Subject associated with the request. |
| content (in) | Varchar. Content associated with the request. |
In the following example, you create a table called CustomError. You log errors to the table using a stored procedure called CustomErrorHandler. In this example, 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 the stored procedure ml_add_property with a SQL Anywhere consolidated database, run the following command:
call ml_add_property( 'SIS', 'Notifier(myNotifier)', 'error_handler', 'call CustomErrorHandler(?, ?, ?, ?, ?, ?, ?)'); |
| Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |