awRegisterCallbackForTag
BrokerError awRegisterCallbackForTag(
BrokerClient client,
int tag,
BrokerBoolean cancel_when_done,
BrokerCallback func,
void *client_data);
client | The Broker client for which the callback is being registered. |
tag | The event tag field associated with the callback. |
cancel_when_done | If set to 1 (true), the callback will be automatically cancelled when awIsLastReplyEvent returns 1 (true). |
func | |
client_data | A pointer to user-defined data that will be passed to the callback function when it is invoked. |
Registers a callback function for a specified client and event tag. All events with the specified tag will be sent to the callback function func. If cancel_when_done is set to true (1), then the callback will be automatically cancelled when the awIsLastReplyEvent function returns true. Otherwise, the callback will stay in effect until explicitly cancelled.
Note:
You must register a general callback object, using the awRegisterCallback function, before calling this function.
The tag envelope field will only be set for reply events which are sent to your client in response to a request event bearing the same tag field. These reply events are delivered to your client.
If a callback has already been registered for the specified tag, it will be replaced with the new callback.
If you want to have different event types handled by their own unique callback, be sure that each event subscription uses a unique subscription identifier.
Possible BrokerError major codes | Meaning |
AW_ERROR_BAD_STATE | No general callback has been registered. |
AW_ERROR_INVALID_CLIENT | The client has been destroyed or disconnected. |
AW_ERROR_NULL_PARAM | The func is NULL. |
See also: