/** * A short-hand alias for {@link Selectors#anonymous()}. * <p/> * Creates an anonymous {@link Selector}. * * @return a new Selector * * @see ObjectSelector */ public static Selector $() { return anonymous(); }
/** * Register the given {@link reactor.fn.Consumer} on an anonymous {@link reactor.bus.selector.Selector} and * set the given event's {@code replyTo} property to the corresponding anonymous key, then register the consumer to * receive replies from the {@link reactor.fn.Function} assigned to handle the given key. * * @param key The key to be matched by {@link Selector Selectors} * @param event The event to notify. * @param reply The consumer to register as a reply handler. * @return {@literal this} */ public <T extends Event<?>> EventBus sendAndReceive(Object key, Event<?> event, Consumer<T> reply) { Selector sel = Selectors.anonymous(); on(sel, reply).cancelAfterUse(); notify(key, event.setReplyTo(sel.getObject())); return this; }