Messages sent to addresses w/ no handlers

507 views
Skip to first unread message

Matt Stine

unread,
Sep 19, 2012, 12:22:37 AM9/19/12
to ve...@googlegroups.com
Just sanity checking myself here.

It looks to me that if I send an event bus message to an address w/ no
registered handlers, that message effectively goes to /dev/null.

Correct?

--
Matt Stine
Deep South Software: Training, Consulting, Coaching
http://www.deepsouthsoftware.com
matt....@gmail.com

Tim Fox

unread,
Sep 19, 2012, 3:55:44 AM9/19/12
to ve...@googlegroups.com
On 19/09/2012 05:22, Matt Stine wrote:
> Just sanity checking myself here.
>
> It looks to me that if I send an event bus message to an address w/ no
> registered handlers, that message effectively goes to /dev/null.

Correct
>
> Correct?
>


Brian Lalor

unread,
Sep 19, 2012, 5:47:47 AM9/19/12
to ve...@googlegroups.com
It'd be nice if there were a way to get an error when that happens. If you're waiting on a reply to a message that was never received, you could be waiting for a very long time (ie. forever). Seems reasonable that an exception could be thrown…

matt....@gmail.com

unread,
Sep 19, 2012, 6:38:52 AM9/19/12
to ve...@googlegroups.com
Actually for me this is precisely the behavior I want...at least for the use case I'm working on.

Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "vert.x" group.
> To post to this group, send an email to ve...@googlegroups.com.
> To unsubscribe from this group, send email to vertx+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/vertx?hl=en-GB.
>

Brian Lalor

unread,
Sep 19, 2012, 6:39:52 AM9/19/12
to ve...@googlegroups.com
On Sep 19, 2012, at 6:38 AM, matt....@gmail.com wrote:

> Actually for me this is precisely the behavior I want...at least for the use case I'm working on.

I'm getting around this problem by adding a timeout; if a reply isn't received in a reasonable amount of time, assume that there's no handler. Ugly, but workable…

Joern Bernhardt

unread,
Sep 19, 2012, 6:50:43 AM9/19/12
to ve...@googlegroups.com

How did you get this to work? Can you unregister the waiting reply-handler then?
It would be nice to have something like a timeout / exception handler built-in.

Brian Lalor

unread,
Sep 19, 2012, 7:21:37 AM9/19/12
to ve...@googlegroups.com
On Sep 19, 2012, at 6:50 AM, Joern Bernhardt <joern.b...@googlemail.com> wrote:

I'm getting around this problem by adding a timeout; if a reply isn't received in a reasonable amount of time, assume that there's no handler.  Ugly, but workable…

How did you get this to work? Can you unregister the waiting reply-handler then?
It would be nice to have something like a timeout / exception handler built-in.


However, something like this should work:

function handler(msg) {
    if (msg.timeout === true) { /* handle timeout */ }
    else {
        …
    }
}

var timerId = vertx.setTimer(2000, function(msg) { handler({"timeout":true}); });
vertx.eventBus.send("addr", {"payload" : {…}}, handler);

It does not unregister the reply handler, however.  This is a resource leak…
Reply all
Reply to author
Forward
0 new messages