The Unreliable Publisher (upub) API consists of the following functions:
Defines an unreliable publisher type.
typedef struct upub_struct upub_t;
None.
Nothing.
Sends a notification.
void upub_publish (upub_t *upub, const char *event_ref, void *payload, unsigned int payload_len, void (*delete_payload) (void *));
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. |
Nothing.
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.
upub_t *upub_init(void *gdc, const char *host, unisgned short port, int num_workers);
gdc |
GDisp context (thread dispatcher). |
host |
Notification server host name. |
port |
Notification server port. |
num_workers |
Number of parallel sessions. |
The upub ready to be used.
Shuts down and frees the publisher.
void upub_shutdown(upub_t *upub);
Publisher.
Nothing.