@ProviderType public final class MessagingServiceClientBuilder extends Object implements LocalServiceConfiguration, CustomServiceConfiguration, DeclarativeServiceConfiguration, TransportProtocolConfiguration, AuthenticationConfiguration
MessagingService instances.| Modifier and Type | Method and Description |
|---|---|
MessagingService |
build()
Creates a PubSub+ messaging service connector based on the provided configuration.
|
MessagingService |
build(String clientName)
Creates a PubSub+ messaging service connector based on the provided configuration to expose the
identity of the application using the provided configuration to fulfill the messaging needs.
|
MessagingServiceClientBuilder |
fromConfigurationProvider(ServiceConfigurationProvider configProvider)
Creates custom source service-access configurations for the broker
|
MessagingServiceClientBuilder |
fromProperties(Properties properties)
Enables property-based configuration.
|
MessagingServiceClientBuilder |
local()
Creates a service configuration for connection to default VPN on a local-hosted broker, using
non-secure TCP port 55555.
|
MessagingServiceClientBuilder |
local(int port)
Creates a service configuration for connection to default VPN on a local-hosted broker, using
given non-secure TCP port.
|
MessagingServiceClientBuilder |
local(String vpnName,
int port)
Creates a service configuration for connection to defined VPN on a local hosted broker, using
given non-secure TCP port.
|
MessagingServiceClientBuilder |
local(String protocol,
String vpnName)
Creates a service configuration for connection to defined VPN on a local-hosted broker, using
given non-secure TCP port.
|
MessagingServiceClientBuilder |
localTLS()
Creates a service configuration for connection to default VPN on a local-hosted broker, using
secure TCP port 55443.
|
MessagingServiceClientBuilder |
localTLS(int port)
Creates a service configuration for connection to default VPN on a local-hosted broker, using
given secure TCP port.
|
MessagingServiceClientBuilder |
localTLS(String vpnName,
int port)
Creates a service configuration for connection to defined VPN on a local-hosted broker, using
given secure TCP port.
|
MessagingServiceClientBuilder |
localTLS(String protocol,
String vpnName)
Creates a service configuration for connection to defined VPN on a local-hosted broker, using protocol
default port.
|
MessagingServiceClientBuilder |
withAuthenticationStrategy(AuthenticationStrategy authenticationProvider)
Enables/overrides the existing authentication strategy using given
AuthenticationStrategy. |
MessagingServiceClientBuilder |
withConnectionRetryStrategy(RetryStrategy strategy)
Configures the connection-retry behavior.
|
MessagingServiceClientBuilder |
withMessageCompression(int compressionFactor)
Configures/enables the message compression factor.
|
MessagingServiceClientBuilder |
withReconnectionRetryStrategy(RetryStrategy strategy)
Configures the reconnection retry behavior.
|
MessagingServiceClientBuilder |
withTransportSecurityStrategy(TransportSecurityStrategy transportLayerSecurityStrategy)
Configures transport-layer security if desired, default is to use plain-text for transport.
|
public MessagingService build() throws PubSubPlusClientException
Since the application identifier is not specified, a random new value per service instance is generated.
This method can be considered to be thread-safe.
PubSubPlusClientException - if the service instance cannot be built due to invalid
properties or invalid configurationpublic MessagingService build(String clientName) throws PubSubPlusClientException
It is important to remember that when client runs in a clustered environment and multiple instances of the client running in parallel usage of static application ID is required.
The default alias is used to retrieve configuration if more then a single configuration set is available.
clientName - the identity of the application connected to the broker, given value
overrides corresponding value when such one set using for example system
properties, env. variables etc. When this value is not specified, then a
random generated value per service instance is used.PubSubPlusClientException - if the service instance cannot be built due to invalid
properties or invalid configurationpublic MessagingServiceClientBuilder withAuthenticationStrategy(AuthenticationStrategy authenticationProvider)
AuthenticationConfigurationAuthenticationStrategy.withAuthenticationStrategy in interface AuthenticationConfigurationauthenticationProvider - the provider to be used for connections to the messaging brokerpublic MessagingServiceClientBuilder withTransportSecurityStrategy(TransportSecurityStrategy transportLayerSecurityStrategy)
TransportProtocolConfigurationwithTransportSecurityStrategy in interface TransportProtocolConfigurationtransportLayerSecurityStrategy - the transport layer strategypublic MessagingServiceClientBuilder withMessageCompression(int compressionFactor)
TransportProtocolConfigurationIn order to use compression, target remote message broker port may need to be changed.
By default port 55003 used for compressed SMF without TLS
By default port 55443 used for compressed SMF over TLS
withMessageCompression in interface TransportProtocolConfigurationcompressionFactor - A compression factor in a valid range of 1-9 controls the ZLIB
compression level. The value 1 gives best speed, 9 gives best
compression. Note: If using compression on a session, the configured
KeepAlive interval should be longer than the maximum time required to
compress the largest message likely ever to be published to prevent
service disconnections.public MessagingServiceClientBuilder withReconnectionRetryStrategy(RetryStrategy strategy)
TransportProtocolConfigurationwithReconnectionRetryStrategy in interface TransportProtocolConfigurationstrategy - the configuration strategypublic MessagingServiceClientBuilder withConnectionRetryStrategy(RetryStrategy strategy)
TransportProtocolConfigurationwithConnectionRetryStrategy in interface TransportProtocolConfigurationstrategy - configuration strategypublic MessagingServiceClientBuilder local()
LocalServiceConfigurationlocal in interface LocalServiceConfigurationpublic MessagingServiceClientBuilder local(int port)
LocalServiceConfigurationlocal in interface LocalServiceConfigurationport - the port to connect topublic MessagingServiceClientBuilder localTLS()
LocalServiceConfigurationlocalTLS in interface LocalServiceConfigurationpublic MessagingServiceClientBuilder localTLS(int port)
LocalServiceConfigurationlocalTLS in interface LocalServiceConfigurationport - the port to connect topublic MessagingServiceClientBuilder localTLS(String vpnName, int port)
LocalServiceConfigurationlocalTLS in interface LocalServiceConfigurationvpnName - the name of the Message VPN to attempt to join when connecting to the applianceport - the port to connect topublic MessagingServiceClientBuilder localTLS(String protocol, String vpnName)
LocalServiceConfigurationlocalTLS in interface LocalServiceConfigurationprotocol - the protocol to connect to, valid values are "tcp" and "ws"vpnName - the name of the Message VPN to attempt to join when connecting to the appliancepublic MessagingServiceClientBuilder local(String vpnName, int port)
LocalServiceConfigurationlocal in interface LocalServiceConfigurationvpnName - the name of the Message VPN to attempt to join when connecting to the applianceport - the port to connect topublic MessagingServiceClientBuilder local(String protocol, String vpnName)
LocalServiceConfigurationlocal in interface LocalServiceConfigurationprotocol - the protocol to connect to, valid values are "tcp" and "ws"vpnName - the name of the Message VPN to attempt to join when connecting to the appliancepublic MessagingServiceClientBuilder fromProperties(Properties properties)
fromProperties in interface DeclarativeServiceConfigurationfromProperties in interface PropertyBasedConfigurationproperties - the properties (key of type String and value of type String)
for configuration and fine-tuning. Common properties can be found in SolaceProperties and its sub-interfaces. Refer the SolaceProperties.ServiceProperties, SolaceProperties.AuthenticationProperties, SolaceProperties.TransportLayerProperties, SolaceProperties.TransportLayerSecurityProperties and
SolaceProperties.ClientProperties for the list of MessagingService properties
configurable through this MessagingServiceClientBuilderIllegalArgumentException - if invalid properties were specifiedpublic MessagingServiceClientBuilder fromConfigurationProvider(ServiceConfigurationProvider configProvider)
CustomServiceConfigurationfromConfigurationProvider in interface CustomServiceConfigurationconfigProvider - customizable configuration providerCopyright 2019-2025 Solace Corporation. All rights reserved.