/** * Registers publisher using a given api * See Events#publisher(Class, Result) for documentation * * @see Events#publisher(Class, Result) */ @Pin <T> T publisher(Class<T> api);
/** * Registers subscribers using a given api * See Events#subscriber(Class, Object, Result) for documentation * * @see Events#subscriber(Class, Object, Result) */ <T> Cancel subscriber(Class<T> api, @Pin T subscriber); }
/** * Registers consumer using a given api * See Events#consumer(Class, Object, Result) for documentation * * @see Events#consumer(Class, Object, Result) */ <T> Cancel consumer(Class<T> api, @Pin T consumer);
/** * Registers an event publisher of a given class. * <p> * Internally, the api.getName() is used as a path. * * @param api api class (interface) of the sender proxy * @param result holder for the sender proxy instance * @param <T> type i.e. sender interface */ <T> void publisher(Class<T> api, @Pin Result<T> result);
/** * Registers a subscriber at a given path. * * @param path path / queue name * @param consumer consumer object, must conform to the sender api * @param result holder for event consumer cancel handler * @param <T> type i.e. receiver interface */ <T> void subscriber(String path, @Pin T consumer, Result<? super Cancel> result);
/** * Registers publisher at path. * See Events#publisherPath(String, Class, Result) for documentation * * @see Events#publisherPath(String, Class, Result) */ @Pin <T> T publisherPath(String path, Class<T> api);
/** * Registers consumer for a given path. * See Events#consumer(String, Object, Result) for documentation * * @see Events#consumer(String, Object, Result) */ <T> Cancel consumer(String path, @Pin T consumer);
/** * Registers subscriber for a given path * See Events#subscriber(String, Object, Result) for documentation * * @see Events#subscriber(String, Object, Result) */ <T> Cancel subscriber(String path, @Pin T subscriber);
/** * Registers an event publisher at a given path. * * @param path path / queue name * @param api api class (interface) of the sender proxy * @param result holder for the sender proxy instance * @param <T> type i.e. sender interface */ <T> void publisherPath(String path, Class<T> api, @Pin Result<T> result);
/** * Registers consumer at a given path. * <p> * Messages are consumed after reaching a consumer. * * @param path path / queue name * @param consumer consumer object, must conform to the sender api * @param result holder for event consumer cancel handler * @param <T> type i.e. receiver interface */ <T> void consumer(String path, @Pin T consumer, Result<? super Cancel> result);
/** * Registers consumer using a given api class. * <p> * Internally, the api.getName() is used as a path. * * @param api api class (interface) of a consumer object * @param consumer consumer object, must conform to the sender api * @param result holder for event consumer cancel handler * @param <T> type i.e. receiver interface */ <T> void consumer(Class<T> api, @Pin T consumer, Result<? super Cancel> result);
/** * Registers a subscriber using a given api class. * <p> * Internally, the api.getName() is used as a path * * @param api api class (interface) of a consumer object * @param consumer consumer object, must conform ot the sender api * @param result holder for event consumer cancel handler * @param <T> type i.e. receiver interface */ <T> void subscriber(Class<T> api, @Pin T consumer, Result<? super Cancel> result); }
/** * Run the task at the given time. * * The task implements {@code Consumer} to accept a cancel. * * <blockquote><pre> * // run 5 seconds from now * timers.runAt(task, System.currentTimeMillis() + 5000); * </pre></blockquote> * * @param task the task to execute * @param time millisecond time since epoch to run * @return cancel handler */ Cancel runAt(@Pin Consumer<? super Cancel> task, long time);
/** * Run the task <b>once</b> after the given delay. * * <pre> * MyRunnable task = new MyRunnable(); * * // run once 10 seconds from now * timers.runAfter(task, 10, TimeUnit.SECONDS); * </pre> * * @param task the executable timer task * @param delay time to delay in units * @param unit unit type specifier * @return cancel handler */ Cancel runAfter(@Pin Consumer<? super Cancel> task, long delay, TimeUnit unit);
/** * Run the task periodically after the given delay. * * <pre> * MyRunnable task = new MyRunnable(); * * // run every 10 seconds * timers.runEvery(task, 10, TimeUnit.SECONDS); * </pre> * * @param task task to execute * @param delay run period * @param unit run period time units * @param result cancel handler */ void runEvery(@Pin Consumer<? super Cancel> task, long delay, TimeUnit unit, Result<? super Cancel> result);
/** * Run the task at the given time. * * The task implements {@code Consumer} to accept a cancel. * * <blockquote><pre> * // run 5 seconds from now * timers.runAt(task, System.currentTimeMillis() + 5000); * </pre></blockquote> * * @param task the task to execute * @param time millisecond time since epoch to run * @param result cancel handler */ void runAt(@Pin Consumer<? super Cancel> task, long time, Result<? super Cancel> result);
/** * Run the task periodically after the given delay. * * <pre> * MyRunnable task = new MyRunnable(); * * // run every 10 seconds * timers.runEvery(task, 10, TimeUnit.SECONDS); * </pre> * * @param task task to execute * @param delay run period * @param unit run period time units * @return cancel handler */ Cancel runEvery(@Pin Consumer<? super Cancel> task, long delay, TimeUnit unit);
/** * Run the task <b>once</b> after the given delay. * * <pre> * MyRunnable task = new MyRunnable(); * * // run once 10 seconds from now * timers.runAfter(task, 10, TimeUnit.SECONDS); * </pre> * * @param task the executable timer task * @param delay time to delay in units * @param unit unit type specifier * @param result cancel handler */ void runAfter(@Pin Consumer<? super Cancel> task, long delay, TimeUnit unit, Result<? super Cancel> result);
void schedule(@Pin Consumer<? super Cancel> task, LongUnaryOperator nextTime, Result<? super Cancel> result);
Cancel schedule(@Pin Consumer<? super Cancel> task, LongUnaryOperator nextTime);