DataSource for C SDK  6.2.20.310828
Deprecated: Delay Channels

Typedefs

typedef void(* ds_delay_send_cb) (void *context, ds_data_t *dsdata)
 Definition of the callback for sending delayed data. More...
 
typedef struct _ds_delay ds_delay_t
 The delay channel object type. More...
 

Functions

void ds_delay_data (ds_delay_t *delay, ds_data_t *dsdata)
 Add a data object to a delay channel. More...
 
ds_delay_tds_new_delay (double delay_time, char *prefix, double batch_time)
 Create a new delay channel. More...
 
ds_delay_tds_new_delay_with_callback (double delay_time, char *prefix, double batch_time, void *callback_param, ds_delay_send_cb callback_func)
 Create a new delay channel. More...
 

Detailed Description

Delay channels allow programmatic access to created delayed data. Any number of delay channels can be created with ds_new_delay() specifying the delay time and a prefix for the data objects being sent. Then data objects can be sent using ds_delay_data(). The data objects sent will be delayed and they will have the prefix prepended to the subject.

Typedef Documentation

typedef void(* ds_delay_send_cb) (void *context, ds_data_t *dsdata)

Definition of the callback for sending delayed data.

Parameters
context- Supplied callback parameter (given to ds_new_delay_with_callback())
dsdata- Update to publish

The parameter dsdata should not be freed by this callback function.

typedef struct _ds_delay ds_delay_t

The delay channel object type.

Function Documentation

void ds_delay_data ( ds_delay_t delay,
ds_data_t dsdata 
)

Add a data object to a delay channel.

Parameters
delayThe delay channel to use
dsdataThe data object to delay
ds_delay_t* ds_new_delay ( double  delay_time,
char *  prefix,
double  batch_time 
)

Create a new delay channel.

Parameters
delay_timeThe number of seconds to delay objects
prefixPrefix to be added to the delayed object's name
batch_timeFrequency in seconds with which batches of updates are sent
Returns
An opaque delay channel object

If prefix is NULL then "/delay_time" is used, eg if delay_time is 10 then the prefix will be /10

If batch_time is set to 0 then the value from the configuration option delay-batch-time will be used

Example: Delay objects by 15 minutes and prefix the object names with /DELAYED/OBJ1

ds_delay_t *delay = ds_new_delay((double)(60*15));
ds_data_t *data = ds_init_data("/DELAYED/OBJ1", 222, flags);
ds_add_data(data, 6, "1.234");
ds_add_data(data, 22, "1.230");
ds_add_data(data, 25, "1.240");
ds_delay_data(delay, data);
ds_delay_t* ds_new_delay_with_callback ( double  delay_time,
char *  prefix,
double  batch_time,
void *  callback_param,
ds_delay_send_cb  callback_func 
)

Create a new delay channel.

Parameters
delay_time- The number of seconds to delay objects
prefix- Prefix to be added to the delayed object's name
batch_time- Frequency in seconds with which batches of updates are sent
callback_param- Parameter to specify to the callback function
callback_func- Function that is called when an object has been delayed and needs to be sent
Returns
An opaque delay channel object

The callback function supplied is called for each update that is due to be sent, this permits any post processing and peer routing control to be performed at sending stage rather than queueing stage. The update supplied to this callback should not be freed.

If prefix is NULL then "/delay_time" is used, eg if delay_time is 10 then the prefix will be /10

If batch_time is set to 0 then the value from the configuration option delay-batch-time will be used

Example: Delay objects by 15 minutes and prefix the object names with /DELAYED/OBJ1

ds_delay_t *delay = ds_new_delay((double)(60*15));
ds_data_t *data = ds_init_data("/DELAYED/OBJ1", 222, flags);
ds_add_data(data, 6, "1.234");
ds_add_data(data, 22, "1.230");
ds_add_data(data, 25, "1.240");
ds_delay_data(delay, data);

Generated on Wed Jan 24 2018 12:22:46 for DataSource for C SDK