Configuring Connection Details
SolacePubSub+ Connection Details
The Spring Cloud Stream Binder for PubSub+ uses Spring Boot Auto-Configuration for the Solace Java API to configure its session. In the application.yml
, this typically is configured as follows:
solace: java: host: tcp://localhost:55555 msg-vpn: default client-username: default client-password: default
For more information and options to configure the PubSub+ session, see Spring Boot Auto-Configuration for the Solace Java API.
Preventing Message Loss when Publishing to Topic-to-Queue Mappings
If the connector is publishing to a topic that is subscribed to by a queue, messages may be lost if they are rejected. For example, if the queue ingress is shutdown.
To prevent message loss, configure the reject-msg-to-sender-on-discard with the including-when-shutdown flag.
Azure Service Bus Connection Details
Spring Cloud Azure for the Azure Service Bus supports various methods for authentication to ensure secure and flexible integration options. The following approaches are the most commonly used methods to authenticate with Azure Service Bus within your Spring application.
The configuration steps for each method require you to replace placeholders (for example, ${SERVICEBUS_NAMESPACE_CONNECTION_STRING}
, ${AZURE_CLIENT_ID}
, and so on) with actual values from your Azure environment.
Connection String Authentication
This method utilizes a connection string obtained from the Azure portal for the Azure Service Bus namespace:
spring: cloud: azure: servicebus: connection-string: ${SERVICEBUS_NAMESPACE_CONNECTION_STRING}
Service Principal with Client Secret
This method uses a Microsoft Entra ID service principal with a client secret:
spring: cloud: azure: credential: client-id: ${AZURE_CLIENT_ID} client-secret: ${AZURE_CLIENT_SECRET} profile: tenant-id: ${TENANT_ID} subscription-id: ${AZURE_SUBSCRIPTION_ID} # Optional, only if resource provisioning is needed servicebus: namespace: ${SERVICEBUS_NAMESPACE}
When using a service principal, ensure that your application has the necessary permissions to access the Azure Service Bus resources . This might involve configuring Microsoft Entra ID roles and permissions accordingly.
For more information on the supported authentication methods for Spring Cloud Azure, see Spring Cloud Azure Authentication.
Connecting to Multiple Systems
To connect to multiple systems of a same type, use the multiple binder syntax.
For example:
spring: cloud: stream: binders: # 1st solace binder in this example solace1: type: solace environment: solace: java: host: tcp://localhost:55555 # 2nd solace binder in this example solace2: type: solace environment: solace: java: host: tcp://other-host:55555 # The only servicebus binder servicebus1: type: servicebus # Add `environment` property map here if you need to customize this binder. # But for this example, we'll assume that defaults are used. # Required for internal use undefined: type: undefined bindings: input-0: destination: <input-destination> binder: servicebus1 output-0: destination: <output-destination> binder: solace1 # Reference 1st solace binder input-1: destination: <input-destination> binder: servicebus1 output-1: destination: <output-destination> binder: solace2 # Reference 2nd solace binder
The configuration above defines two binders of type solace
and one binder of type servicebus
, which are then referenced within the bindings.
Each binder above is configured independently under spring.cloud.stream.binders.<bindername>.environment.
.
-
When connecting to multiple systems, all binder configuration must be specified using the multiple binder syntax for all binders. For example, under the
spring.cloud.stream.binders.<binder-name>.environment
. -
Do not use single-binder configuration (for example,
solace.java.*
at the root of yourapplication.yml
) while using the multiple binder syntax.