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:
Follow these videos to build your own AsyncAPIs:
▶️ Design AsyncAPI Specifications in Design Center▶️ Implement AsyncAPIs with Anypoint MQ and Anypoint Code Builder▶️ Design, Govern, and Implement AsyncAPIs Locally with Kafka▶️ Create an AsyncAPI in Anypoint Code Builder with Salesforce Platform Events
Complement your learnings with these blog posts:
- Design AsyncAPI Specifications With a Practical Example
- Develop AsyncAPIs With Anypoint MQ and Anypoint Code Builder
- Develop AsyncAPIs on Anypoint Code Builder with Solace PubSub+ locally (Docker)
- Design, Govern, and Implement AsyncAPIs in Anypoint Code Builder
- TBD - Designing AsyncAPIs using Salesforce Platform Events vs. CDC
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.
- Go to the anypointmq/ folder
- Create the Accounts Service AsyncAPI in Design Center using this specification: accounts-service.yaml
- Create the Email Service AsyncAPI in Design Center using this specification: email-service.yaml
- Publish them both to Exchange
- Create new Mule projects in ACB for both Accounts and Email services OR use the code from the mule-projects/ folder:
- accounts-service/
- email-service/
- (I recommend you create them from scratch and just use these as a guide)
- Make sure you add your properties inside the
dev-properties.properties
files (also add your orgID in the last property)
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.
- Go to the kafka/ folder
- Create the Accounts Service AsyncAPI in Anypoint Code Builder using this specification: accounts-service.yaml
- Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in accounts-service/ for guidance
- In another VS Code window, create the Email Service AsyncAPI in Anypoint Code Builder using this specification: email-service.yaml
- Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in email-service/ for guidance
- 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)
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.
- Go to the sfplatformevents/ folder
- 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
- Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in email-service/ for guidance
- Make sure you add your properties inside the
dev-properties.properties
file
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.
- Go to the sfcdc/ folder
- 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
- Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in email-service/ for guidance
- Make sure you add your properties inside the
dev-properties.properties
file
Important
Make sure you are running Solace locally before implementing the specifications. For more information to run Solace locally, see this.
- Go to the solace/local/ folder
- Create the Accounts Service AsyncAPI in Anypoint Code Builder using this specification: accounts-service.yaml
- Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in accounts-service/ for guidance
- In another VS Code window, create the Email Service AsyncAPI in Anypoint Code Builder using this specification: email-service.yaml
- Publish it to Exchange and implement it in Anypoint Code Builder. Take a look at the code in email-service/ for guidance
- 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)