public class BasicAuthJcsmpSessionService extends SessionService
This class provides a way to connect to a Solace broker and receive messages from a queue. The connection is established using basic authentication.
DEFAULT_VPN_NAME| Constructor and Description |
|---|
BasicAuthJcsmpSessionService(java.lang.String queueName,
java.lang.String host,
java.lang.String username,
java.lang.String password,
java.lang.String vpnName)
Creates a new
BasicAuthJcsmpSessionService with the given parameters. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Gracefully closes the connection to the service.
|
void |
connect()
Establishes a connection to the service.
|
MessageReceiver |
createReceiver()
Creates a MessageReceiver object for receiving messages from Solace.
|
JCSMPProperties |
initializeSessionProperties(JCSMPProperties baseProps)
Override this method and provide your specific properties, including all those related to
authentication, and possibly others too.
|
boolean |
isClosed()
Checks whether the connection to the service is currently closed.
|
initializeWriteSessionPropertiespublic BasicAuthJcsmpSessionService(java.lang.String queueName,
java.lang.String host,
java.lang.String username,
java.lang.String password,
java.lang.String vpnName)
BasicAuthJcsmpSessionService with the given parameters.queueName - The name of the queue to receive messages from.host - The host name or IP address of the Solace broker. Format: Host[:Port]username - The username to use for authentication.password - The password to use for authentication.vpnName - The name of the VPN to connect to.public void connect()
SessionServiceconnect in class SessionServicepublic void close()
SessionServiceclose in class SessionServicepublic MessageReceiver createReceiver()
SessionServicecreateReceiver in class SessionServicepublic boolean isClosed()
SessionServiceisClosed in class SessionServicepublic JCSMPProperties initializeSessionProperties(JCSMPProperties baseProps)
SessionServiceYou should add your properties to the parameter baseProperties, and return the result.
The method will be used whenever the session needs to be created or refreshed. If you are setting credentials with expiration, just make sure that the latest available credentials (e.g. renewed token) are set when the method is called.
For a list of all the properties that can be set, please check the following link:
initializeSessionProperties in class SessionService