/asyncapis-accounts-email

All the resources you need to implement a functional simple architecture with an Accounts and an Email services using AsyncAPI, Anypoint Code Builder, and the available message brokers: Anypoint MQ, Kafka, Solace PubSub+, and Salesforce CDC/Platform Events

Accounts & Email AsyncAPIs

All the resources you need to implement a functional simple architecture with an Accounts and an Email services using AsyncAPI, Anypoint Code Builder, and brokers like AnypointMQ and Kafka.

Architecture based on this article by AsyncAPI:

Similar repos

Resources

Follow these videos to build your own AsyncAPIs:

Complement your learnings with these blog posts:

Folders structure

Anypoint MQ

Important

Make sure you are using an Anypoint Platform Enterprise account to be able to create queues in AnypointMQ. For detailed instructions see the resources at the top.

  1. Go to the anypointmq/ folder
  2. Create the Accounts Service AsyncAPI in Design Center using this specification: accounts-service.yaml
  3. Create the Email Service AsyncAPI in Design Center using this specification: email-service.yaml
  4. Publish them both to Exchange
  5. Create new Mule projects in ACB for both Accounts and Email services OR use the code from the mule-projects/ folder:
  6. Make sure you add your properties inside the dev-properties.properties files (also add your orgID in the last property)

Kafka (locally)

Important

Make sure you are running Kafka locally in port 9092 or change it in the specifications before implementing them. For more information to run Kafka locally, see this. For detailed instructions see the resources at the top.

  1. Go to the kafka/ folder
  2. Create the Accounts Service AsyncAPI in Anypoint Code Builder using this specification: accounts-service.yaml
  3. Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in accounts-service/ for guidance
  4. In another VS Code window, create the Email Service AsyncAPI in Anypoint Code Builder using this specification: email-service.yaml
  5. Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in email-service/ for guidance
  6. Run both projects locally (since ACB doesn't allow this, as workaround, change the Mule runtime version from one of the projects to a different one. For example, accounts with runtime 4.8 and email with runtime 4.7)

Salesforce Platform Events

Important

Set up your Salesforce Platform Event, Object (and Tab), and Trigger Flow before creating the Mule specification/project. For detailed instructions see the resources at the top.

Note

This example takes one Platform Event and publishes another one. As opposed to Anypoint MQ, Kafka, and Solace, in this example there are two channels and only one AsyncAPI spec/app.

  1. Go to the sfplatformevents/ folder
  2. Create the Email Service AsyncAPI in Anypoint Code Builder using this specification: email-service.yaml - note that you will have to adjust it to your own Platform Event / Object fields
  3. Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in email-service/ for guidance
  4. Make sure you add your properties inside the dev-properties.properties file

Salesforce CDC (Change Data Capture)

Important

Set up your Salesforce Object (and Tab) and CDC before creating the Mule specification/project. For detailed instructions see the resources at the top.

Note

This example only includes subscription to CDC, not publication.

  1. Go to the sfcdc/ folder
  2. Create the Email Service AsyncAPI in Anypoint Code Builder using this specification: email-service.yaml - note that you will have to adjust it to your own Object fields
  3. Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in email-service/ for guidance
  4. Make sure you add your properties inside the dev-properties.properties file

Solace (locally)

Important

Make sure you are running Solace locally before implementing the specifications. For more information to run Solace locally, see this.

  1. Go to the solace/local/ folder
  2. Create the Accounts Service AsyncAPI in Anypoint Code Builder using this specification: accounts-service.yaml
  3. Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in accounts-service/ for guidance
  4. In another VS Code window, create the Email Service AsyncAPI in Anypoint Code Builder using this specification: email-service.yaml
  5. Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in email-service/ for guidance
  6. Run both projects locally (since ACB doesn't allow this, as workaround, change the Mule runtime version from one of the projects to a different one. For example, accounts with runtime 4.8 and email with runtime 4.7)