Solace Services Info is a lightweight library which defines the common models used to describe Solace PubSub+ service connections. Packaged within this project is also a utility which non-cloud-platform-deployed applications can use to fetch Solace PubSub+ service credentials.
- Overview
- Manifest Load Order and Expected Formats
- Using it in your Application
- Checking out and Building
- Contributing
- Release Notes & Versioning
- Authors
- License
- Resources
This project contains within it a few models to represent the credentials for Solace PubSub+ services:
- SolaceServiceCredentials
- An interface that represents the general expected contents of the credentials to a Solace PubSub+ service.
- SolaceServiceCredentialsImpl
- A Plain Old Java Object (POJO) implementation of SolaceServiceCredentials.
The Solace PubSub+ Service Credentials Loader is a utility that attempts to standardize the way in which applications can fetch Solace PubSub+ service credentials from its environment.
This project is intended to be used in applications hosted on environments that do not have a standardized means of connecting to external services. For example, an application deployed in Cloud Foundry can use existing Cloud Foundry tools (e.g. User-Provided Services) to connect to external services and would have little value in using this project. Whereas, for example, if it were instead to be ran directly on a Windows or Unix environment, then this project could be used to skip the overhead required to fetch and marshal Solace PubSub+ service credentials.
The primary way of using this loader is through the SolaceCredentialsLoader. For example:
SolaceCredentialsLoader solaceCredentialsLoader = new SolaceCredentialsLoader();
// Gets the map of service ID to credentials for all detected Solace PubSub+ services
Map<String, SolaceServiceCredentials> solaceServicesCredentials = solaceCredentialsLoader.getAllSolaceServiceInfo();
// Gets the credentials for the first detected Solace PubSub+ service
SolaceServiceCredentials solaceServicesCredentials = solaceCredentialsLoader.getSolaceServiceInfo();
The two following projects are real examples that use this as one of the options for fetching service credentials to auto-configure Solace Java/JMS connections:
- Spring Boot Auto-Configuration for the Solace Java API
- Spring Boot Auto-Configuration for the Solace JMS API
Please refer to Manifest Load Order and Expected Formats for more information about the supported manifest formats and the ways in which you can provide it.
The credentials loader for Solace PubSub+ services works in two phases:
- Fetch the raw JSON manifest from the application's environment as per a predefined lookup order.
- Marshal the raw JSON manifest into one or more
SolaceServiceCredentials
.
The order in which the loader searches its environment is currently defined as follows:
SOLCAP_SERVICES
as a JVM property which directly contains the manifest itself.SOLCAP_SERVICES
as an OS environment which directly contains the manifest itself.SOLACE_SERVICES_HOME
as a JVM property that specifies a path to a directory containing a.solaceservices
file.SOLACE_SERVICES_HOME
as an OS environment that specifies a path to a directory containing a.solaceservices
file.- Fallback of searching for a
.solaceservices
file in the user's home directory.
Now to marshal the JSON into SolaceServiceCredentials
objects, the manifest must conform to one of the following formats:
Manifest Format | Manifest Detection Handle | Service ID Resolution Order | Example |
---|---|---|---|
VCAP_SERVICES -Formatted Map of Services |
An object-type root node with key "solace-pubsub" |
|
Link |
Array of Service Credentials | An array-type root node |
|
Link |
Service Credentials for a Single Service | Default |
|
Link |
The releases from this project are hosted in Maven Central.
// Solace Services Info
compile("com.solace.cloud.core:solace-services-info:0.4.+")
<!-- Solace Services Info -->
<dependency>
<groupId>com.solace.cloud.core</groupId>
<artifactId>solace-services-info</artifactId>
<version>0.4.+</version>
</dependency>
This project depends on maven for building. To build the jar locally, check out the project and build from source by doing the following:
git clone https://github.com/SolaceProducts/solace-services-info.git
cd solace-services-info
mvn package
This will build a jar file which will be named similar to the following:
target/solace-services-info-0.5.0-SNAPSHOT.jar
You can install this file in your maven repository locally.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project uses SemVer for versioning. For the versions available and corresponding release notes, see the Releases in this repository.
See the list of contributors who participated in this project.
This project is licensed under the Apache License, Version 2.0. - See the LICENSE file for details.
For more information about Solace technology in general please visit these resources:
- The Solace Developer Portal website at: http://dev.solace.com
- Understanding Solace technology.
- Ask the Solace community.