multiplexing vertx eventbus consumers?

776 views
Skip to first unread message

Edward Hsieh

unread,
Jun 28, 2016, 4:22:24 AM6/28/16
to vert.x
Hi,

My program have a requirement to write posts into database and search engine at the same time.
Is it possible to do this by multiple eventbus consumers which every consumer get all of the message the producer sent?

Edward Hsieh

unread,
Jun 28, 2016, 4:30:11 AM6/28/16
to vert.x
I forgot to mention that i would like to use multiple consumers with only one eventbus address.  Any suggestion?

Edward Hsieh於 2016年6月28日星期二 UTC+8下午4時22分24秒寫道:

Paulo Lopes

unread,
Jun 28, 2016, 5:42:50 AM6/28/16
to vert.x
on a typical jdbc connection there is no multiplexing and that's to the fact that RDBMs require a response to be returned before the next request is processed, however your clients can queue the request making it "feel" like multiplexing. Alternative you can use sevaral connections to emulate the behavior but in this case you loose all the transactionality support (unless you go with distributed tx's which will be a nightmare).

regarding your second question you can have multiple consumers registered to the same address that is fine and there will be some load balancing at the eventbus level when a message is sent to the address, however say that you issue a query that takes several minutes to return the eventbus will not do heuristics to choose a consumer that is free or with less load...

privacynow

unread,
Jun 28, 2016, 9:35:30 PM6/28/16
to vert.x
I think Edward is asking about multicast. Meaning that for a given address, each message gets played to multiple subscribers.

I am a beginner with vertx so take my answer with a grain of salt, but I used lmax ring buffer to handle multicast applications with parallel processing needs (it has a very nice dsl too).

Edward Hsieh

unread,
Jun 29, 2016, 1:00:46 AM6/29/16
to ve...@googlegroups.com
Paulo and Fbabar, thanks for your response.
Yes Fbabar got my point.
After digging more into the documents and took some experiments,
I think vertx do multicasting.
In fact it's easy.

vertx.eventBus().publish(obj)

do the trick.
What make me confuse is that

producer = vertx.eventBus().publisher(ADDRESS);
producer.send(obj);


only send message to a single consumer.
For message to publish to all consumers, it should be written as:

producer = vertx.eventBus().publisher(ADDRESS);
producer.write(obj);


On the other hand there is no publish(obj) method in MessageProducer.
No wonder i got stuck with the usage of MessageProducer for a little time.

 


--
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/b_0SuxHEQ40/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/2a6300a3-b648-4bd0-bf37-95cbbd56c5fc%40googlegroups.com.

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



--
Edward Hsieh / 謝鎮澤
Always trust the one who is looking for the truth, not the one who has found it. :-)

Sean Burns

unread,
Jun 30, 2016, 1:54:09 AM6/30/16
to vert.x
I had the same issue a few weeks ago, and have already opened a usability issue.

Reply all
Reply to author
Forward
0 new messages