public abstract class DefaultStreamingClientConnector extends Object implements ConnectionStrategyClientConnector
ConnectionStrategyClientConnector listens for occurred events (Event)
of the server side and has the task to encode / process the transferred events at the client side.
The DefaultStreamingClientConnector is an
abstract implementation for streaming listen methods and needs an implementation to deserialize sent events.
Streaming means that the connection is hold open for a specified time and when an event
occurs, the answer / event is streamed directly to the client without closing and re-open the connection. The connection is
closed and re-opened (by the client) when the configured max. waiting time is reached.| Constructor and Description |
|---|
DefaultStreamingClientConnector() |
| Modifier and Type | Method and Description |
|---|---|
void |
deactivate()
Deactivates the
ConnectionStrategyClientConnector. |
protected abstract DomainEvent |
deserializeEvent(String anEvent)
That de-serialization method has to be implemented by the extending implementation to de-serialize occurred events.
|
void |
init(EventServiceAsync anEventService)
Initializes the
ConnectionStrategyClientConnector with
the EventServiceAsync. |
boolean |
isInitialized()
Checks if the
ConnectionStrategyClientConnector is
initialized. |
protected abstract void |
listen()
That method can be implemented to react on a listen start call.
|
void |
listen(EventNotification anEventNotification,
AsyncCallback<List<DomainEvent>> aCallback)
The listen method implements the listen / connection strategy to receive occurred events.
|
void |
receiveEvent(String anEvent)
That method can be used by a concrete implementation to sent received events.
|
protected static final String CYCLE_TAG
public DefaultStreamingClientConnector()
public void init(EventServiceAsync anEventService)
ConnectionStrategyClientConnector with
the EventServiceAsync.init in interface ConnectionStrategyClientConnectoranEventService - the EventServiceAsyncpublic void deactivate()
ConnectionStrategyClientConnector.deactivate in interface ConnectionStrategyClientConnectorpublic boolean isInitialized()
ConnectionStrategyClientConnector is
initialized.isInitialized in interface ConnectionStrategyClientConnectorConnectionStrategyClientConnector is
initialized, otherwise falsepublic void listen(EventNotification anEventNotification, AsyncCallback<List<DomainEvent>> aCallback)
EventNotification and to the callback.
That abstract streaming implementation handles the notifications itself. The concrete implementation has to implement
the abstract listen method (listen()) and can notify about events with a simple call to
receiveEvent(String).listen in interface ConnectionStrategyClientConnectoranEventNotification - EventNotification which will be notified about occurred / received eventsaCallback - The callback will be notified about occurred / received events.public void receiveEvent(String anEvent)
EventNotification about the occurred
event, itself. The callback isn't notified about events when the cycle (CYCLE_TAG)
is triggered, because the events were already processed to the EventNotification before.anEvent - event or cycle tag (CYCLE_TAG)protected abstract DomainEvent deserializeEvent(String anEvent)
anEvent - event to de-serializeprotected abstract void listen()
listen(de.novanic.eventservice.client.event.listener.EventNotification, com.google.gwt.user.client.rpc.AsyncCallback).Copyright © 2012. All Rights Reserved.