public interface Subscription
extends java.lang.AutoCloseable
Subscription
object to receive messages that have been published to a
subject.
Each Subscription
object is unique, even if the subscription is to the same subject.
This means that if StreamingConnection.subscribe("foo", cb)
is called twice in a row,
each of the
resulting Subscription
objects will be unique, and any message delivered on subject "foo"
will be delivered individually to both Subscription
objects.
Modifier and Type | Method and Description |
---|---|
void |
close()
Removes this subscriber from the server without removing durable interest (if it exists).
|
void |
close(boolean unsubscribe)
Removes this subscriber from the server.
|
SubscriptionOptions |
getOptions()
Returns the
SubscriptionOptions object for this Subscription object. |
java.lang.String |
getQueue()
Returns the optional queue group name.
|
java.lang.String |
getSubject()
Retrieves the subject of interest from the
Subscription object. |
void |
unsubscribe()
Removes interest in the
Subscription . |
java.lang.String getSubject()
Subscription
object.java.lang.String getQueue()
void unsubscribe() throws java.io.IOException
Subscription
.
For durables, it means that the durable interest is also removed from the server. Restarting a durable with the same name will not resume the subscription, it will be considered a new one.
This call is equivalent to close(true)
java.io.IOException
- if an error occurs while notifying the servervoid close() throws java.io.IOException
This call is equivalent to close(false)
close
in interface java.lang.AutoCloseable
java.io.IOException
- if the close request times out or the client is connected to a server
for which this features is not available.AutoCloseable.close()
void close(boolean unsubscribe) throws java.io.IOException
unsubscribe
- if true
, durable interest is also removed.java.io.IOException
- if the close request times out or the client is connected to a server
for which this features is not available.SubscriptionOptions getOptions()
SubscriptionOptions
object for this Subscription
object.Subscription
's code SubscriptionOptions} object.SubscriptionOptions