Class RxStreams

java.lang.Object
com.alibaba.dashscope.resources.RxStreams

public final class RxStreams extends Object
Bridges pull-based ResponseStream into RxJava Flowable (2.x streaming parity).

The upstream stream opens on the first subscription and is shared by all live subscribers; once every subscriber has cancelled, the producer stops reading and closes the underlying stream (a cancelled subscriber must not leave the producer draining to EOF). Re-subscribing after full cancellation opens a new upstream. Slow subscribers are served from an unbounded buffer (BackpressureStrategy.BUFFER, same as the 2.x SSE bridge).

  • Method Details

    • fromStream

      public static <T> io.reactivex.Flowable<T> fromStream(Supplier<ResponseStream<T>> streamSupplier, Executor executor)
    • fromIterable

      public static <T, S extends Iterable<T> & AutoCloseable> io.reactivex.Flowable<T> fromIterable(Supplier<S> streamSupplier, Executor executor)
      Same bridge for the job-event streams (fine-tunes/deployments), which are not SSE-framed.