my question is similar to AndThen executes before completable finished
getLicensePlateObservable(plateNumber)
.flatMapCompletable {
licensePlateId = it.id
getRemoveLicensePlateCompletable(licensePlateId)
}
.andThen(getNotifyCompletable(email, licensePlateId))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
getLicensePlateObservable makes a network request to fetch a LicensePlate. I expected it to fetch the LicensePlate, store the id into a member var licensePlateId and remove the license plate. Then the owner with member var email should be notified about the removal.
What actually occurs is getNotifyCompletable is executed before getRemoveLicensePlateCompletable. Why did this occur and how can I make it run serially? Thanks in advance.