Tellier Benoit created MAILBOX-364:
--------------------------------------
Summary: Create an EventBus
Key: MAILBOX-364
URL: https://issues.apache.org/jira/browse/MAILBOX-364
Project: James Mailbox
Issue Type: New Feature
Components: events
Reporter: Tellier Benoit
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:
{code:java}
interface Key {
}
class MailboxIdKey implements Key {
MailboxId id;
}
class UserKey implements Key {
User user;
}
{code}
Groups of workers:
{code:java}
interface Group {}
interface QuotaUpdaterGroup extends Group {}
{code}
A registration:
{code:java}
interface Registration {
void unregister();
}
{code}
Then the event bus API:
{code:java}
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);
}
{code}
You will:
- Implement this API and related contract tests with a memory implementation
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]