Sun Java Communications Suite 5 Event Notification Service Guide

Unreliable Publisher API

The Unreliable Publisher (upub) API consists of the following functions:

upub_t

Purpose

Defines an unreliable publisher type.

Syntax

typedef struct upub_struct upub_t;

Parameters

None.

Returns

Nothing.

upub_publish

Purpose

Sends a notification.

Syntax

void upub_publish (upub_t *upub,
                              const char *event_ref,
                              void *payload,
                              unsigned int payload_len,
                              void (*delete_payload) (void *));

Parameters

upub

Publisher. 

event_ref

Event reference. This is a URI identifying the resource that is modifed. 

payload

Notification payload. 

payload_len

Length in bytes of the payload. 

delete_payload

Callback to free the payload when it is no longer needed. 

Returns

Nothing.

upub_init

Purpose

Creates the publisher.

This function allocates the upub object and sets up the thread dispatcher. The thread dispatcher can be provided by the application if the application already has one. This will have the advantage of not creating a thread dedicated to this API.

Note: If a connection-based transport is used, the connection to the notification service is not set up here. This is deferred to the first time a notification is actually published.

Syntax

upub_t *upub_init(void *gdc,
                             const char *host, unisgned short port,
                             int num_workers);

Parameters

gdc

GDisp context (thread dispatcher). 

host

Notification server host name. 

port

Notification server port. 

num_workers

Number of parallel sessions. 

Returns

The upub ready to be used.

upub_shutdown

Purpose

Shuts down and frees the publisher.

Syntax

void upub_shutdown(upub_t *upub);

Parameters

upub

Publisher.

Returns

Nothing.