@@ -21,8 +21,13 @@ public class FluxStreamer<T> extends Streamer<T> {
21
21
private final Flux <T > results ;
22
22
private final AtomicReference <BaseSubscriber > subscriberRef = new AtomicReference <>();
23
23
24
- public FluxStreamer (Flux <T > results , PerRun perRun , String streamId , Config streamConfig , Function <T , Result > convert ) {
25
- super (perRun , streamId , streamConfig , convert );
24
+ public FluxStreamer (Flux <T > results ,
25
+ PerRun perRun ,
26
+ String streamId ,
27
+ Config streamConfig ,
28
+ Function <T , Result > convertResult ,
29
+ Function <Throwable , com .couchbase .client .protocol .shared .Exception > convertException ) {
30
+ super (perRun , streamId , streamConfig , convertResult , convertException );
26
31
this .results = results ;
27
32
}
28
33
@@ -35,7 +40,7 @@ public boolean isCreated() {
35
40
public void run () {
36
41
AtomicBoolean done = new AtomicBoolean (false );
37
42
38
- BaseSubscriber < T > subscriber = new BaseSubscriber <T >() {
43
+ BaseSubscriber subscriber = new BaseSubscriber <T >() {
39
44
@ Override
40
45
protected void hookOnSubscribe (Subscription subscription ) {
41
46
if (streamConfig .hasAutomatically ()) {
@@ -49,7 +54,7 @@ protected void hookOnSubscribe(Subscription subscription) {
49
54
protected void hookOnNext (T value ) {
50
55
logger .info ("Flux streamer {} sending one" , streamId );
51
56
52
- perRun .resultsStream ().enqueue (convert .apply (value ));
57
+ perRun .resultsStream ().enqueue (convertResult .apply (value ));
53
58
streamed .incrementAndGet ();
54
59
}
55
60
@@ -79,8 +84,9 @@ protected void hookOnError(Throwable throwable) {
79
84
80
85
perRun .resultsStream ().enqueue (Result .newBuilder ()
81
86
.setStream (com .couchbase .client .protocol .streams .Signal .newBuilder ()
82
- // todo convert error
83
- .setError (com .couchbase .client .protocol .streams .Error .newBuilder ().setStreamId (streamId )))
87
+ .setError (com .couchbase .client .protocol .streams .Error .newBuilder ()
88
+ .setException (convertException .apply (throwable ))
89
+ .setStreamId (streamId )))
84
90
.build ());
85
91
}
86
92
0 commit comments