@ProviderType public interface JCSMPSession extends Session
JCSMPSession
provides these major
functions:
A client application uses JCSMPFactory
to acquire a
JCSMPSession
instance by providing JCSMPProperties
.
Note: All methods defined in JCSMPSession
are
thread-safe.
JCSMPSession
can be connected as a side effect of requesting a producer or consumer, or
it can be explicitly connected by using the JCSMPSession.connect()
method. As best practice, it is recommended to always use explicit connect.
JCSMPSession
.
Refer to Subscription
and Topic
for detailed
information on subscriptions and subscription filters.
XMLMessageProducer
from the JCSMPSession
. The
application can publish documents in either synchronous publishing mode or
asynchronous publishing mode (also called streaming publishing). In
synchronous publishing mode, the application is blocked on send operations
until an acknowledgement is received from the appliance. In streaming publishing
mode, send operations do not block and wait for a reply. The application gets
a response (when applicable) through a callback mechanism. To use streaming
publishing mode, an application needs to provide a
JCSMPStreamingPublishEventHandler
instance to the
XMLMessageProducer
when acquiring it.
Refer to XMLMessageProducer
for information on how to publish in
synchronous or asynchronous modes, and on the use of producer-independent
messages.
XMLMessageConsumer
instance from the JCSMPSession
. The application can select to
receive XML documents in either synchronous delivery or asynchronous delivery
mode. In synchronous delivery mode, the application is blocked on the receive
operation until a message is available. In asynchronous delivery mode,
messages (and errors) are delivered to the application asynchronously. To
work in asynchronous mode, an application must provide an
XMLMessageListener
instance to XMLMessageConsumer
when
acquiring it.
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_IGNORE_ALREADY_EXISTS |
static int |
FLAG_IGNORE_DOES_NOT_EXIST |
static int |
WAIT_FOR_CONFIRM
If set, operations wait for a confirmation from the appliance before
returning to the application.
|
Modifier and Type | Method and Description |
---|---|
void |
addSubscription(Endpoint endpoint,
Subscription subscription,
int subscribeFlags)
Adds a subscription to an Endpoint on the appliance.
|
void |
addSubscription(Endpoint endpoint,
Subscription subscription,
JCSMPResponseListener handler,
Object key)
Adds a subscription asynchronously to an Endpoint on the appliance.
|
void |
addSubscription(Subscription subscription)
Adds a subscription to the appliance.
|
void |
addSubscription(Subscription subscription,
boolean waitForConfirm)
Adds a subscription to an appliance.
|
void |
addSubscription(Subscription subscription,
JCSMPResponseListener handler,
Object key)
Adds a subscription asynchronously to the appliance.
|
void |
applySubscriptions(Set<Subscription> subscriptions)
Uses the subscription refresh feature to override the subscriptions and
subscription filters associated with a subscriber on the appliance with a
given list of subscriptions.
|
void |
connect()
Connect to the appliance.
|
Browser |
createBrowser(BrowserProperties properties)
Creates a
Browser , which can be used for browsing the contents of a Queue. |
Browser |
createBrowser(BrowserProperties properties,
FlowEventHandler flowEventHandler)
Creates a
Browser , which can be used for browsing the contents of a Queue. |
CacheSession |
createCacheSession(CacheSessionProperties properties)
Creates a CacheSession using the provided CacheSession properties.
|
FlowReceiver |
createFlow(Endpoint endpoint,
Subscription newSubscription,
XMLMessageListener listener)
|
FlowReceiver |
createFlow(XMLMessageListener listener,
ConsumerFlowProperties flowProps)
|
FlowReceiver |
createFlow(XMLMessageListener listener,
ConsumerFlowProperties flowProps,
EndpointProperties endpointProps)
|
FlowReceiver |
createFlow(XMLMessageListener listener,
ConsumerFlowProperties flowProps,
EndpointProperties endpointProps,
FlowEventHandler flowEventHandler)
|
TopicEndpoint |
createNonDurableTopicEndpoint()
Creates a non-durable Topic Endpoint.
|
TopicEndpoint |
createNonDurableTopicEndpoint(String name)
Creates a non-durable Topic Endpoint based on the given name.
|
Requestor |
createRequestor()
Creates a new
Requestor for this Session. |
Queue |
createTemporaryQueue()
Creates a temporary Queue for this Session.
|
Queue |
createTemporaryQueue(String name)
Creates a temporary Queue with the given name.
|
Topic |
createTemporaryTopic()
Creates a temporary Topic for this Session.
|
TransactedSession |
createTransactedSession()
Creates a new
TransactedSession with the connected appliance. |
void |
deprovision(Endpoint endpoint,
long deprovisionFlags)
Deprovisions an Endpoint on the appliance.
|
Object |
getCapability(CapabilityType type)
Gets the value of a capability for the currently connected Session.
|
XMLMessageConsumer |
getMessageConsumer()
Deprecated.
|
XMLMessageConsumer |
getMessageConsumer(JCSMPReconnectEventHandler reconnectHandler)
Deprecated.
|
XMLMessageConsumer |
getMessageConsumer(JCSMPReconnectEventHandler reconnectHandler,
XMLMessageListener listener)
Get a default
XMLMessageConsumer with a reconnect event
handler. |
XMLMessageConsumer |
getMessageConsumer(SubscriptionStateProvider subscriptionStateProvider)
Deprecated.
|
XMLMessageConsumer |
getMessageConsumer(SubscriptionStateProvider subscriptionStateProvider,
JCSMPReconnectEventHandler reconnectHandler)
|
XMLMessageConsumer |
getMessageConsumer(SubscriptionStateProvider subscriptionStateProvider,
JCSMPReconnectEventHandler reconnectHandler,
XMLMessageListener listener)
Deprecated.
Subscriptions out-of-sync checking is no longer supported.
This method will be removed in a future version.
|
XMLMessageConsumer |
getMessageConsumer(SubscriptionStateProvider subscriptionStateProvider,
XMLMessageListener listener)
Deprecated.
Subscriptions out-of-sync checking is no longer supported.
This method will be removed in a future version.
|
XMLMessageConsumer |
getMessageConsumer(XMLMessageListener listener)
Get a default
XMLMessageConsumer . |
XMLMessageProducer |
getMessageProducer()
Deprecated.
Please see
JCSMPSession.getMessageProducer(JCSMPStreamingPublishEventHandler) .
Note that using this deprecated method can introduce a performance
penalty during a streaming publishing Session because it forces the appliance to
transmit acknowledgements to every message. Using the recommended
JCSMPSession.getMessageProducer(JCSMPStreamingPublishEventHandler) form
eliminates this problem. |
XMLMessageProducer |
getMessageProducer(JCSMPStreamingPublishEventHandler callback)
Get an instance of
XMLMessageProducer . |
XMLMessageProducer |
getMessageProducer(JCSMPStreamingPublishEventHandler streamCallback,
JCSMPProducerEventHandler eventCallback)
Get an instance of
XMLMessageProducer . |
Object |
getProperty(String property)
Gets a Session property.
|
Set<Subscription> |
getSubscriptionCache()
Gets an unmodifiable view of the Session's subscription cache.
|
boolean |
isCapable(CapabilityType ctype)
Checks if the specified capability is set on the currently connected
Session.
|
void |
logFlowInfo(JCSMPLogLevel level)
Outputs a log at the specified log level that contains the flow state
information for flows in this Session.
|
void |
provision(Endpoint endpoint,
EndpointProperties props,
long provisionFlags)
Provisions an Endpoint on the appliance.
|
void |
removeSubscription(Endpoint endpoint,
Subscription subscription,
int unsubscribeFlags)
Removes a subscription from an Endpoint on the appliance.
|
void |
removeSubscription(Endpoint endpoint,
Subscription subscription,
JCSMPResponseListener handler,
Object key)
Removes a subscription asynchronously from an Endpoint on the appliance.
|
void |
removeSubscription(Subscription subscription)
Removes a subscription from the appliance.
|
void |
removeSubscription(Subscription subscription,
boolean waitForConfirm)
Removes a subscription from the appliance.
|
void |
removeSubscription(Subscription subscription,
JCSMPResponseListener handler,
Object key)
Removes a subscription asynchronously from the appliance.
|
void |
setProperty(String property,
Object value)
Sets a modifiable Session property once the Session has been constructed.
|
void |
unsubscribeDurableTopicEndpoint(DurableTopicEndpoint endpoint)
Unsubscribe from the durable Topic Endpoint.
|
addSubscriber, clearSubscriber, closeSession, getSessionName, getSessionStats, logSessionStats, removeSubscriber
static final int FLAG_IGNORE_ALREADY_EXISTS
static final int FLAG_IGNORE_DOES_NOT_EXIST
static final int WAIT_FOR_CONFIRM
void addSubscription(Subscription subscription) throws JCSMPException
JCSMPSession.addSubscription(Subscription, boolean)
subscription
- The subscription to add.IllegalArgumentException
- if a provided destination is invalid in the current Session
mode.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void addSubscription(Subscription subscription, boolean waitForConfirm) throws JCSMPException
This method is used to add a subscription in either a blocking or non-blocking mode.
Setting waitForConfirm
to false
prevents the API from waiting for a response before returning. In this
mode, a response is only sent by the appliance if the subscription is
rejected, and such a response is delivered to the
session event handler
. It is invalid to set waitForConfirm
to false
on a Session where no Session event handler is set,
and such an operation throws OperationNotSupportedException
.
waitForConfirm
is false the application will
never receive a positive confirmation, only errors are sent by callback.
When waitForConfirm
is true, this method does not return until the
appliance has responded to the subscription operation, it throws on error and otherwise
returns to indicate the subscription operation was successful.
Note:There is a useful interaction between JCSMPSession.WAIT_FOR_CONFIRM
and
JCSMPProperties.REAPPLY_SUBSCRIPTIONS
. If the application chooses to
wait for confirmation, if the subscription operation is unsuccessful then the
subscription is removed from the cache of subscriptions to reapply and will therefore
not be attempted again on a session reconnect. If the applications chooses not to
wait for confirmation, even if the subscription operation fails, the subscription remains
in the cache of subscriptions to reapply and may be successfully reapplied on a session reconnect.
subscription
- The subscription to add.waitForConfirm
- Whether to request, and wait for, a response from the appliance
before returning.IllegalArgumentException
- If a provided destination is invalid in the current Session
mode.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void removeSubscription(Subscription subscription) throws JCSMPException
subscription
- The subscription to remove.IllegalArgumentException
- If a provided subscription is invalid in the current Session
mode.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void removeSubscription(Subscription subscription, boolean waitForConfirm) throws JCSMPException
Setting waitForConfirm
to
false
prevents the API from waiting for a response before
returning. In this mode, the appliance only sends a response if the
subscription is rejected, and such a response is delivered to the
session event handler
. It is invalid to set waitForConfirm
to false
on a Session where no Session event handler is set;
such an operation throws OperationNotSupportedException
.
subscription
- The subscription to remove.waitForConfirm
- Whether to request, and wait for, a response from the appliance
before returning.IllegalArgumentException
- If a provided subscription is invalid in the current Session
mode.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void addSubscription(Endpoint endpoint, Subscription subscription, int subscribeFlags) throws JCSMPException
Queue
or a ClientName
.
Queue
Endpoint can be used.Topic
subscription can be used.ClientName
Endpoint can be used.Topic
subscription can be used.JCSMPSession.WAIT_FOR_CONFIRM
is specified, the API waits
for a response before returning, otherwise the API returns immediately
after sending the update to the appliance. If JCSMPSession.WAIT_FOR_CONFIRM
is
not specified, negative responses are delivered to the
session event handler
. On a Session where no Session event handler is
set, an OperationNotSupportedException
is thrown if
JCSMPSession.WAIT_FOR_CONFIRM
is not specified.
JCSMPProperties.REAPPLY_SUBSCRIPTIONS
will only apply direct
topic subscriptions unpon a Session reconnect. It will not reapply
topic subscriptions on durable and non-durable endpoints.
endpoint
- The Endpoint to add the subscription on. If null, behaves like
JCSMPSession.addSubscription(Subscription, boolean)
.subscription
- The subscription to add.subscribeFlags
- The valid flag is JCSMPSession.WAIT_FOR_CONFIRM
IllegalArgumentException
- If the provided Endpoint or subscription is invalid.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPErrorResponseSubcodeEx.SUBSCRIPTION_INVALID
JCSMPErrorResponseSubcodeEx.SUBSCRIPTION_ALREADY_PRESENT
JCSMPErrorResponseSubcodeEx.SUBSCRIPTION_TOO_MANY
JCSMPErrorResponseSubcodeEx.OUT_OF_RESOURCES
JCSMPErrorResponseSubcodeEx.SUBSCRIPTION_ACL_DENIED
JCSMPErrorResponseSubcodeEx.UNKNOWN_QUEUE_NAME
JCSMPErrorResponseSubcodeEx.UNKNOWN_CLIENT_NAME
JCSMPErrorResponseSubcodeEx.SUBSCRIPTION_MANAGER_DENIED
OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void removeSubscription(Endpoint endpoint, Subscription subscription, int unsubscribeFlags) throws JCSMPException
JCSMPSession.addSubscription(Endpoint, Subscription, int)
method.
Refer to that method's documentation for operational parameters.
This method cannot remove subscriptions added through the CLI.endpoint
- The Endpoint to remove the subscription from. If null, behaves
like JCSMPSession.removeSubscription(Subscription, boolean)
.subscription
- The subscription to remove.unsubscribeFlags
- Valid flag is JCSMPSession.WAIT_FOR_CONFIRM
IllegalArgumentException
- If the provided Endpoint or subscription is invalid.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void applySubscriptions(Set<Subscription> subscriptions) throws JCSMPException
The application can call this method at any time to initiate a subscription refresh. Only valid if the Session is operating in non-client mode.
subscriptions
- A Set<Subscription>
of Subscription
objects.IllegalArgumentException
- If a destination is invalid in the current Session mode.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.XMLMessageProducer getMessageProducer(JCSMPStreamingPublishEventHandler callback) throws JCSMPException
XMLMessageProducer
.
NOTE: For a given JCSMPSession
, this method returns a
new XMLMessageProducer
object on each call, closing the
existing producer if it exists.
NOTE: To monitor transport events in publish only applications
it is necessary to create an empty XMLMessageConsumer
.
see JCSMPSession.getMessageConsumer(JCSMPReconnectEventHandler, XMLMessageListener)
.
callback
- A mandatory callback handler to set. By setting a callback handler, any
send
returns immediately without confirming the
successful delivery of the message. Applications receive a
response (when applicable) to the send
asynchronously through the callback.
JCSMPException
- If acquiring the message producer failed.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPErrorResponseException
- If the operation fails with an error response, see
JCSMPErrorResponseSubcodeEx
for login failures.IllegalArgumentException
- If callback
is not provided and the Session is
operating in client mode.XMLMessageProducer getMessageProducer(JCSMPStreamingPublishEventHandler streamCallback, JCSMPProducerEventHandler eventCallback) throws JCSMPException
XMLMessageProducer
.
NOTE: For a given JCSMPSession
, this method returns a
new XMLMessageProducer
object on each call, closing the
existing producer if it exists.
NOTE: To monitor transport events in publish only applications
it is necessary to create an empty XMLMessageConsumer
.
see JCSMPSession.getMessageConsumer(JCSMPReconnectEventHandler, XMLMessageListener)
.
streamCallback
- A mandatory stream callback handler to set. By setting a callback handler, any
send
returns immediately without confirming the
successful delivery of the message. Applications receive a
response (when applicable) to the send
asynchronously through the callback.
eventCallback
- A producer event handler.JCSMPException
- If acquiring the message producer failed.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPErrorResponseException
- If the operation fails with an error response, see
JCSMPErrorResponseSubcodeEx
for login failures.IllegalArgumentException
- If callback
is not provided and the Session is
operating in client mode.
XMLMessageProducer getMessageProducer() throws JCSMPException
JCSMPSession.getMessageProducer(JCSMPStreamingPublishEventHandler)
.
Note that using this deprecated method can introduce a performance
penalty during a streaming publishing Session because it forces the appliance to
transmit acknowledgements to every message. Using the recommended
JCSMPSession.getMessageProducer(JCSMPStreamingPublishEventHandler)
form
eliminates this problem.JCSMPException
XMLMessageConsumer getMessageConsumer(XMLMessageListener listener) throws JCSMPException
XMLMessageConsumer
. The default XMLMessageConsumer
is used to receive direct messages.
NOTE: For a given JCSMPSession
, this method returns a
new XMLMessageConsumer
object on each call, closing the
existing consumer if it exists.
listener
- Sets the message consumer's message listener. By setting a
message listener, the message consumer works in asynchronous
mode. Setting the message listener to
((XMLMessageListener)null) puts the message consumer in
synchronous delivery mode.JCSMPException
- If acquiring the message consumer failed.JCSMPErrorResponseException
- If the operation fails with an error response, see
JCSMPErrorResponseSubcodeEx
for login failures.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.XMLMessageConsumer getMessageConsumer() throws JCSMPException
JCSMPSession.getMessageConsumer(XMLMessageListener)
.JCSMPException
XMLMessageConsumer getMessageConsumer(JCSMPReconnectEventHandler reconnectHandler, XMLMessageListener listener) throws JCSMPException
XMLMessageConsumer
with a reconnect event
handler. The default XMLMessageConsumer
is used to receive direct messages.
If auto-reconnect is enabled through the subscriber data channel's
reconnectRetries
in JCSMPChannelProperties
, upon
detecting the loss of the connection,
JCSMPReconnectEventHandler.preReconnect()
is called before JCSMP
attempts to reestablish the connection with the appliance. If the method
call returns the value false
, the auto-reconnect process
aborts. If the method call returns the value true
,
auto-reconnect process starts. When the connection is established
successfully, JCSMPReconnectEventHandler.postReconnect()
is
called. To detect a permanent loss of a connection (when retries are
exhausted) the method
XMLMessageListener.onException(JCSMPException)
will be called.
NOTE: For a given JCSMPSession
, this method returns a
new XMLMessageConsumer
object on each call, closing the
existing consumer if it exists.
reconnectHandler
- An implementation of JCSMPReconnectEventHandler
. This
is strongly recommended when operating in client mode, since
topic subscriptions do not persist between connections on the
appliance.listener
- Sets the message consumer's message listener. By setting a
message listener, the message consumer works in asynchronous
mode. Setting the message listener to null
puts
the message consumer in synchronous delivery mode.JCSMPException
- If acquiring the message consumer failed.JCSMPErrorResponseException
- If the operation fails with an error response, see
JCSMPErrorResponseSubcodeEx
for login failures.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.XMLMessageConsumer getMessageConsumer(JCSMPReconnectEventHandler reconnectHandler) throws JCSMPException
JCSMPSession.getMessageConsumer(JCSMPReconnectEventHandler, XMLMessageListener)
.JCSMPException
@Deprecated XMLMessageConsumer getMessageConsumer(SubscriptionStateProvider subscriptionStateProvider, XMLMessageListener listener) throws JCSMPException
XMLMessageConsumer
with subscriptions
out-of-sync checking.
If the subscriptions on the appliance are not in sync with the
SubscriptionState
returned from SubscriptionStateProvider
,
SubscriptionsOutOfSynchException
is raised.
NOTE: For a given JCSMPSession
, this method
returns a new XMLMessageConsumer
object on each call, closing the
existing consumer, if applicable.
subscriptionStateProvider
- An implementation of SubscriptionStateProvider
.listener
- Sets the message consumer's message listener. By setting a
message listener, the message consumer works in asynchronous
mode. Setting the message listener to null
puts the message
consumer in synchronous delivery mode.JCSMPException
- If acquiring the message consumer
failed.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.XMLMessageConsumer getMessageConsumer(SubscriptionStateProvider subscriptionStateProvider) throws JCSMPException
JCSMPSession.getMessageConsumer(SubscriptionStateProvider, XMLMessageListener)
.
JCSMPException
@Deprecated XMLMessageConsumer getMessageConsumer(SubscriptionStateProvider subscriptionStateProvider, JCSMPReconnectEventHandler reconnectHandler, XMLMessageListener listener) throws JCSMPException
XMLMessageConsumer
with subscriptions
out-of-sync checking and reconnect event handler.
If the subscriptions on the appliance are not in sync with the
SubscriptionState
returned from SubscriptionStateProvider
,
SubscriptionsOutOfSynchException
is raised.
If auto-reconnect is enabled through the subscriber data channel's
reconnectRetries
in JCSMPChannelProperties
, when
detecting the loss of the connection,
JCSMPReconnectEventHandler.preReconnect()
is called before JCSMP
attempts to re-establish the connection with the appliance. If the method
call returns the value false, the auto-reconnect process aborts. If the
method call returns the value true, the auto-reconnect process starts.
When the connection is established successfully,
JCSMPReconnectEventHandler.postReconnect()
is called.
NOTE: For a given JCSMPSession
, this method
returns a new XMLMessageConsumer
object on each call,
closing the existing consumer, if applicable.
subscriptionStateProvider
- An implementation of SubscriptionStateProvider
.listener
- Sets the message consumer's message listener. By setting a
message listener, the message consumer works in asynchronous
mode. Setting the message listener to null
puts the message
consumer in synchronous delivery mode.JCSMPException
- If acquiring the message consumer failed.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.@Deprecated XMLMessageConsumer getMessageConsumer(SubscriptionStateProvider subscriptionStateProvider, JCSMPReconnectEventHandler reconnectHandler) throws JCSMPException
JCSMPSession.getMessageConsumer(SubscriptionStateProvider, JCSMPReconnectEventHandler, XMLMessageListener)
.JCSMPException
FlowReceiver createFlow(Endpoint endpoint, Subscription newSubscription, XMLMessageListener listener) throws JCSMPException
FlowReceiver
bound to a appliance Endpoint, such
as a Queue
or TopicEndpoint
. Each time this method is
called, it returns a new FlowReceiver
object.
endpoint
- The appliance Endpoint to bind to.newSubscription
- If binding to a TopicEndpoint the Topic
to set/replace as a topic subscription on the endpoint.
This must be specified for a TopicEndpoint, null otherwise.listener
- (optional) A callback listener to be used for asynchronous
notification. If null
, synchronous notification
is used.FlowReceiver
instance.OperationNotSupportedException
- If the Session configuration does not allow the operation.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPErrorResponseSubcodeEx.CANNOT_BIND_TO_QUEUE
JCSMPErrorResponseSubcodeEx.ENDPOINT_ALREADY_EXISTS
JCSMPErrorResponseSubcodeEx.PERMISSION_NOT_ALLOWED
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_QUEUE
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_TE
JCSMPErrorResponseSubcodeEx.UNKNOWN_QUEUE_NAME
JCSMPErrorResponseSubcodeEx.UNKNOWN_TE_NAME
JCSMPErrorResponseSubcodeEx.QUEUE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.TE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.NO_MORE_NON_DURABLE_QUEUE_OR_TE
JCSMPErrorResponseSubcodeEx.INVALID_TOPIC_NAME_FOR_TE
InvalidOperationException
- If the peer capabilities do not support features requested in
this operation.JCSMPException
- Other error cases.FlowReceiver createFlow(XMLMessageListener listener, ConsumerFlowProperties flowProps) throws JCSMPException
FlowReceiver
bound to an appliance Endpoint, such
as a Queue
or TopicEndpoint
. This method returns a new
FlowReceiver
object each time it is called.
Note: If the flow's message acknowledge mode is
JCSMPProperties.SUPPORTED_MESSAGE_ACK_AUTO
(the default behaviour),
then the call to this method is ignored and a warning log is generated.
listener
- (optional) A callback listener to be used for asynchronous
notification. If null
, synchronous notification
is used.flowProps
- Consumer flow properties, like Guaranteed message window size, Endpoint to
bind to, and so on.FlowReceiver
instance.OperationNotSupportedException
- If the Session configuration does not allow the operation.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPErrorResponseSubcodeEx.CANNOT_BIND_TO_QUEUE
JCSMPErrorResponseSubcodeEx.ENDPOINT_ALREADY_EXISTS
JCSMPErrorResponseSubcodeEx.PERMISSION_NOT_ALLOWED
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_QUEUE
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_TE
JCSMPErrorResponseSubcodeEx.UNKNOWN_QUEUE_NAME
JCSMPErrorResponseSubcodeEx.UNKNOWN_TE_NAME
JCSMPErrorResponseSubcodeEx.QUEUE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.TE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.NO_MORE_NON_DURABLE_QUEUE_OR_TE
JCSMPErrorResponseSubcodeEx.INVALID_TOPIC_NAME_FOR_TE
JCSMPErrorResponseSubcodeEx.SUBSCRIPTION_MATCH_ERROR
JCSMPErrorResponseSubcodeEx.SELECTOR_MATCH_ERROR
JCSMPErrorResponseSubcodeEx.SELECTOR_INVALID
InvalidOperationException
- If the peer capabilities do not support features requested in
this operation.JCSMPException
- Other error cases.FlowReceiver createFlow(XMLMessageListener listener, ConsumerFlowProperties flowProps, EndpointProperties endpointProps) throws JCSMPException
FlowReceiver
bound to an appliance Endpoint, such
as a Queue
or TopicEndpoint
. This method returns a new
FlowReceiver
object each time it is called.
listener
- (optional) A callback listener to be used for asynchronous
notification. If null
, synchronous notification
is used.flowProps
- Consumer flow properties, like Guaranteed message window size, Endpoint to
bind to, and so on.endpointProps
- (optional) Endpoint properties for the created temporary
Endpoint (when binding to a temporary / non-durable Endpoint).
If null
, default Endpoint properties are applied
by the appliance.FlowReceiver
instance.OperationNotSupportedException
- If the Session configuration does not allow the operation.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPErrorResponseSubcodeEx.CANNOT_BIND_TO_QUEUE
JCSMPErrorResponseSubcodeEx.ENDPOINT_ALREADY_EXISTS
JCSMPErrorResponseSubcodeEx.PERMISSION_NOT_ALLOWED
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_QUEUE
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_TE
JCSMPErrorResponseSubcodeEx.UNKNOWN_QUEUE_NAME
JCSMPErrorResponseSubcodeEx.UNKNOWN_TE_NAME
JCSMPErrorResponseSubcodeEx.QUEUE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.TE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.NO_MORE_NON_DURABLE_QUEUE_OR_TE
JCSMPErrorResponseSubcodeEx.INVALID_TOPIC_NAME_FOR_TE
InvalidOperationException
- If the peer capabilities do not support features requested in
this operation.JCSMPException
- Other error cases.FlowReceiver createFlow(XMLMessageListener listener, ConsumerFlowProperties flowProps, EndpointProperties endpointProps, FlowEventHandler flowEventHandler) throws JCSMPException
FlowReceiver
bound to an appliance Endpoint, such
as a Queue
or TopicEndpoint
. This method returns a new
FlowReceiver
object each time it is called.
listener
- (optional) A callback listener to be used for asynchronous
notification. If null
, synchronous notification
is used.flowProps
- Consumer flow properties, like Guaranteed message window size, Endpoint to
bind to, and so on.endpointProps
- (optional) Endpoint properties for the created temporary
Endpoint (when binding to a temporary / non-durable Endpoint).
If null
, default Endpoint properties are applied
by the appliance.flowEventHandler
- (optional) A callback listener registered to a flow to receive
flow active or flow inactive event if active flow indication is set to
true
in the consumer flow properties. See
ConsumerFlowProperties.setActiveFlowIndication(boolean)
.FlowReceiver
instance.OperationNotSupportedException
- If the Session configuration does not allow the operation.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPErrorResponseSubcodeEx.CANNOT_BIND_TO_QUEUE
JCSMPErrorResponseSubcodeEx.ENDPOINT_ALREADY_EXISTS
JCSMPErrorResponseSubcodeEx.PERMISSION_NOT_ALLOWED
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_QUEUE
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_TE
JCSMPErrorResponseSubcodeEx.UNKNOWN_QUEUE_NAME
JCSMPErrorResponseSubcodeEx.UNKNOWN_TE_NAME
JCSMPErrorResponseSubcodeEx.QUEUE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.TE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.NO_MORE_NON_DURABLE_QUEUE_OR_TE
JCSMPErrorResponseSubcodeEx.INVALID_TOPIC_NAME_FOR_TE
InvalidOperationException
- If the peer capabilities do not support features requested in
this operation.InvalidPropertiesException
- If active flow indication is set to true
in the
consumer properties, but flow event handler parameter is set
to null.JCSMPException
- Other error cases.void logFlowInfo(JCSMPLogLevel level)
level
- The level (corresponding to
org.apache.commons.logging
levels) at which to
output the log.void unsubscribeDurableTopicEndpoint(DurableTopicEndpoint endpoint) throws JCSMPException
This method is only valid if the Session is operating in non-client mode.
endpoint
- The durable Topic Endpoint on the appliance to unsubscribe from.JCSMPErrorResponseException
- If the unsubscribe command is rejected. With detailed error
information on error responses from the appliance. Error
response subcodes:
JCSMPException
- On any other error.void setProperty(String property, Object value) throws JCSMPException
Modifiable properties include:
APPLICATION_DESCRIPTION
(in TBRM only)CLIENT_NAME
(in TBRM only)JCSMPProperties.OAUTH2_ACCESS_TOKEN
JCSMPProperties.OIDC_ID_TOKEN
Note: Modifying a Session property while the channel to the appliance is disconnected can cause it to connect and go through the authentication process. Modification of a Session property may or may not occur instantly or may occur during the next session reconnection. Modification of a Session property during ongoing session reconnection may apply to the next session reconnection attempt.
property
- The name of the property to modify.value
- The new value of the property.IllegalArgumentException
- If the specified property cannot be modified in the current
Session mode, or the provided value is invalid.JCSMPTransportException
- If a transport error occurs.JCSMPErrorResponseException
- If the appliance rejects the modification.JCSMPException
- On other errors.Object getProperty(String property)
property
- The requested property name
.null
if it does not exist.CacheSession createCacheSession(CacheSessionProperties properties) throws JCSMPException
properties
- Properties for the CacheSession.JCSMPException
- on errorRequestor createRequestor() throws JCSMPException
Requestor
for this Session. Applications are
responsible for having previously created an
XMLMessageProducer
and XMLMessageConsumer
on
this Session. The XMLMessageConsumer
must be started before
performing a request.Requestor
instance.JCSMPException
- on errorTopicEndpoint createNonDurableTopicEndpoint() throws JCSMPException
connected
to the appliance, as appliance capabilities must be populated to
create non-durable entities.JCSMPException
- on errorTopicEndpoint createNonDurableTopicEndpoint(String name) throws JCSMPException
connected
to the appliance, as appliance capabilities must be populated to
create non-durable entities.name
- The name of the non-durable Topic Endpoint.JCSMPException
- on errorQueue createTemporaryQueue() throws JCSMPException
This operation requires that the Session be previously connected
to the appliance, as appliance capabilities must be populated to
create non-durable entities.
JCSMPException
- on errorQueue createTemporaryQueue(String name) throws JCSMPException
connected
to the appliance, as appliance capabilities must be populated to
create non-durable entities.name
- The name of the temporary Queue.JCSMPException
- on errorTopic createTemporaryTopic() throws JCSMPException
connected
to the appliance, as appliance capabilities must be populated to
create non-durable entities.
The temporary Topic's physical name is fully generated by JCSMP to provide uniqueness.JCSMPException
- on errorObject getCapability(CapabilityType type) throws JCSMPException
The returned value is an object of the type specified in
CapabilityType
.
This operation requires that the Session be previously connected
to the appliance. If the Session is not connected,
requesting a capability will throw InvalidOperationException
.
Otherwise, the last known value reported is returned.
JCSMPException
boolean isCapable(CapabilityType ctype)
IllegalArgumentException
if the
provided key does not allow conversion of the value to
boolean
.
If the Session has never been connected, requesting a capability
returns false
. Otherwise, the last known value is returned.
ctype
- The capability to check.IllegalArgumentException
- If the specified key has a value that cannot be converted to
boolean.void connect() throws JCSMPException
JCSMPSession
can be connected as a side effect of
requesting a producer or consumer, as best practice it is recommended to
always explicitly connect before.
After connect()
returns, the Session is connected to the
appliance. At this point, the appliance's information and capabilities are
populated, and can be queried by JCSMPSession.getCapability(CapabilityType)
.
Some Session operations require the Session to be connected before
attempting them, such as:
JCSMPTransportException
- If a connection exception occurs.JCSMPException
- On other failures.Set<Subscription> getSubscriptionCache()
JCSMPProperties.REAPPLY_SUBSCRIPTIONS
is
disabled.void provision(Endpoint endpoint, EndpointProperties props, long provisionFlags) throws JCSMPException
Allowed flags for the provisioning operation include:
endpoint
- Endpoint to provision.props
- Properties for the provisioned Endpoint.provisionFlags
- Provisioning flags.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPException
- on errorvoid deprovision(Endpoint endpoint, long deprovisionFlags) throws JCSMPException
Allowed flags for the deprovisioning operation include:
endpoint
- The Endpoint to deprovision.deprovisionFlags
- Deprovisioning flags.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPException
- on errorBrowser createBrowser(BrowserProperties properties) throws JCSMPException
Browser
, which can be used for browsing the contents of a Queue.properties
- The Browser properties used for creation.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPErrorResponseSubcodeEx.CANNOT_BIND_TO_QUEUE
JCSMPErrorResponseSubcodeEx.PERMISSION_NOT_ALLOWED
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_QUEUE
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_TE
JCSMPErrorResponseSubcodeEx.UNKNOWN_QUEUE_NAME
JCSMPErrorResponseSubcodeEx.UNKNOWN_TE_NAME
JCSMPErrorResponseSubcodeEx.QUEUE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.TE_SHUTDOWN
JCSMPException
- on other exceptions.Browser createBrowser(BrowserProperties properties, FlowEventHandler flowEventHandler) throws JCSMPException
Browser
, which can be used for browsing the contents of a Queue.properties
- The Browser properties used for creation.flowEventHandler
- (optional) A callback listener registered to a flow to receive
flow active or flow inactive event if active flow indication is set to
true
in the consumer flow properties. See
ConsumerFlowProperties.setActiveFlowIndication(boolean)
.JCSMPErrorResponseException
- With detailed error information on error responses from the
appliance. Error response subcodes:
JCSMPErrorResponseSubcodeEx.CANNOT_BIND_TO_QUEUE
JCSMPErrorResponseSubcodeEx.PERMISSION_NOT_ALLOWED
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_QUEUE
JCSMPErrorResponseSubcodeEx.MAX_CLIENTS_FOR_TE
JCSMPErrorResponseSubcodeEx.UNKNOWN_QUEUE_NAME
JCSMPErrorResponseSubcodeEx.UNKNOWN_TE_NAME
JCSMPErrorResponseSubcodeEx.QUEUE_SHUTDOWN
JCSMPErrorResponseSubcodeEx.TE_SHUTDOWN
JCSMPException
- on other exceptions.TransactedSession createTransactedSession() throws JCSMPException
TransactedSession
with the connected appliance. This
call blocks until the TransactedSession
is successfully
created.TransactedSession
.JCSMPException
- on errorvoid addSubscription(Subscription subscription, JCSMPResponseListener handler, Object key) throws JCSMPException
subscription
- The subscription to add.handler
- The subscription event handlerkey
- The correlation key of the add subscription operationIllegalArgumentException
- if a provided destination is invalid in the current Session
mode.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void addSubscription(Endpoint endpoint, Subscription subscription, JCSMPResponseListener handler, Object key) throws JCSMPException
Queue
or a ClientName
.
Queue
Endpoint can be used.Topic
subscription can be used.ClientName
Endpoint can be used.Topic
subscription can be used.
JCSMPProperties.REAPPLY_SUBSCRIPTIONS
will not reapply
topic subscriptions on durable and non-durable endpoints.
endpoint
- The Endpoint to add the subscription on.subscription
- The subscription to add.handler
- The subscription event handlerkey
- The correlation key of the add subscription operationIllegalArgumentException
- If the provided Endpoint or subscription is invalid.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void removeSubscription(Subscription subscription, JCSMPResponseListener handler, Object key) throws JCSMPException
subscription
- The subscription to remove.handler
- The subscription event handlerkey
- The correlation key of the remove subscription operationIllegalArgumentException
- if a provided destination is invalid in the current Session
mode.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.void removeSubscription(Endpoint endpoint, Subscription subscription, JCSMPResponseListener handler, Object key) throws JCSMPException
endpoint
- The Endpoint to remove the subscription from.subscription
- The subscription to remove.handler
- The subscription event handlerkey
- The correlation key of the remove subscription operationIllegalArgumentException
- If the provided Endpoint or subscription is invalid.OperationNotSupportedException
- If performed on a closed Session or a Session not configured
for this operation.JCSMPException
- On any other error condition.Copyright 2004-2024 Solace Corporation. All rights reserved.