Creating the push request table

A push request is a row in a SQL result set on the consolidated database that contains the following columns in the following order. The first five columns are required and the last two columns are optional. The Notifier uses the request_cursor property to fetch push requests.

In a typical implementation, you add a push request table to your consolidated database. You populate the push request table when a change is detected on your consolidated database, and use the request_cursor Notifier event to send push requests to remote Listeners. The request_cursor Notifier event must receive the following columns in the following order:

Column

Description

request id

INTEGER. A unique ID for a push request.

gateway

VARCHAR. The gateway on which to send the message. This can be a predefined or user-defined gateway. Predefined gateways are Default-DeviceTracker, Default-SMTP, and Default-UDP.

subject

VARCHAR. The subject line of the message.

content

VARCHAR. The content of the message.

address

VARCHAR. The destination address. For a SYNC gateway or DeviceTracker gateway, it is the MobiLink user name of the Listener, or other MobiLink user names that you register using dblsn -t+. For an SMTP gateway without device tracking, it is an email address. For a UDP gateway without device tracking, it is an IP address or host name, optionally followed by a colon and port number.

resend interval

VARCHAR. Optional. How often the message should be resent. The default unit is minutes. You can specify S, M, and H for units of seconds, minutes, and hours. You can also combine units, as in 1H 30M 10S.

The resend interval is especially useful when the remote device is listening for UDP and the network is unreliable. The Notifier assumes that all attributes associated with a resendable notification request do not change: subsequent updates are ignored after the first poll of the request. The Notifier automatically adjusts the next polling interval if a resendable notification must be sent before the next polling time. You can stop a resendable notification using the request_cursor query or by deleting the request from the request table. The default is to send exactly once, with no resend. Delivery confirmation from the intended Listener may stop a subsequent resend.

time to live

VARCHAR. Optional. The time until the resend expires. The default unit is minutes. You can specify S, M, and H for units of seconds, minutes, and hours. You can also combine units, as in 1H 30M 10S.

If this value is 0, null, or not specified, the default is to send exactly once, with no resend.

Note: push requests can also be stored in temporary tables and across multiple tables.

For more information about addressing notifications when you are using device tracking, see Listener options for device tracking.

Example

Following is a SQL Anywhere CREATE TABLE statement that creates a push request table.

create table PushRequest (
    req_id integer default autoincrement primary key,
    gateway varchar(128),
    subject varchar(128),
    content varchar(128),
    address varchar(128),
    resend_minute varchar(30),
    minute_to_live varchar(30)
)

The following code uses the ml_add_property stored procedure to create a request_cursor property that creates the push request.

call ml_add_property( 'SIS', 'Notifier(Simple)', 'request_cursor',
  'select req_id,
          gateway,
          subject,
          content,
          address,
          resend_minute, 
          minute_to_live
 from PushRequest' );