Design and Model Your Event-Driven Architecture

This tutorial will teach you how to design a basic event-driven architecture (EDA). We will use the Acme Rideshare sample architecture to explore Designer and create a new application to extend the EDA. The following topics are covered in this tutorial:

  1. Import a Sample Architecture
  2. Create an Application
  3. Design Your Event-Driven Architecture
  4. Generate AsyncAPI Document

Before you Begin

  • To complete these tutorials, you must have a PubSub+ Cloud account. If you haven't already, complete the Accessing PubSub+ Cloud tutorial.
  • Ensure that you have the correct user role and permission in Event Portal. At minimum, you will need the Event Portal Manager permission. For more information, refer to Managing Users, Roles, and Permissions.

Import a Sample Architecture

To get started with Designer, you must create an application domain and a Logical Event Mesh (LEM). Since we are importing a sample architecture, it already has an application domain and a LEM. If you want to create your own application domain and LEM, refer to Creating an Application Domain or Designer

To import a sample architecture into Designer, perform the following steps.

  1. Log in to your PubSub+ Cloud account.
  2. Click the Designer card or the icon on the left navigation bar.
  3. There are a few ways to access the samples:
    • If you are new user with a trial account, on the Topology screen, identify a sample you want to try and click Use Sample. Or, click the Try a Sample button in the Designer Toolkit and select a sample you want to use.
    • If you are an existing user, click the Learn & Help icon and select Event Portal Sample Files to use a sample.
  4. Double-click the application domain to review the architecture. Depending on the sample, you will notice several schemas and events, and applications publishing and subscribing to those events.
  5. Double-click on an object to see its details.

We can now create and add new objects to evolve the architecture. In the next topics create application to get customer analytics—a Ride Response Analytics—that helps understand customers waiting period from the time they request a ride. In the next topics, we do the following

  • create an application
  • subscribe to an event
  • download the AsyncAPI document

Create an Application

In this step, we will create an application that monitors the passengers' waiting period after they request a ride. We will create a new application, client delivery endpoint (CDE), and use the application to subscribe to the TripUpdated event in the sample architecture.

  1. Inside the application domain, select the Applications tab and click Create Application.
  2. In the pop-up dialog that appears, complete the following basic configuration:
    • Name: Give a name to the application.
    • Description: Provide information about the application. The Description text box supports native Markdown. This enables you to include custom attributes in Markdown to be included in the AsyncAPI document. Click toggle preview to preview raw markdown text in HTML format.
    • Application Type: (optional) Specify the application type as Standard or Kafka Connector. Setting an application to a specific application types is a one-time activity so that applications can leverage the associated platform's specific capabilities.
    • Client Delivery Endpoints: Create a Client Delivery Endpoints (CDEs) and add a subscription. A CDE specifies the location on an Event Mesh that is used by an application to consume events. To create a CDE, refer to Create a CDE & Add Subscriptions
  3. Once the above configuration is completed, click Save.

Create a CDE & Add Subscriptions

The Client Delivery Endpoint (CDE) specifies the location on an Event Mesh that is used by an application to consume events.

To create a CDE and add a subscription, do the following:

  1. Inside the publisher app, select the Client Delivery Endpoints tab.
  2. Click Create Client Delivery Endpoint located on the right.

  3. On the dialog that appears, complete the following steps:
    1. Give a Name to the CDE
    2. Select a LEM using the drop-down menu. If you don't have a LEM setup, click Add New to create one.
    3. Select the CDE Type. Your CDE can be a Kafka Consumer Group, Event Queue, Durable Topic Endpoint, or Direct Client Endpoint. For this tutorial, we will select Event Queue.
    4. Write the Client Username you want to use.
  4. We will now Add Subscriptions. You can add subscriptions to By Events or Manually. The manual subscription builder is not supported for Kafka subscriptions. To add subscriptions manually, refer to the detailed CDE tutorial. In this example, we will add subscriptions By Events. We will subscribe to the TripUpdated event.
    1. Select Add Subscription > By Events.
    2. Click the add symbol () beside an event to build subscriptions. In this case, we will select TripUpdated event.

      Cross-domain events (events originating from another application domain) that are non-shared are flagged with an orange marker. To be able to view cross-domain non-shared events and to use them to build subscriptions, users must be assigned to the application domain where the non-shared events belong. For more information, see Design and Model Your Event-Driven Architecture.

    3. On the dialog that appears, if you have variables you can set the variables to specify the events you want to subscribe to. In the example below we update the {trip_status} variable as we want the time-stamp information for the entire trip. To add the subscription, select Add Subscriptions and then click the Select button.
    4. Click Add Subscriptions. The event will display on the Subscribed Events list.
    5. Click Create.
  5. Click Save to create the application.

At this point you've extended the architecture by create a new monitoring application that subscribes to the event to monitor a customer's waiting period after they request a ride. In the next step, we will review the overall architecture along with the new application we created.

Design Your Event-Driven Architecture

In our sample architecture, we now have a new application that is subscribed to the TripUpdate event. Notice the event paths that connects event applications and arrows that indicate the association type (published or subscribed). At this stage, you can create additional application-to-event association or update existing associations.

You can now generate an Async API document for the application you created.

Generate AsyncAPI Document

To generate an AsyncAPI document, do the following.

  1. In Graph View, select the application for which you want to generate the AsyncAPI document.
  2. Right-click on the application, or click Actions (...)on the panel located on the top right.
  3. From the options, select AsyncAPI.
  4. Choose your file format and click the Download button. The Async API specification will be downloaded to your computer.

You can now use the AsyncAPI specification as an input to a code generator to created your event-driven application using the language and framework of your choice. You can learn more on their website at https://www.asyncapi.com.

Next Steps