StompProtocolAndroid
StompProtocolAndroid copied to clipboard
OnErrorNotImplementedException:
I have did error but exception in coming and keep crashing.
Disposable dispTopic = mStompClient.topic("/exch************" + DataHolder.getInstance().getDirectChannels().get(i).id)
.subscribeOn(Schedulers.io())
.doOnError(error -> Log.d(TAG,"The error message is: " + error.getMessage()))
.onErrorReturn(error -> {
if (error instanceof NumberFormatException) return StompMessage.from(error.getMessage());
else throw new IllegalArgumentException();
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe(topicMessage -> {
Log.d(TAG, "Received " + topicMessage.getPayload());
Gson gson = new Gson();
MessageContent messageContent = gson.fromJson(topicMessage.getPayload(), MessageContent.class);
mMessageContentLiveData.postValue(messageContent);
handleNotification(messageContent);
}, error -> Log.d(TAG,"onError should not be printed!"));
compositeDisposable.add(dispTopic);
}
io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | java.util.NoSuchElementException at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704) at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701) at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:77) at io.reactivex.internal.observers.BasicFuseableObserver.onError(BasicFuseableObserver.java:100)
This issue is not addressed by them. Use this below library instead written in latest rxjava, pub-sub pattern. Replace the url and port with your server url and port.
https://github.com/SayyedUmar/Stomp-Android-Client
Use this library its working fine, replace server url and port with your custom server url and your port. https://github.com/SayyedUmar/Stomp-Android-Client
#156 This may help you.