Wrong order of received messages sometimes in realtime-android

98 views
Skip to first unread message

Bruno Salmon

unread,
Dec 11, 2014, 9:33:54 AM12/11/14
to goodow-...@googlegroups.com
hi 田传武,

I use your realtime-android module in a JavaFX client to send and receive messages to a Vert.x server over the event bus (thank you for having replied to my question: "what is the java equivalent of the vertxbus.js for a websocket based event bus communication?" on the Vert.x google group).

It's working fine :-) but I noticed a little problem regarding the order of received messages: when the flow of message becomes a bit high, the order of received messages is not always the same as the order of sent messages by the server which makes things more complicated to me. For example, the last message received on the client is not always the last message sent by the server but can be an older message.

When I use your module in association with Vert.x on the client (using your VertxPlatform factory), this problem disappears (the received messages are always in the same order as the sent messages). However I would like to avoid embedding Vert.x in the client because I would like the client to be as thin as possible. So I would prefer to use your module alone.

Is it an issue that you could fix in your realtime-android module?

Thanks,
Bruno.

田传武

unread,
Dec 11, 2014, 10:04:43 AM12/11/14
to Bruno Salmon, goodow-...@googlegroups.com
The unordered message handlers may be caused by thread pool size, try to change Executors.newScheduledThreadPool(4) to Executors.newScheduledThreadPool(1)

--
You received this message because you are subscribed to the Google Groups "Goodow Realtime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to goodow-realti...@googlegroups.com.
To post to this group, send email to goodow-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/goodow-realtime/8a0051af-c7dd-49d0-8777-febcdecfc716%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bruno Salmon

unread,
Dec 11, 2014, 10:42:57 AM12/11/14
to goodow-...@googlegroups.com, bruno....@gmail.com
Target hit!

The problem is fixed indeed if I set the tread pool size to 1, all messages arrive in the right order :-)

Could that tread pool size become a parameter in a future release of your module?

Thanks for your quick reply

田传武

unread,
Dec 11, 2014, 9:04:10 PM12/11/14
to goodow-...@googlegroups.com, bruno....@gmail.com
Done

Bruno Salmon

unread,
Dec 12, 2014, 3:51:52 AM12/12/14
to goodow-...@googlegroups.com, bruno....@gmail.com
Great, thank you again for your quick reply :-)
Reply all
Reply to author
Forward
0 new messages