Skip to content

For looking up Solace services manifests from an application's environment

License

Notifications You must be signed in to change notification settings

SolaceProducts/solace-services-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build

Solace Services Info

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.

Contents


Overview

The Models

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.

Solace PubSub+ Service Credentials Loader

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:

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.

Manifest Load Order and Expected Formats

The credentials loader for Solace PubSub+ services works in two phases:

  1. Fetch the raw JSON manifest from the application's environment as per a predefined lookup order.
  2. Marshal the raw JSON manifest into one or more SolaceServiceCredentials.

The order in which the loader searches its environment is currently defined as follows:

  1. SOLCAP_SERVICES as a JVM property which directly contains the manifest itself.
  2. SOLCAP_SERVICES as an OS environment which directly contains the manifest itself.
  3. SOLACE_SERVICES_HOME as a JVM property that specifies a path to a directory containing a .solaceservices file.
  4. SOLACE_SERVICES_HOME as an OS environment that specifies a path to a directory containing a .solaceservices file.
  5. 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"
  1. An ID in the credentials
  2. The service's meta-name
  3. {VPN-name}@{active-management-hostname}
Link
Array of Service Credentials An array-type root node
  1. An ID in the credentials
  2. {VPN-name}@{active-management-hostname}
Link
Service Credentials for a Single Service Default
  1. An ID in the credentials
  2. {VPN-name}@{active-management-hostname}
Link

Using it in your Application

The releases from this project are hosted in Maven Central.

Using it with Gradle

// Solace Services Info
compile("com.solace.cloud.core:solace-services-info:0.4.+")

Using it with Maven

<!-- Solace Services Info -->
<dependency>
  <groupId>com.solace.cloud.core</groupId>
  <artifactId>solace-services-info</artifactId>
  <version>0.4.+</version>
</dependency>

Checking out and Building

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.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Release Notes and Versioning

This project uses SemVer for versioning. For the versions available and corresponding release notes, see the Releases in this repository.

Authors

See the list of contributors who participated in this project.

License

This project is licensed under the Apache License, Version 2.0. - See the LICENSE file for details.

Resources

For more information about Solace technology in general please visit these resources:

About

For looking up Solace services manifests from an application's environment

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages