public class FeedCommProcessor extends Object implements okhttp3.ws.WebSocketListener
| Constructor and Description |
|---|
FeedCommProcessor(WebSocketClientBuilder webSocketClientBuilder,
MonitorServiceConfiguration config,
String feedId,
MonitorService discoveryService) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connects to the websocket endpoint.
|
void |
destroy()
Call this when you know this processor object will never be used again.
|
void |
disconnect()
Performs a graceful disconnect with the
disconnectCode and disconnectReason. |
boolean |
isConnected() |
void |
onClose(int reasonCode,
String reason) |
void |
onFailure(IOException e,
okhttp3.Response response) |
void |
onMessage(okhttp3.ResponseBody responseBody) |
void |
onOpen(okhttp3.ws.WebSocket webSocket,
okhttp3.Response response) |
void |
onPong(okio.Buffer buffer) |
void |
sendAsync(org.hawkular.bus.common.BasicMessageWithExtraData<? extends org.hawkular.bus.common.BasicMessage> messageWithData)
Sends a message to the server asynchronously.
|
void |
sendSync(org.hawkular.bus.common.BasicMessageWithExtraData<? extends org.hawkular.bus.common.BasicMessage> messageWithData)
Sends a message to the server synchronously.
|
public FeedCommProcessor(WebSocketClientBuilder webSocketClientBuilder, MonitorServiceConfiguration config, String feedId, MonitorService discoveryService)
public boolean isConnected()
public void connect()
throws Exception
destroyed, then the connect request is ignored.Exception - on failurepublic void disconnect()
disconnectCode and disconnectReason.public void destroy()
public void sendAsync(org.hawkular.bus.common.BasicMessageWithExtraData<? extends org.hawkular.bus.common.BasicMessage> messageWithData)
messageWithData - the message to sendpublic void sendSync(org.hawkular.bus.common.BasicMessageWithExtraData<? extends org.hawkular.bus.common.BasicMessage> messageWithData)
throws Exception
messageWithData - the message to sendIOException - if the message failed to be sentExceptionpublic void onOpen(okhttp3.ws.WebSocket webSocket,
okhttp3.Response response)
onOpen in interface okhttp3.ws.WebSocketListenerpublic void onClose(int reasonCode,
String reason)
onClose in interface okhttp3.ws.WebSocketListenerpublic void onFailure(IOException e, okhttp3.Response response)
onFailure in interface okhttp3.ws.WebSocketListenerpublic void onMessage(okhttp3.ResponseBody responseBody)
throws IOException
onMessage in interface okhttp3.ws.WebSocketListenerIOExceptionpublic void onPong(okio.Buffer buffer)
onPong in interface okhttp3.ws.WebSocketListenerCopyright © 2015–2017 Red Hat, Inc.. All rights reserved.