MigratoryDataAccessListener

Handle various access events, such as connect, disconnect, subscribe, and unsubscribe. More…

Public Classes

Name
interface ConnectEvent
Provide information about the client which connects to the server.
interface DisconnectEvent
Provide information about the client which disconnects from the server.
interface SubscribeEvent
Provide information about a subscription.
interface SubscribeWithHistoryEvent
Provide information about a subscription with history.
interface SubscribeWithRecoveryEvent
Provide information about a subscription with recovery.
interface UnsubscribeEvent
Provide information about an unsubscription.

Public Functions

Name
void onConnect(ConnectEvent event)
Method called whenever a client connects to the MigratoryData server.
void onSubscribe(SubscribeEvent event)
Method called whenever a client subscribes to one or more subjects.
void onSubscribeWithHistory(SubscribeWithHistoryEvent event)
Method called whenever a client subscribes to one or more subjects by asking some historical messages beforehand for those subjects.
void onSubscribeWithRecovery(SubscribeWithRecoveryEvent event)
Method called whenever a client subscribes to one or more subjects following a fail-over recovery.
void onUnsubscribe(UnsubscribeEvent event)
Method called whenever a client un-subscribes from one or more subjects.
void onDisconnect(DisconnectEvent event)
Method called whenever a client disconnects from the MigratoryData server.

Detailed Description

class MigratoryDataAccessListener;

Handle various access events, such as connect, disconnect, subscribe, and unsubscribe.

Thread safety The methods exposed by this interface are always called from the same thread.

Public Functions Documentation

function onConnect

void onConnect(
    ConnectEvent event
)

Method called whenever a client connects to the MigratoryData server.

Parameters:

  • event the connect event

function onSubscribe

void onSubscribe(
    SubscribeEvent event
)

Method called whenever a client subscribes to one or more subjects.

Parameters:

  • event the subscribe event

function onSubscribeWithHistory

void onSubscribeWithHistory(
    SubscribeWithHistoryEvent event
)

Method called whenever a client subscribes to one or more subjects by asking some historical messages beforehand for those subjects.

Parameters:

  • event the subscribe event following a request for historical messages

When the Guaranteed Message Delivery feature is enabled, the MigratoryData server maintains for each subject a cache of a configurable number of historical messages, during a configurable period of time. The MigratoryData Client API exposes a method MigratoryData.subscribeWithHistory() which can be used to allow a client to retrieve a certain number of historical messages for one or more subjects, before subscribing to real-time messages for those subjects.

function onSubscribeWithRecovery

void onSubscribeWithRecovery(
    SubscribeWithRecoveryEvent event
)

Method called whenever a client subscribes to one or more subjects following a fail-over recovery.

Parameters:

  • event the subscribe event following a fail-over recovery

If a failure occurs, the client will automatically fail over to another server of the MigratoryData cluster. When the client reconnects to the new MigratoryData server, it will subscribe to the subjects subscribed previously.

function onUnsubscribe

void onUnsubscribe(
    UnsubscribeEvent event
)

Method called whenever a client un-subscribes from one or more subjects.

Parameters:

  • event the unsubscribe event

function onDisconnect

void onDisconnect(
    DisconnectEvent event
)

Method called whenever a client disconnects from the MigratoryData server.

Parameters:

  • event the disconnect event