This project demonstrates how to use the Solace PubSub+ event broker in a .NET 8+ ASP.NET Core application. It includes:
- A topic subscriber (
SolaceSubscriberService) for direct messaging - A queue subscriber (
SolaceQueueSubscriberService) for guaranteed messaging
- .NET 8 SDK or later
- Docker
- Solace PubSub+ Docker image (used locally)
Start a local Solace broker using Docker (Mac):
docker run -d --name=solace \
-p 8080:8080 -p 55554:55555 -p 8008:8008 -p 1883:1883 -p 5672:5672 -p 9000:9000 \
-e username_admin_globalaccesslevel=admin \
-e username_admin_password=admin \
--shm-size=1g \
solace/solace-pubsub-standardFor Windows update the port as -p 55555:55555.
Access the Solace Admin UI at http://localhost:8080
Default credentials: admin / admin
Use the default Message VPN.
dotnet runThis will:
- Subscribe to
tryme/topicandtryme2/topic(direct messages) - Bind to a queue named
demo.queuefor guaranteed messages
Note: Ensure
demo.queueexists in Solace UI and has topic subscriptions (e.g.,demo/topic).
- Go to the Try Me tab in the Solace Admin UI
- Use the Publisher to send messages to:
tryme/topictryme2/topicdemo/topic(if mapped todemo.queue)
Messages will appear in the terminal as they're received.
SolaceSubscriberService.cs— listens to multiple topicsSolaceQueueSubscriberService.cs— binds to a queue and acknowledges messagesProgram.cs— registers both services in a hosted ASP.NET Core app
- This demo uses direct messaging for topics and client-acknowledged flows for queues.
- Make sure to acknowledge queue messages properly, or they will be redelivered.