Rules for Automatic Reconnection
Here are some important rules to keep in mind when using the automatic reconnection feature.
1. If the Broker disconnects from your client while the client is awaiting a reply from the Broker, a AW_ERROR_CONNECTION_CLOSED error is reflected to the client and no reconnection is attempted.
2. If your Broker client is using the callback model for event processing, automatic reconnection will be attempted (when necessary) at any of this points:
Each time an event is received by the
awThreadedCallbacks function on a client thread that is still connected.
3. Broker clients with an explicit-destroy life cycle that are automatically reconnected will find their previous client state has been preserved, including previously registered subscriptions, events in the event queue, and all other client state.
Note:
For
Broker clients with an
explicit-destroy life cycle, previously retrieved events which were not acknowledged will be presented again after automatic reconnection. When a
Broker client that is sharing its state with other clients is disconnected, the other clients may retrieve the unacknowledged events. You can avoid receiving duplicate events by explicitly acknowledging events using the
awAcknowledge,
awAcknowledgeThrough,
awGetEvents, or
awGetEventsWithAck functions.
4. Broker clients with a
destroy-on-disconnect life cycle that are automatically reconnected will find that any previously registered subscriptions, events in the event queue, and all other client state will no longer exist. These
Broker clients may use the connection notification feature, described on
Connection Notification, to aid them in recreating their previous subscriptions and client state.