/** * This is called for each interaction received from the stream and should be implemented in * extending classes if they don't use an IStreamConsumerEvents object. * * @param Interaction interaction The interaction data structure. * @throws EInvalidData */ public void onDeleted(Interaction interaction) throws EInvalidData { if (_eventHandler != null) { _eventHandler.onDeleted(this, interaction); } else { throw new EInvalidData("You must provide an onDeleted method or an eventHandler object"); } }
/** * This is called when an error is received in the data stream. * * @param message The error message. * @throws EInvalidData */ public void onError(String message) throws EInvalidData { if (_eventHandler != null) { _eventHandler.onError(this, message); } else if (_multiEventHandler != null) { _multiEventHandler.onError(this, message); } // If we don't have a handler for this event, swallow it! }
/** This is called when the consumer has successfully connected. */ public void onDisconnect() { if (_eventHandler != null) { _eventHandler.onDisconnect(this); } else if (_multiEventHandler != null) { _multiEventHandler.onDisconnect(this); } // If we don't have a handler for this event, swallow it! }
/** * This is called when the consumer is stopped. * * @param reason The reason the consumer stopped. * @throws EInvalidData */ public void onStopped(String reason) throws EInvalidData { if (_eventHandler != null) { _eventHandler.onStopped(this, reason); } else if (_multiEventHandler != null) { _multiEventHandler.onStopped(this, reason); } else { throw new EInvalidData("You must provide an onStopped method or an eventHandler object"); } }
/** * Called for each status message received down the stream. * * @param type * @param info * @throws EInvalidData */ public void onStatus(String type, JSONdn info) throws EInvalidData { if (_eventHandler != null) { _eventHandler.onStatus(this, type, info); } else if (_multiEventHandler != null) { _multiEventHandler.onStatus(this, type, info); } else { throw new EInvalidData("You must provide an onStatus method or an eventHandler object"); } }