Skip to content

0.7.0

Compare
Choose a tag to compare
@oskardudycz oskardudycz released this 12 Apr 16:02
· 159 commits to main since this release

🚀 What's New

  • Added in-memory Message Bus implementation. It's a small step towards handling read models and subscriptions in Emmett. It allows publishing events, sending commands, and handling them in memory. Read more in the article How to build an in-memory Message Bus in TypeScript by @oskardudycz in #58

    Basic usage:

    import { getInMemoryMessageBus } from '@event-driven-io/emmett';
    
    const messageBus = getInMemoryMessageBus();

    registering handlers:

    messageBus.subscribe(
      handleGuestStay,
      'GuestCheckedIn',
      'ChargeRecorded',
      'GuestCheckedOut',
      'GuestCheckoutFailed',
    );
    

    And publishing new event:

    const event:GuestCheckedOut = {
      type: 'GuestCheckedOut',
     data: {
        guestStayAccountId: 'r9293';
        checkedOutAt: new Date();
      }
    >;
    await messageBus.publish(event);

Full Changelog: 0.6.0...0.7.0