public class AnalyticsHandler extends AbstractGenericHandler<HttpObject,HttpRequest,AnalyticsRequest>
The AnalyticsHandler
is responsible for encoding AnalyticsRequest
s into lower level HttpRequest
s as well as decoding HttpObject
s into CouchbaseResponse
s.
Modifier and Type | Class and Description |
---|---|
protected static class |
AnalyticsHandler.KeepAliveRequest |
protected static class |
AnalyticsHandler.KeepAliveResponse |
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
static int |
MINIMUM_WINDOW_FOR_CLIENTID_TOKEN
This is a window of characters allowing to detect the clientContextID token (including room for JSON separators, etc…).
|
protected static byte |
QUERY_STATE_DONE |
protected static byte |
QUERY_STATE_ERROR |
protected static byte |
QUERY_STATE_INFO |
protected static byte |
QUERY_STATE_INITIAL |
protected static byte |
QUERY_STATE_NO_INFO |
protected static byte |
QUERY_STATE_ROWS |
protected static byte |
QUERY_STATE_ROWS_DECIDE |
protected static byte |
QUERY_STATE_ROWS_RAW |
protected static byte |
QUERY_STATE_SIGNATURE |
protected static byte |
QUERY_STATE_STATUS |
protected static byte |
QUERY_STATE_WARNING |
CHARSET, EMPTY_BYTES
Constructor and Description |
---|
AnalyticsHandler(AbstractEndpoint endpoint,
com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer,
boolean isTransient,
boolean pipeline)
Creates a new
AnalyticsHandler with the default queue for requests. |
Modifier and Type | Method and Description |
---|---|
protected CouchbaseRequest |
createKeepAliveRequest()
Override to return a non-null request to be fired in the pipeline in case a keep alive is triggered.
|
protected CouchbaseResponse |
decodeResponse(ChannelHandlerContext ctx,
HttpObject msg)
Decodes the incoming response and transforms it into a
CouchbaseResponse . |
protected HttpRequest |
encodeRequest(ChannelHandlerContext ctx,
AnalyticsRequest msg)
Encode the outgoing request and return it in encoded format.
|
int |
getQueryParsingState() |
void |
handlerRemoved(ChannelHandlerContext ctx) |
protected ServiceType |
serviceType()
Returns the
ServiceType associated with this handler. |
addHttpBasicAuth, channelActive, channelInactive, channelWritabilityChanged, connect, currentRequest, decode, encode, endpoint, env, exceptionCaught, finishedDecoding, getDecodingState, logIdent, onKeepAliveFired, onKeepAliveResponse, publishResponse, remoteHostname, remoteHttpHost, sideEffectRequestToCancel, userEventTriggered, write
acceptInboundMessage, acceptOutboundMessage, channelRead
bind, close, deregister, disconnect, flush, read
channelReadComplete, channelRegistered, channelUnregistered
ensureNotSharable, handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
protected static final byte QUERY_STATE_INITIAL
protected static final byte QUERY_STATE_SIGNATURE
protected static final byte QUERY_STATE_ROWS
protected static final byte QUERY_STATE_ROWS_RAW
protected static final byte QUERY_STATE_ROWS_DECIDE
protected static final byte QUERY_STATE_ERROR
protected static final byte QUERY_STATE_WARNING
protected static final byte QUERY_STATE_STATUS
protected static final byte QUERY_STATE_INFO
protected static final byte QUERY_STATE_NO_INFO
protected static final byte QUERY_STATE_DONE
public static final int MINIMUM_WINDOW_FOR_CLIENTID_TOKEN
This is a window of characters allowing to detect the clientContextID token (including room for JSON separators, etc…).
public AnalyticsHandler(AbstractEndpoint endpoint, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer, boolean isTransient, boolean pipeline)
Creates a new AnalyticsHandler
with the default queue for requests.
endpoint
- the AbstractEndpoint
to coordinate with.responseBuffer
- the RingBuffer
to push responses into.protected HttpRequest encodeRequest(ChannelHandlerContext ctx, AnalyticsRequest msg) throws Exception
AbstractGenericHandler
Encode the outgoing request and return it in encoded format.
This method needs to be implemented by the child handler and is responsible for the actual conversion.
encodeRequest
in class AbstractGenericHandler<HttpObject,HttpRequest,AnalyticsRequest>
ctx
- the context passed in.msg
- the outgoing message.Exception
- as a generic error.protected CouchbaseResponse decodeResponse(ChannelHandlerContext ctx, HttpObject msg) throws Exception
AbstractGenericHandler
Decodes the incoming response and transforms it into a CouchbaseResponse
.
Note that the actual notification is handled by this generic handler, the implementing class only is concerned about the conversion itself.
decodeResponse
in class AbstractGenericHandler<HttpObject,HttpRequest,AnalyticsRequest>
ctx
- the context passed in.msg
- the incoming message.Exception
- as a generic error. It will be bubbled up to the user (wrapped in a CouchbaseException) in the onError of the request’s Observable.public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
handlerRemoved
in interface ChannelHandler
handlerRemoved
in class AbstractGenericHandler<HttpObject,HttpRequest,AnalyticsRequest>
Exception
protected CouchbaseRequest createKeepAliveRequest()
AbstractGenericHandler
Override to return a non-null request to be fired in the pipeline in case a keep alive is triggered.
createKeepAliveRequest
in class AbstractGenericHandler<HttpObject,HttpRequest,AnalyticsRequest>
protected ServiceType serviceType()
AbstractGenericHandler
Returns the ServiceType
associated with this handler.
serviceType
in class AbstractGenericHandler<HttpObject,HttpRequest,AnalyticsRequest>
public int getQueryParsingState()
Copyright © 2017 Couchbase, Inc.. All rights reserved.