public class StreamingServerConnector extends ConnectionStrategyServerConnectorAdapter implements Cloneable
StreamingServerConnector
implements
the streaming event listen method. 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.Modifier | Constructor and Description |
---|---|
|
StreamingServerConnector(EventServiceConfiguration aConfiguration)
Creates a new
StreamingServerConnector . |
protected |
StreamingServerConnector(EventServiceConfiguration aConfiguration,
SerializationPolicy aSerializationPolicy)
Creates a new
StreamingServerConnector . |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
A
StreamingServerConnector has to be
cloneable, because it isn't stateless caused by the necessary for a client dependent response
(see prepare(javax.servlet.http.HttpServletResponse) ). |
List<DomainEvent> |
listen(UserInfo aUserInfo)
Listens for occurring events (can be retrieved from the
UserInfo with
UserInfo.retrieveEvents(int) ) and should prepare or transfer the retrieved events
directly. |
void |
prepare(javax.servlet.http.HttpServletResponse aResponse)
Prepares the
StreamingServerConnector with a response. |
encode, getConfiguration, getEncoding, waitMaxWaitingTime, waitMinWaitingTime
public StreamingServerConnector(EventServiceConfiguration aConfiguration) throws EventServiceException
StreamingServerConnector
.
The StreamingServerConnector
implements
the streaming event listen method.aConfiguration
- configurationEventServiceException
protected StreamingServerConnector(EventServiceConfiguration aConfiguration, SerializationPolicy aSerializationPolicy)
StreamingServerConnector
.
The StreamingServerConnector
implements
the streaming event listen method.aConfiguration
- configurationaSerializationPolicy
- serialization policy to define the serialization of event (preparation for the transfer of events)public void prepare(javax.servlet.http.HttpServletResponse aResponse) throws EventServiceException
StreamingServerConnector
with a response.
The response is required to stream the events to the client. Therefore that method must be called before the listening for events starts.aResponse
- responseEventServiceException
public List<DomainEvent> listen(UserInfo aUserInfo) throws EventServiceException
UserInfo
with
UserInfo.retrieveEvents(int)
) and should prepare or transfer the retrieved events
directly. The reason for the listen and transfer preparation within one single method is, that the ConnectionStrategyServerConnector
should have the control about listening and transfer of the occurred events.
The streaming implementation needs a response to stream the events to the clients. That can be prepared with
prepare(javax.servlet.http.HttpServletResponse)
.listen
in interface ConnectionStrategyServerConnector
aUserInfo
- UserInfo
which holds new occurred eventsEventServiceException
public Object clone() throws CloneNotSupportedException
StreamingServerConnector
has to be
cloneable, because it isn't stateless caused by the necessary for a client dependent response
(see prepare(javax.servlet.http.HttpServletResponse)
).clone
in class Object
StreamingServerConnector
CloneNotSupportedException
Copyright © 2012. All Rights Reserved.