Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The idea:
- The caller is reponsible of unsubscribing
- Clearly separate concerns between 'jobs' and 'registrations'
- Generify the concept of 'registration' so that I can register stuff on more that a mailbox.
The API proposal:
First let's create registration keys:
interface Key { } class MailboxIdKey implements Key { MailboxId id; } class UserKey implements Key { User user; }
Groups of workers:
interface Group {} interface QuotaUpdaterGroup extends Group {}
A registration:
interface Registration {
void unregister();
}
Then the event bus API:
interface EventBus { Registration register(Listener listener, Key key); Registration register(Listener listener, Group group); CompletableFuture<Void> dispatch(Event event, Key key); CompletableFuture<Void> dispatch(Event event, Set<Key> key); }
You will:
- Implement this API and related contract tests with a memory implementation