Is there anyway to get notified if there is no consumer listening for a key?

40 views
Skip to first unread message

张斌

unread,
Mar 6, 2014, 11:19:11 AM3/6/14
to reactor-...@googlegroups.com

 reactor.notify(Object key, E ev)

 Is there anyway to get notified if there is no consumer listening for the key?    
 
Thanks
Bin

Jon Brisbin

unread,
Mar 6, 2014, 11:29:18 AM3/6/14
to 张斌, reactor-...@googlegroups.com
We don't currently have a built-in "fallback" option in case no consumers are found. It's possible to accomplish the same thing with an onComplete handler and checking whether an Event was handled or not, but that's not going to be the cleanest or most performant solution.

We're looking at providing alternative consumer registries that suit specific circumstances so it might be a good idea to have an issue on this so we can include a configuration knob to capture events that might otherwise disappear if no consumers are found.


Thanks!

Jon Brisbin | Reactor Project Lead

--
You received this message because you are subscribed to the Google Groups "reactor-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reactor-framew...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

张斌

unread,
Mar 7, 2014, 2:21:57 AM3/7/14
to reactor-...@googlegroups.com, 张斌
Thanks Jon for your suggestion.

I created a issue for this,  https://github.com/reactor/reactor/issues/297

Thanks,
Bin

张斌

unread,
Apr 1, 2014, 12:59:19 PM4/1/14
to reactor-...@googlegroups.com, 张斌
I just checked the latest artifact which provided a central way to configure a callback for a notification key, which is great!

Reactors.reactor().env(env).consumerNotFoundHandler(new Consumer<Object>() {
@Override
public void accept(Object key) {
//todo something with the key...
}
}).get();



But I just wonder if we can  have this improvement, where the consumer is  onConsumerMissing ?
because if using the central way, we don't know which event is discarded, but only know the key.

reactor.notify(Object key, E ev, new Consumer<Object>() {
@Override
public void accept(Object key) {
    // todo something with the key and event...
        }
});

Or any other ways to achieve this?

Thanks,
Bin
Reply all
Reply to author
Forward
0 new messages