public abstract class AbstractCouchbaseRequest extends Object implements CouchbaseRequest
CouchbaseRequest
, should be extended by child messages.Modifier | Constructor and Description |
---|---|
protected |
AbstractCouchbaseRequest(String bucket,
String password)
Create a new
AbstractCouchbaseRequest . |
protected |
AbstractCouchbaseRequest(String bucket,
String username,
String password)
Create a new
AbstractCouchbaseRequest . |
protected |
AbstractCouchbaseRequest(String bucket,
String username,
String password,
rx.subjects.Subject<CouchbaseResponse,CouchbaseResponse> observable)
Create a new
AbstractCouchbaseRequest . |
Modifier and Type | Method and Description |
---|---|
protected void |
afterSpanSet(io.opentracing.Span span)
Use this method to add custom span values on insert.
|
String |
bucket()
The associated bucket name for this request.
|
void |
complete()
Completes the underlying state holder.
|
long |
creationTime()
Returns the time in nanoseconds when the message was created.
|
String |
dispatchHostname() |
void |
dispatchHostname(String hostname) |
void |
emit(CouchbaseResponse response)
Emits the
CouchbaseResponse into the underlying state holder (like a subject)
without completing it as per contract. |
void |
fail(Throwable throwable)
Fails the
CouchbaseResponse on the state holder as per contract. |
int |
incrementRetryCount()
Returns the old retry count and increments it by one.
|
boolean |
isActive()
Checks if the request is unsubscribed on a timeout
|
String |
lastLocalId() |
void |
lastLocalId(String localId) |
String |
lastLocalSocket() |
void |
lastLocalSocket(String local) |
String |
lastRemoteSocket() |
void |
lastRemoteSocket(String remote) |
long |
maxRetryDuration()
Returns the maximum retry duration for the request.
|
void |
maxRetryDuration(long maxRetryDuration)
Sets the maximum retry duration for the request.
|
rx.subjects.Subject<CouchbaseResponse,CouchbaseResponse> |
observable()
Get the underlying
Observable . |
String |
operationId()
Default implementation, sub requests need to override this.
|
String |
password()
The password associated with the bucket/ user
|
long |
retryAfter()
Gets the initial retry after time for the request.
|
void |
retryAfter(long after)
Sets the initial retry after time for the request.
|
int |
retryCount()
Returns the current retry count.
|
Delay |
retryDelay()
Returns the retry delay config
|
void |
retryDelay(Delay retryDelay)
Sets the retry delay config
|
io.opentracing.Span |
span()
Returns the
Span for this request if set. |
void |
span(io.opentracing.Span span,
CoreEnvironment env)
Allows to set a custom span that should be used.
|
void |
subscriber(rx.Subscriber subscriber)
Optionally add subscriber to check for the timeouts
|
void |
succeed(CouchbaseResponse response)
Emits the
CouchbaseResponse into the underlying state holder (like a subject)
and completes it as well per contract. |
String |
toString() |
String |
username()
User authorized for bucket access
|
protected AbstractCouchbaseRequest(String bucket, String password)
AbstractCouchbaseRequest
.
Depending on the type of operation, bucket and password may be null, this needs to
be enforced properly by the child implementations.
This constructor will create a AsyncSubject, which implies that the response for this
request only emits one message. If you need to expose a streaming response, use the
other constructor and feed it a ReplaySubject or something similar.bucket
- the name of the bucket.password
- user password.protected AbstractCouchbaseRequest(String bucket, String username, String password)
AbstractCouchbaseRequest
.
Depending on the type of operation, bucket and password may be null, this needs to
be enforced properly by the child implementations.
This constructor will create a AsyncSubject, which implies that the response for this
request only emits one message. If you need to expose a streaming response, use the
other constructor and feed it a ReplaySubject or something similar.bucket
- the name of the bucket.username
- user authorized to access the bucket.password
- user password.protected AbstractCouchbaseRequest(String bucket, String username, String password, rx.subjects.Subject<CouchbaseResponse,CouchbaseResponse> observable)
AbstractCouchbaseRequest
.
Depending on the type of operation, bucket and password may be null, this needs to
be enforced properly by the child implementations.bucket
- the name of the bucket.username
- user authorized to access the bucket.password
- the password of the bucket.public rx.subjects.Subject<CouchbaseResponse,CouchbaseResponse> observable()
CouchbaseRequest
Observable
.observable
in interface CouchbaseRequest
public String bucket()
CouchbaseRequest
bucket
in interface CouchbaseRequest
public String username()
CouchbaseRequest
username
in interface CouchbaseRequest
public String password()
CouchbaseRequest
password
in interface CouchbaseRequest
public long creationTime()
CouchbaseMessage
creationTime
in interface CouchbaseMessage
public int incrementRetryCount()
CouchbaseRequest
incrementRetryCount
in interface CouchbaseRequest
public int retryCount()
CouchbaseRequest
retryCount
in interface CouchbaseRequest
public void retryAfter(long after)
CouchbaseRequest
retryAfter
in interface CouchbaseRequest
public long retryAfter()
CouchbaseRequest
retryAfter
in interface CouchbaseRequest
public void maxRetryDuration(long maxRetryDuration)
CouchbaseRequest
maxRetryDuration
in interface CouchbaseRequest
public long maxRetryDuration()
CouchbaseRequest
maxRetryDuration
in interface CouchbaseRequest
public void retryDelay(Delay retryDelay)
CouchbaseRequest
retryDelay
in interface CouchbaseRequest
public Delay retryDelay()
CouchbaseRequest
retryDelay
in interface CouchbaseRequest
public boolean isActive()
CouchbaseRequest
isActive
in interface CouchbaseRequest
public void subscriber(rx.Subscriber subscriber)
CouchbaseRequest
subscriber
in interface CouchbaseRequest
public String dispatchHostname()
dispatchHostname
in interface CouchbaseRequest
public void dispatchHostname(String hostname)
dispatchHostname
in interface CouchbaseRequest
public void emit(CouchbaseResponse response)
CouchbaseRequest
CouchbaseResponse
into the underlying state holder (like a subject)
without completing it as per contract.emit
in interface CouchbaseRequest
response
- the response to emit.public void complete()
CouchbaseRequest
complete
in interface CouchbaseRequest
public void succeed(CouchbaseResponse response)
CouchbaseRequest
CouchbaseResponse
into the underlying state holder (like a subject)
and completes it as well per contract.
Its basically a shortcut for CouchbaseRequest.emit(CouchbaseResponse)
followed by CouchbaseRequest.complete()
.succeed
in interface CouchbaseRequest
response
- the response to emit and complete.public void fail(Throwable throwable)
CouchbaseRequest
CouchbaseResponse
on the state holder as per contract.fail
in interface CouchbaseRequest
throwable
- the throwable to fail the response with.public io.opentracing.Span span()
CouchbaseRequest
Span
for this request if set.span
in interface CouchbaseRequest
public void span(io.opentracing.Span span, CoreEnvironment env)
CouchbaseRequest
span
in interface CouchbaseRequest
span
- the span to use.env
- the core env used for context-sensitive stuff, may be null.public String lastLocalSocket()
lastLocalSocket
in interface CouchbaseRequest
public String lastRemoteSocket()
lastRemoteSocket
in interface CouchbaseRequest
public String lastLocalId()
lastLocalId
in interface CouchbaseRequest
public void lastLocalSocket(String local)
lastLocalSocket
in interface CouchbaseRequest
public void lastRemoteSocket(String remote)
lastRemoteSocket
in interface CouchbaseRequest
public void lastLocalId(String localId)
lastLocalId
in interface CouchbaseRequest
protected void afterSpanSet(io.opentracing.Span span)
public String operationId()
operationId
in interface CouchbaseRequest
Copyright © 2018 Couchbase, Inc.. All rights reserved.