Hello and welcome! If you've never interacted with a Solace event broker before, you're in the right place. In this introductory CodeLab, you'll learn how to:
In order to complete this CodeLab, you will need to get access to a Solace PubSub+ event broker.
At minimum, you will need to have internet access and a browser to use Solace PubSub+ Cloud.
To run the software broker, you'll need to have Docker, VirtualBox, VMWare Player, or another similar technology available to you. More details in the next step.
Let's get access to a Solace PubSub+ event broker!
Super easy, with no setup or hardware or anything required. Solace as a Service! Point your browser to console.solace.cloud to sign up for a free account.
Enter your specifics, and get signed up for an account.
Once you are logged in, you should see something like this:
Click on "Cluster Manager" to go into where you create and manage your broker services. Then click the big "+" Plus button to create a new Service. Ensure you have selected Developer Service, choose a cloud provider you'd like to host the broker, and then click the map to find a region close to you:
Give your Solace PubSub+ Cloud service instance a name, and then tell it to start! Under the covers, a Solace event broker will be deployed and configured in the cloud you indicated, ports configured, load-balancer setup, monitoring enabled, etc. It takes about 5 minutes, and then you'll be ready!
There are multiple options on how to install/download/configure/run the PubSub+ broker:
docker run -d -p 8080:8080 -p 55555:55555 -p:8008:8008 -p:1883:1883 -p:8000:8000 -p:5672:5672 -p:9000:9000 -p:2222:2222 --shm-size=2g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --name=solace solace/solace-pubsub-standard
Ok, now that we (are pretty sure we) have a Solace broker up and running, let's log in to it!
Once your service is deployed and ready, simply click on it to go into it and look at some basic configuration information:
Notice some of the buttons across the top:
If you've installed Solace on your local host (laptop or whatever), point your browser to http://localhost:8080. Or whatever IP address where it's running. Just remember to use port 8080 for the managment access. You should see a login screen like:
Login with credentials
admin. Once connected, you should presented with a screen to choose which Message VPN to use. You will only have one, the "default" VPN:
Click on that box!
Welcome to the Solace event broker management GUI! From this webapp, you'll be able to view configured and runtime information, create new queues, create usernames and profiles, and other various administrative tasks for the Solace broker.
On the left side of the screen are the main sections to navigate through:
On the left menu, click the Try Me! button to load the two WebSocket test apps: a Publisher (left) and a Subscriber (right).
Choose, "Solace Web Messaging" and copy the username, password, and port for Secure
wss. Back on the Try Me! tab, click the little right-arrow
> next to the "Connect" button to open the dropdown list, and enter your connection information (make sure you use the correct port number).
Once you are connected, hit the "Subscribe" button on the right to add a single topic subscription to the Subscriber application (currently
try-me topic). On the left side, try Publishing some messages and ensure they go through.
Try changing the topic and see what happens. Try unsubscribing and see what happens. When using Direct messaging, subscribing clients must be online (and subscribed) in order to receive published messages.
Solace supports a hierarchical topic structure, which mean you can be very descriptive in defining your topic... use it to describe the contents/intent of your message payload data. No need to use flat, coarse-grained topic labels like other brokers. Check out this documenation and this video for more information:
Each and every message can be published to a unique topic, depending on the event metadata. Some examples of valid Solace topics are:
Because published topics can be so variable and dynamic, subscribers can use wildcards to match a single subscription to multiple published topics. Solace supports two different types of wildcards:
*Single-level wildcard, 0-or-more chars, matches up to the next level
abc*, but not a suffix.
>Multi-level wildcard, matches one-or-more levels.
Some examples of Solace topic subscriptions, and topics that they match:
You can read more about topic wildcard subscriptions here.
To use Solace's Guaranteed delivery (aka persistent messaging) so that no messages can be lost, even during network disconnects or broker restarts, then we need a queue endpoint to hold onto the messages for the consumer while it might be offline.
On the left side of the Manager GUI, click on "Queues":
Click the "+ Queue" to create a new queue:
Give the queue a name, and hit "Create":
Optionally configure some settings (e.g. max quota), but you can leave everything as-is for now. Hit "Apply":
You have a new queue! 🎉
Now, Solace supports publishing directly to a queue, and many legacy point-to-point style applications still do this. But there are massive architectural benefits to using the Publish-Subscribe or pub/sub pattern. And for this, we will need to add a topic subscription to the queue, so it attracts messages with matching topics (just like the test WebSocket app was doing).
Click on the queue to go into its details:
Click on the "Subscriptions" tab on the top row:
Click on the "+ Subscription" to add a new subscription(s):
Enter a new topic subscription, feel free to use wildcards:
Add another one if you wish, queues can have multiple subscriptions:
Click "Create" and that's it... your queue now has topic subscriptions to attract messages published on matching topics!
Now that a queue is created for the consumer, we can test it out with the Try Me! test apps again. On the Try Me! tab, on right right side Subscriber, click the "Bind to endpoint to receive guaranteed messages" button:
Enter the name of your queue, and hit "Start Consume":
This will bind the Subscriber application to the queue, and any data that the queue receives will be send to the application.
Now you're ready to publish. On the Publisher side, change the topic to something that will match the (wildcarded?) subscription you added to the queue. Ensure that you have changed the "Delivery Mode" (aka quality of service) to Persistent:
Hit "Publish" and make sure your messages appear on the other side.
Now try disconnecting the Subscriber application, and publish a few more messages. Reconnect the subscriber and rebind to the queue and observe what happens.
For more information on Guaranteed messaging and queues, please refer to these links:
This will be left as an exercise to the reader. Once you turn it on, navigate back to the "Queues" tab, select your queue, and see what "Actions" you can find to perform.
Back on the Try Me! tab, even though the Subscriber has consumed and ACKnowledged all its Guaranteed messages, you can use Repaly to send the messages to it again. But recall: Solace does not use replay for recovery... if a subscriber application crashes after receiving a message but hasn't ACKnowledged it, the broker will resend the message when the subscriber reconnects.
For more information about Replay and/or acknowledging messages, check the following links:
This CodeLab has shown the very basics of application messaging using publish-subscribe and the Solace event broker. For next steps, please consider one of these other CodeLab tutorials:
Thank you for your time. Please come find us on Solace Community to ask any questions!