public interface StompSession
Modifier and Type | Interface and Description |
---|---|
static interface |
StompSession.Receiptable
A handle to use to track receipts.
|
static interface |
StompSession.Subscription
A handle to use to unsubscribe or to track a receipt.
|
Modifier and Type | Method and Description |
---|---|
void |
disconnect()
Disconnect the session by sending a DISCONNECT frame.
|
String |
getSessionId()
Return the id for the session.
|
boolean |
isConnected()
Whether the session is connected.
|
StompSession.Receiptable |
send(StompHeaders headers,
Object payload)
An overloaded version of
send(String, Object) that accepts
full StompHeaders instead of a destination. |
StompSession.Receiptable |
send(String destination,
Object payload)
Send a message to the specified destination, converting the payload to a
byte[] with the help of a
MessageConverter . |
void |
setAutoReceipt(boolean enabled)
When enabled, a receipt header is automatically added to future
send and subscribe operations on this session, which causes
the server to return a RECEIPT. |
StompSession.Subscription |
subscribe(StompHeaders headers,
StompFrameHandler handler)
An overloaded version of
subscribe(String, StompFrameHandler)
that accepts full StompHeaders rather instead of a destination. |
StompSession.Subscription |
subscribe(String destination,
StompFrameHandler handler)
Subscribe to the given destination by sending a SUBSCRIBE frame and handle
received messages with the specified
StompFrameHandler . |
String getSessionId()
boolean isConnected()
void setAutoReceipt(boolean enabled)
send
and subscribe
operations on this session, which causes
the server to return a RECEIPT. An application can then use the
Receiptable
returned from the operation to track the receipt.
A receipt header can also be added manually through the overloaded
methods that accept StompHeaders
.
StompSession.Receiptable send(String destination, Object payload)
byte[]
with the help of a
MessageConverter
.destination
- the destination to send a message topayload
- the message payloadStompSession.Receiptable send(StompHeaders headers, Object payload)
send(String, Object)
that accepts
full StompHeaders
instead of a destination. The headers must
contain a destination and may also have other headers such as
"content-type" or custom headers for the broker to propagate to subscribers,
or broker-specific, non-standard headers..headers
- the message headerspayload
- the message payloadStompSession.Subscription subscribe(String destination, StompFrameHandler handler)
StompFrameHandler
.destination
- the destination to subscribe tohandler
- the handler for received messagesStompSession.Subscription subscribe(StompHeaders headers, StompFrameHandler handler)
subscribe(String, StompFrameHandler)
that accepts full StompHeaders
rather instead of a destination.headers
- the headers for the subscribe message framehandler
- the handler for received messagesvoid disconnect()