Tutorial: Teaching How to Use the Solace MuleSoft Connector
Late October, Solace released the PubSub+ Connector for MuleSoft Anypoint Platform 1.0.0. You can see the release notes here and download it from MuleSoft Exchange. To help developers to learn how to use the connector, community member @citurria has written the tutorial (Thank you, Carlos!). The following is an excerpt of it and the link to his entire article. Feel free to post your questions and comments for @citurria below. Meanwhile, I hope more of our community members can write about their experiences with Solace PubSub+ and share them in the community. If you need help with your writing or have a suggested topic, feel free to reach me @hong.
In a previous blog, I explained the importance of being able to consume and understand messages in real time, where it might be required to reach out to external systems and applications in order to fully accomplish a business outcome.
This type of interactions tend to follow a service choreography pattern (as opposed to purely a traditional orchestration), where there is no central micro-management logic that constrains the rules of interactions, but on the contrary, services will freely interact with each other as required by the nature of the messages that are being triggered.
Solace is well known for providing rich and scalable choreography capabilities, while maintaining guaranteed delivery of messages across multiple types of messaging-transport protocols. On the other hand, MuleSoft is specialised in unlocking access to systems and applications, as well as data transformation, across multi-cloud, on-premise and hybrid deployments.
Together, MuleSoft and Solace provide a strong foundation that allows companies to build a digital strategy for real-time Enterprise Event Driven Integrations.
In this blog, I am going to demonstrate how to use the Solace connector for MuleSoft, which simplifies the interactions between multiple event channels to publish and subscribe messages.
The use case that I am going to use is very simple and topical! It’s about generating medical tests results to then be pushed as SMS notification to the end users.
The choreography is as follows:
- MuleSoft “Microservice A” is used to extract data from a Health System, containing patients’ test results.
NB: Depending on the health system, there are multiple ways to achieve this outcome. For example, the health system might invoke REST APIs ad hoc or the MuleSoft microservice could be using some type of inbound connector to subscribe to events into the actual Health System for a more real time focus. For the purpose of this PoC, I am going to use simple REST APIs to be invoked externally with the patients tests records.
- MuleSoft “Microservice A” publishes the test results into a topic via the Solace connector.
- MuleSoft “Microservice B” is subscribed for events with Solace Topic t/patients/tests/results via a Solace connector.
- On the occurrence of events, “Microservice B” integrates into a backend system (e.g. Salesforce) to enrich the incoming patients test data with the patients mobile numbers for example.
- “Microservice B” publishes the enriched messages into a guaranteed delivered queue via the Solace connector.
- MuleSoft “Microservice C” is subscribed for events to Solace Queue q/patients/tests/results/notifications via the Solace connector.
- On the occurrence of events, “Microservice C” pushes the test notifications to patients as SMS notifications.
This is a quick visualization of our proof of concept:
Pre-requisites
In order to complete this exercise, it is expected that you:
- Have access to MuleSoft Anypoint platform account – If not, you can subscribe for free here.
- If you are new to MuleSoft and want to have a full overview first, have a stop here.
- In this blog I am going to use Vagrant VM, it is recommended that you are familiar with it and have it installed on your computer. For more information, see here.
The rest of the article covers the following:
- First, let’s run a Solace Event Broker environment
- Using the Solace Connector for MuleSoft
- Publishing Events to the Event Broker
- Subscribing to Events in Topic
- Publishing Events to a Queue
- Subscribing to our Queue