What is PubSub+?
PubSub+ is a platform that enables the design, discovery, streaming and full lifecycle management of events across distributed enterprises. It provides all of the tools necessary to support a modern event-driven architecture. The main components of the platform are PubSub+ Event Brokers, PubSub+ Event Portal and PubSub+ Cloud Console.
Solace PubSub+ Platform
The PubSub+ Platform helps enterprises design, deploy, and manage event-driven architectures (EDAs) across hybrid cloud, multi-cloud, and IoT environments, so they can be more integrated and event-driven.
Solace PubSub+ message brokers efficiently move information between all kinds of applications, users and devices, over all kinds of networks.
Solace makes PubSub+ messaging integration available in the following ways:
- Solace PubSub+ Event Broker: Software is easy to deploy in your favorite clouds, containers or any computer in a virtual machine.
- Solace PubSub+ Cloud: It is a managed Messaging Service that taps the power of PubSub+ in minutes, leaving of Operations of your messaging infrastructure to us. In other words, it is use by developers without installing, upgrading or maintain any messaging software.
- Solace PubSub+ Appliance: It route messages entirely in hardware for unparalleled capacity, performance and robustness, with the low TCO of a turnkey appliance.
Now we have the Solace introduction and let us move into the integration of MuleSoft and Solace.
The are 2 Steps to integrate the solace with Mule.
- Config Solace (To Config Topics and Queues)
- Integrate Mulesoft with Solace
- Config Solace: (To Config Topics and Queues)
Step 1. Navigate to Solace Console (https://console.solace.cloud/login) and click on Sign in to login or Sign Up to create an account in solace.
- Sign up : In Sign Up, you need to fill in all details and agree on the terms and conditions, and then click Sign Up which will create your account in Solace.
Note : This is a Trial account for 60 days.
Step 2. Once the login/sign up is completed Successfully, we will open the Cluster Manager from Mission Control.
Step 3. Once the Cluster Manager is open, you need to create a new service, which you can do by clicking on the “+“ icon.
Step 4. There are 2 kinds of Service types.
- Enterprise: Dedicated infrastructure with customizable connections.
- Developer: Dedicated infrastructure with 100 connections.
We will select the service type as Developer.
Step 5. Once we will select the service type, we need to select the cloud, where we have to deploy our service. The following options are available for the cloud to deploy the application.
- AWS (Amazon Web Services)
- Google Cloud
- Microsoft Azure
- Private Cloud
Step 6. Once we selected the Cloud (AWS) for the service type, we need to select the cloud region. All the cloud regions will be represented by green dots. You can select any of the doted region.
Step 7. Once we click on the green dot to select the cloud, AWS Region Lists will be open and we have to select the specific region.
Step 8. Once the region selected, we will go for Service Details.
Next, you can give the name of your service. Below the name of the service
Step 9. After the service Name, there is “Show Advanced Connection options“. We will click on this Option.
Step 10. Advance Options have the Client Port Connections, which can not be modified after the service has been created. And by default, SMF port and other Protocols are disabled.
Click on the drop-down button corresponding to “Solace Messaging“ as below:
Step 11. Enable all the ports for “Solace Messaging“ by checking the check box and will enable the protocols and the default ports for these protocols as below.
Step 12. After that click on the “Start Service“ button, it may take some time while starting service.
Step 13. Once the service got started following screen will appear:
Step 14. Once the service is started Successfully, click on the “Try Me!” tab as shown below:
Step 15. In Try me Tab, you can see Publisher/Subscriber section where you need to give the Topic name.
We will provide the same topic name as service for more clarity. (you can give as per your requirement.)
Step 16. Now, go to the Connect tab as shown below, which just expands the “REST“ part, and copy the user, password, and REST host which we will use while configuring the HTTP request component during implementation.
Step 17. Same as the Rest Part, expanding the solace message as well to copying the user, Password, Message VPN, and SMF Host which will be used to configure the Listener.
Now we are done with the Solace part.
2. Integrate Mulesoft with Solace: Now we will kick-off for integration on MuleSoft.
Step 1. We will create a New Mule Project in Anypoint Studio and add Listener and Requester for publishing to the Topic.
Step 2. For the Listener component, we will create the Listener configuration. As we are creating the default configuration as below :
Protocol : HTTP (Default)
Host : All Interfaces [0.0.0.0] (default)
Port : 8081
Base Path : /solace
Step 3. You have to set the HTTP Requestor Configuration by clicking on the + symbol.
Step 4. You have to set the Connection configuration. The Host and port details you can get from Solace Configuration Step Number 16 mentioned above in the document.
Step 5. After Connection Configuration, we have to configure the Authentication for the same.
We will select the Authentication type as Basic Authentication.
Step 6. The Basic Authentication credentials can fetch from Solace Configuration Step Number 16 mentioned above in the document.
Step 7. The Basic Setting for the request configuration is completed Successfully and now you have to update the Request Method as Post and Path as /testTopic.
The General Configuration for the Requestor is completed Successfully.
Step 8. Once the General Configuration is completed, it means you’re done with the publisher.
Step 9. To kick off the Subscriber configuration, we will search the JMS in mule palette and we will get the following options. And you should select the On New Message Option and add logger to display the Payload.
Step 10. To set the Subscriber Configuration, we will select the Destination as testTopic, Consumer Type is “Topic Consumer” and the Number of Consumer set to 1.
Step 11. Now we will create the Basic Connector Configuration for JMS.
Step 12. Note that the connection type should be Generic Connection as below :
Step 13. Before adding the connection type, we should add the JMS Client Required Libraries. Libraries can be adding either from the local File or Maven Repo. We are going through the Maven Repo for this example.
Step 14. We will click on Add maven Dependency and search for the “sol-jms” in the search box. And select the option as com.solacesystems:sol-jms:10.11.0 <Versions can be update> and click on the finish Button.
Step 15. Once the Dependencies are added, will update the connection factory as Edit Inline as below:
Step 16. Update the Connection Factory JNDI Name : “/jms/cf/default”
Step 17. Select the checkbox Custom JNDI Name Resolver as true.
Step 18. Update the JNDI initial Context Factory and JNDI Provider URL.
Jndi intial context factory: com.solacesystems.jndi.SolJNDIInitialContextFactory
Jndi provider url: smf://<username>:<password>@<smfurl>
Note : smf Username Password and URL can get from Solace Configuration Step Number 17 in this Document.
Example Jndi provider url: smf://solace-cloud-client: email@example.com:55555
Step 19. Now its time to update the Provider Properties as “Edit Inline.”
Step 20. Provider Properties will be update as key Value Pair as below :
Value: username@vpn [which can fetch from Solace Configuration Step Number 17]
Step 21. Finally update the JMS Config Connection Credentials from Solace Configuration Step Number 17.
Step 22. At Last,Update the Logger with the Payload to verify the result.
Finally, the Mulesoft integration with Solace is completed Successfully. And deploy and start the Mulesoft Application.
Step 23. Its time to Hit the request with some payload.
For Example : we have passed the Payload as “Gaurav Sethi”
Step 24. Now Go to the solace Console, where we can see your published message.
Step 25. As we have also subscribed to a topic in our application, so the same message you can see in the logs of the mule application as well.
Conclusion : Using the Article, we have learnt how can we integrate the Solace with Mule and grasp the feature of Solace through Mulesoft.