@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 fromConfigurationProvider(ServiceConfigurationProvider configProvider)
CustomServiceConfiguration
fromConfigurationProvider
in interface CustomServiceConfiguration
configProvider
- customizable configuration providerpublic MessagingServiceClientBuilder fromProperties(Properties properties)
fromProperties
in interface DeclarativeServiceConfiguration
fromProperties
in interface PropertyBasedConfiguration
properties
- 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 MessagingServiceClientBuilder
IllegalArgumentException
- if invalid properties were specifiedpublic MessagingServiceClientBuilder local()
LocalServiceConfiguration
local
in interface LocalServiceConfiguration
public MessagingServiceClientBuilder local(int port)
LocalServiceConfiguration
local
in interface LocalServiceConfiguration
port
- the port to connect topublic MessagingServiceClientBuilder local(String vpnName, int port)
LocalServiceConfiguration
local
in interface LocalServiceConfiguration
vpnName
- 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)
LocalServiceConfiguration
local
in interface LocalServiceConfiguration
protocol
- 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 localTLS()
LocalServiceConfiguration
localTLS
in interface LocalServiceConfiguration
public MessagingServiceClientBuilder localTLS(int port)
LocalServiceConfiguration
localTLS
in interface LocalServiceConfiguration
port
- the port to connect topublic MessagingServiceClientBuilder localTLS(String vpnName, int port)
LocalServiceConfiguration
localTLS
in interface LocalServiceConfiguration
vpnName
- 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)
LocalServiceConfiguration
localTLS
in interface LocalServiceConfiguration
protocol
- 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 withAuthenticationStrategy(AuthenticationStrategy authenticationProvider)
AuthenticationConfiguration
AuthenticationStrategy
.withAuthenticationStrategy
in interface AuthenticationConfiguration
authenticationProvider
- the provider to be used for connections to the messaging brokerpublic MessagingServiceClientBuilder withConnectionRetryStrategy(RetryStrategy strategy)
TransportProtocolConfiguration
withConnectionRetryStrategy
in interface TransportProtocolConfiguration
strategy
- configuration strategypublic MessagingServiceClientBuilder withMessageCompression(int compressionFactor)
TransportProtocolConfiguration
In 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 TransportProtocolConfiguration
compressionFactor
- 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)
TransportProtocolConfiguration
withReconnectionRetryStrategy
in interface TransportProtocolConfiguration
strategy
- the configuration strategypublic MessagingServiceClientBuilder withTransportSecurityStrategy(TransportSecurityStrategy transportLayerSecurityStrategy)
TransportProtocolConfiguration
withTransportSecurityStrategy
in interface TransportProtocolConfiguration
transportLayerSecurityStrategy
- the transport layer strategyCopyright 2019-2024 Solace Corporation. All rights reserved.