public abstract 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.
Modifier and Type | Class and Description |
---|---|
static class |
BasicAuthJcsmpSessionService.Builder |
DEFAULT_VPN_NAME
Constructor and Description |
---|
BasicAuthJcsmpSessionService() |
Modifier and Type | Method and Description |
---|---|
static BasicAuthJcsmpSessionService.Builder |
builder() |
void |
close()
Gracefully closes the connection to the service.
|
void |
connect()
Establishes a connection to the service.
|
MessageProducer |
getInitializedProducer(SolaceIO.SubmissionMode submissionMode)
Returns a MessageProducer object for publishing messages to Solace.
|
java.util.Queue<Solace.PublishResult> |
getPublishedResultsQueue()
Returns the
Queue instance associated with this session, with the
asynchronously received callbacks from Solace for message publications. |
MessageReceiver |
getReceiver()
Returns a MessageReceiver object for receiving messages from Solace.
|
abstract java.lang.String |
host()
The host name or IP address of the Solace broker.
|
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.
|
abstract java.lang.String |
password()
The password to use for authentication.
|
abstract java.lang.String |
queueName()
The name of the queue to receive messages from.
|
abstract java.lang.String |
username()
The username to use for authentication.
|
abstract java.lang.String |
vpnName()
The name of the VPN to connect to.
|
equals, hashCode, initializeWriteSessionProperties
@Nullable public abstract java.lang.String queueName()
public abstract java.lang.String host()
public abstract java.lang.String username()
public abstract java.lang.String password()
public abstract java.lang.String vpnName()
public static BasicAuthJcsmpSessionService.Builder builder()
public void connect()
SessionService
connect
in class SessionService
public void close()
SessionService
close
in class SessionService
public MessageReceiver getReceiver()
SessionService
getReceiver
in class SessionService
public MessageProducer getInitializedProducer(SolaceIO.SubmissionMode submissionMode)
SessionService
getInitializedProducer
in class SessionService
public java.util.Queue<Solace.PublishResult> getPublishedResultsQueue()
SessionService
Queue
instance associated with this session, with the
asynchronously received callbacks from Solace for message publications. The queue
implementation has to be thread-safe for production use-cases.getPublishedResultsQueue
in class SessionService
public boolean isClosed()
SessionService
isClosed
in class SessionService
public JCSMPProperties initializeSessionProperties(JCSMPProperties baseProps)
SessionService
You 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