Creating a RX Observable without calling onComplete is it Valid?

from the CommonsWare Community archives

At March 29, 2020, 2:28pm, islam.farid2100 asked:

I am doing a polling operation which I have to wait for updates and I created Rx Observable for that; however, I never call onComplete. but in onDestroy I unsubscribe. please take a look on the below code.

class TestPolling @Inject constructor() {
    var itemObservable: Observable<List<Items>>
        private set
    private lateinit var itemObservableEmitter: WeakReference<ObservableEmitter<List<Items>>>

    init {
        itemObservable = Observable.create { e -> itemObservableEmitter = WeakReference(e) }

    fun submitData(items: List<Items>) {

so is Valid to do something like that. I am not expert in Rx sorry if it is trivial question.

At March 29, 2020, 2:56pm, mmurphy replied:

I am not an RxJava expert, and so I have no idea whether your approach is considered to be a valid RxJava pattern or not. Sorry!