Solace PubSub+ Messaging API for Go
This repository contains sample code to showcase how the Solace PubSub+ Go API could be used. You can find:
/patterns
--> runnable code showcasing different message exchange patters with the PubSub+ Go API./howtos
--> code snippets showcasing how to use different features of the API. All howtos are namedhow_to_*.go
with some sampler files under sub-folders.
Environment Setup
- Install the latest supported version of Go from https://go.dev/doc/install. Currently, the samples are run and tested against Go v1.17.
- Install the Solace PubSub+ Messaging API for Go into the root of this directory. This is done by either:
- run
go get solace.dev/go/messaging
- Downloading the API archive from the Solace Community
- Clone the source code into the root of this repo
- run
Run Patterns
- [Skip if existing] Initialize the directory with Go modules
go mod init SolaceSamples.com/PubSub+Go
. - [For local development] Modify the go.mod file to replace
solace.dev/go/messaging
with the local version of./pubsubplus-go-client
by adding the following line in your go.mod filewherereplace solace.dev/go/messaging vX.Y.Z => ./pubsubplus-go-client
X.Y.Z
refer to the version of the API being used. - [For local development] Unzip the contents of the PubSub+ Go API tar folder into a
pubsubplus-go-client
folder in this directory. - Run the samples. There are two way to run the samples:
- Note on environment variables: you can pass the hostname, VPN name, username, and password as environment variables before running the samples as follows:
SOLACE_HOST=<host_name> SOLACE_VPN=<vpn_name> SOLACE_USERNAME=<username> SOLACE_PASSWORD=<password> go run <name_of_sample>.go
Howtos
This directory contains code that showcases different features of the API
Supported Environments
Monitor the Solace Community for updates on supported environments. As of version 1.0.0, the following environments are supported:
- macOS 64 bit (no support for M1 chip yet)
- Linux with glibc (no support for Alpine)
- Windows under WSL
- Any Alpine support with GLIBC
Resources
- Solace Developer Portal is at solace.dev.
- Ask the Solace Community for further discussions and questions.
- Solace PubSub+ Messaging API for Go documentation