public abstract class BaseWebSocketExchangeService extends BaseExchangeService implements StreamingExchangeService
Streaming market data service to provide the following to streaming market data API:
Modifier and Type | Field and Description |
---|---|
protected BlockingQueue<ExchangeEvent> |
consumerEventQueue
The event queue for the consumer
|
protected ReconnectService |
reconnectService |
exchange
Constructor and Description |
---|
BaseWebSocketExchangeService(Exchange exchange,
ExchangeStreamingConfiguration exchangeStreamingConfiguration)
Constructor
|
Modifier and Type | Method and Description |
---|---|
ExchangeEvent |
checkNextEvent() |
int |
countEventsAvailable()
Returns number of events in consumer event queue.
|
void |
disconnect()
Closes the connection to the upstream server for this instance.
|
ExchangeEvent |
getNextEvent()
Returns next event in consumer event queue, then removes it.
|
org.java_websocket.WebSocket.READYSTATE |
getWebSocketStatus()
Returns current state of websocket connection.
|
protected void |
internalConnect(URI uri,
ExchangeEventListener exchangeEventListener,
Map<String,String> headers) |
void |
send(String msg)
Sends a msg over the socket.
|
getExchangeSymbols, verifyOrder, verifyOrder, verifyOrder
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connect
protected final BlockingQueue<ExchangeEvent> consumerEventQueue
protected ReconnectService reconnectService
public BaseWebSocketExchangeService(Exchange exchange, ExchangeStreamingConfiguration exchangeStreamingConfiguration)
exchange
- exchangeStreamingConfiguration
- protected void internalConnect(URI uri, ExchangeEventListener exchangeEventListener, Map<String,String> headers)
public void disconnect()
StreamingExchangeService
Closes the connection to the upstream server for this instance.
disconnect
in interface StreamingExchangeService
public ExchangeEvent getNextEvent() throws InterruptedException
StreamingExchangeService
Returns next event in consumer event queue, then removes it.
getNextEvent
in interface StreamingExchangeService
InterruptedException
public int countEventsAvailable()
Returns number of events in consumer event queue.
countEventsAvailable
in interface StreamingExchangeService
public ExchangeEvent checkNextEvent() throws InterruptedException
InterruptedException
public void send(String msg)
StreamingExchangeService
Sends a msg over the socket.
send
in interface StreamingExchangeService
public org.java_websocket.WebSocket.READYSTATE getWebSocketStatus()
StreamingExchangeService
getWebSocketStatus
in interface StreamingExchangeService
Copyright © 2012–2017 Xeiam, LLC. All rights reserved.