Weird behaviour invoking Observable.create

23 views
Skip to first unread message

Oren Shvalb

unread,
Jul 28, 2016, 10:59:22 AM7/28/16
to vert.x
Hi guys,

I'm pretty new to RxJava and having troubles using Observable#create. 

I'm trying to create an Observable that parses an xml file and every time it has an element it invokes onNext(element), and when it reaches END_DOCUMENT it returns onCompleted().

The problem is that it does triggers onDoNext(e), but it does NOT trigger doOnCompleted()

I'm trying to figure out what am I doing wrong...

Here is a gist:


and a zip of the full test project is attached.

Thank you!
TestProject.zip

Yves Peckstadt

unread,
Jul 28, 2016, 9:29:27 PM7/28/16
to vert.x
Is it possible that something is going wrong while parsing the elements and you are just not receiving the error?  Currently you are doing the onNext and onCompleted but you are not catching any possible errors that are being thrown.

You can use doOnError or doAfterTerminate events or just use the Observable like this.



.subscribe(success -> {

},throwable -> {

},() -> {

});

Oren Shvalb

unread,
Jul 28, 2016, 11:13:13 PM7/28/16
to ve...@googlegroups.com
I will try that - Thanks!


--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/314G5U428zw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/885ae6c2-1f75-444a-8906-9bab43fe14bc%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages