StompProtocolAndroid icon indicating copy to clipboard operation
StompProtocolAndroid copied to clipboard

OnErrorNotImplementedException:

Open BilalSiddiqui opened this issue 6 years ago • 3 comments

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)

BilalSiddiqui avatar Feb 12 '19 11:02 BilalSiddiqui

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

testGumar avatar Apr 29 '19 15:04 testGumar

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

testGumar avatar May 01 '19 07:05 testGumar

#156 This may help you.

marain87 avatar Feb 09 '20 12:02 marain87