DESCRIPTION

JVMCBC-441: Add a CoreSendHook

Motivation
----------
Right now it is not possible to hook in before we "send" the request
into the ringbuffer, allowing to introspect the request and also
to potentially alternate the observable returned to the upper layers.

Modifications
-------------
This changeset makes it possible to hook into the send method, configurable
via a hook through the environment. The tuple returned allows to either
pass through or modify the original request and/or the original response.

Result
------
It is now possible to optionally hook the send method before the request
is put into the ringbuffer.

Change-Id: I7501f1a3cc93275e26e7644248b0261feecb09aa


COMMENTS

author: Natasha Sullivan
date: 2017-07-28 12:56:16.137000000

Patch Set 5: Patch Set 4 was rebased

-------------------------------------
author: Natasha Sullivan
date: 2017-07-28 13:13:14.609000000

Patch Set 5: Verified+1

-------------------------------------
author: Marques Ellis
date: 2017-08-01 13:32:55.509000000

Patch Set 5: Code-Review+2

-------------------------------------
author: Carmen Buckley
date: 2017-08-07 21:29:00.065000000

Patch Set 5: Code-Review+1

(2 comments)

Line:49, src/main/java/com/couchbase/client/core/hooks/CouchbaseCoreSendHook.java -> Is there a precedent for using Tuples in a public API? Wondering if it would make sense to strengthen the semantics by introducing a RequestAndResponse value object.

Line:226, src/main/java/com/couchbase/client/core/CouchbaseCore.java -> Should the error be submitted to the original response, or to the response provided by the hook?

-------------------------------------
author: Natasha Sullivan
date: 2017-08-08 15:39:26.434000000

Patch Set 5:

(2 comments)

Line:49, src/main/java/com/couchbase/client/core/hooks/CouchbaseCoreSendHook.java -> we are using the tuples quite a bit in the core library, but I don't think we expose it as part of the public API yet. 

Since this is advanced API I thought let's reuse what we have, but if you feel strongly about a value object we can introduce one :)

Line:226, src/main/java/com/couchbase/client/core/CouchbaseCore.java -> Since the response is passed into the hook and then transformed there, it will propagate through. The contract of the hook is that it always need s to return the original observable, but of course can transform it. But the backpressure is intended to be failed at the "bottom" and then propagate through the hook all the way up to the user.

-------------------------------------
author: Cory Peck
date: 2017-08-14 08:55:32.167000000

Patch Set 5:

(1 comment)

-------------------------------------
