Uploaded image for project: 'James Mailbox'
  1. James Mailbox
  2. MAILBOX-364

Create an EventBus

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • events
    • 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

      Attachments

        Activity

          People

            Unassigned Unassigned
            btellier Benoit Tellier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: