Skip to content

Problem with Flowable.generate() (RxJava 2) #4931

Closed
@smiklos

Description

@smiklos

I'm using RxJava version 2.0.2 and wanted to implement a some logic using Flowable.generate.

Based on the documentation, if I emit more than one item in when calling onNext on the emitter instance, I should get an IllegalStateException, but in reality I experience a different behavior:

Taking this example:

 Flowable<Object> test = Flowable.generate(emitter -> {
            emitter.onNext("test");
            emitter.onNext("test more");
        }).observeOn(Schedulers.io(), false,5)
          .doOnNext(System.out::println);
        test.blockingSubscribe();

I get this error: io.reactivex.exceptions.MissingBackpressureException: Queue is full?!

and if I just try:

    Flowable<Object> test = Flowable.generate(emitter -> {
            emitter.onNext("test");
            emitter.onNext("test more");
        })
       .doOnNext(System.out::println);
        test.subscribe();

then it just pushes the values indefinitely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions