public class StompConnection
extends java.lang.Object
implements java.lang.Runnable
subscribe DEST // example: subscribe /topics/a send DEST message // example: send /topics/a Hello world[1] http://stomp.codehaus.org/Protocol
Modifier and Type | Class and Description |
---|---|
static interface |
StompConnection.ConnectionCallback |
static interface |
StompConnection.Listener |
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<StompConnection.ConnectionCallback> |
callbacks |
protected java.io.DataInputStream |
in |
protected java.util.Set<StompConnection.Listener> |
listeners |
protected Log |
log |
protected java.io.DataOutputStream |
out |
protected java.lang.String |
password |
protected boolean |
reconnect |
protected java.lang.Thread |
runner |
protected boolean |
running |
protected java.util.Set<java.lang.String> |
server_destinations |
protected java.lang.String |
session_id |
protected java.net.Socket |
sock |
protected javax.net.SocketFactory |
socket_factory |
protected java.util.Set<java.lang.String> |
subscriptions |
protected java.lang.String |
userid |
Constructor and Description |
---|
StompConnection(java.lang.String dest) |
StompConnection(java.lang.String dest,
boolean reconnect,
boolean ssl) |
StompConnection(java.lang.String dest,
boolean reconnect,
javax.net.ssl.SSLContext ssl) |
StompConnection(java.lang.String dest,
java.lang.String userid,
java.lang.String password,
boolean reconnect,
boolean ssl) |
StompConnection(java.lang.String dest,
java.lang.String userid,
java.lang.String password,
boolean reconnect,
javax.net.ssl.SSLContext sslcontext) |
Modifier and Type | Method and Description |
---|---|
void |
addCallback(StompConnection.ConnectionCallback cb) |
void |
addListener(StompConnection.Listener listener) |
protected void |
closeConnections() |
void |
connect() |
protected void |
connectToDestination(java.lang.String dest) |
void |
disconnect() |
java.lang.String |
getSessionId() |
boolean |
isConnected() |
static void |
main(java.lang.String[] args) |
protected void |
notifyListeners(java.util.Map<java.lang.String,java.lang.String> info) |
protected void |
notifyListeners(java.util.Map<java.lang.String,java.lang.String> headers,
byte[] buf,
int offset,
int length) |
void |
removeCallback(StompConnection.ConnectionCallback cb) |
void |
removeListener(StompConnection.Listener listener) |
void |
run() |
void |
send(java.lang.String destination,
byte[] buf) |
void |
send(java.lang.String destination,
byte[] buf,
int offset,
int length) |
void |
send(java.lang.String destination,
byte[] buf,
int offset,
int length,
java.lang.String... headers) |
void |
send(java.lang.String destination,
java.lang.String... headers)
Sends an INFO without body
|
protected void |
sendConnect() |
protected void |
sendSubscribe(java.lang.String destination) |
protected void |
sendUnsubscribe(java.lang.String destination) |
void |
startReconnectingClient() |
protected void |
startRunner() |
void |
subscribe(java.lang.String destination) |
void |
unsubscribe(java.lang.String destination) |
protected javax.net.SocketFactory socket_factory
protected java.net.Socket sock
protected java.io.DataInputStream in
protected java.io.DataOutputStream out
protected final java.util.Set<java.lang.String> server_destinations
protected final java.util.Set<StompConnection.Listener> listeners
protected final java.util.Set<java.lang.String> subscriptions
protected final java.util.Set<StompConnection.ConnectionCallback> callbacks
protected java.lang.Thread runner
protected volatile boolean running
protected java.lang.String session_id
protected java.lang.String userid
protected java.lang.String password
protected boolean reconnect
protected final Log log
public StompConnection(java.lang.String dest)
dest
- IP address + ':' + port, e.g. "192.168.1.5:8787"public StompConnection(java.lang.String dest, boolean reconnect, boolean ssl)
public StompConnection(java.lang.String dest, boolean reconnect, javax.net.ssl.SSLContext ssl)
public StompConnection(java.lang.String dest, java.lang.String userid, java.lang.String password, boolean reconnect, boolean ssl)
public StompConnection(java.lang.String dest, java.lang.String userid, java.lang.String password, boolean reconnect, javax.net.ssl.SSLContext sslcontext)
public java.lang.String getSessionId()
public void addListener(StompConnection.Listener listener)
public void addCallback(StompConnection.ConnectionCallback cb)
public void removeListener(StompConnection.Listener listener)
public void removeCallback(StompConnection.ConnectionCallback cb)
protected void startRunner()
protected void sendConnect()
public void subscribe(java.lang.String destination)
protected void sendSubscribe(java.lang.String destination)
public void unsubscribe(java.lang.String destination)
protected void sendUnsubscribe(java.lang.String destination)
public void send(java.lang.String destination, byte[] buf, int offset, int length, java.lang.String... headers)
public void send(java.lang.String destination, java.lang.String... headers)
public void send(java.lang.String destination, byte[] buf, int offset, int length)
public void send(java.lang.String destination, byte[] buf)
public void run()
run
in interface java.lang.Runnable
protected void notifyListeners(java.util.Map<java.lang.String,java.lang.String> headers, byte[] buf, int offset, int length)
protected void notifyListeners(java.util.Map<java.lang.String,java.lang.String> info)
public void connect() throws java.io.IOException
java.io.IOException
public void startReconnectingClient()
protected void connectToDestination(java.lang.String dest) throws java.io.IOException
java.io.IOException
public void disconnect()
protected void closeConnections()
public boolean isConnected()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
Copyright © 1998-2020 Red Hat. All Rights Reserved.