use of io.confluent.ksql.reactive.BaseSubscriber in project ksql by confluentinc.
the class BaseSubscriberWhiteboxVerificationTest method createSubscriber.
@Override
public Subscriber<JsonObject> createSubscriber(final WhiteboxSubscriberProbe<JsonObject> probe) {
final Context context = vertx.getOrCreateContext();
return new BaseSubscriber<JsonObject>(context) {
private Subscription subscription;
@Override
protected void afterSubscribe(final Subscription subscription) {
probe.registerOnSubscribe(new SubscriberPuppet() {
@Override
public void triggerRequest(long n) {
subscription.request(n);
}
@Override
public void signalCancel() {
subscription.cancel();
}
});
subscription.request(1);
this.subscription = subscription;
}
@Override
protected void handleValue(final JsonObject value) {
probe.registerOnNext(value);
subscription.request(1);
}
@Override
protected void handleComplete() {
probe.registerOnComplete();
}
@Override
public void handleError(final Throwable t) {
probe.registerOnError(t);
}
};
}
use of io.confluent.ksql.reactive.BaseSubscriber in project ksql by confluentinc.
the class BaseSubscriberBlackboxVerificationTest method createSubscriber.
@Override
public Subscriber<JsonObject> createSubscriber() {
final Context context = vertx.getOrCreateContext();
return new BaseSubscriber<JsonObject>(context) {
private Subscription subscription;
@Override
public synchronized void afterSubscribe(final Subscription s) {
s.request(1);
this.subscription = s;
}
@Override
public synchronized void handleValue(final JsonObject jsonObject) {
subscription.request(1);
}
};
}
Aggregations