public class StompConnection extends Object implements 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.Listener |
Modifier and Type | Field and Description |
---|---|
protected DataInputStream |
in |
protected Set<StompConnection.Listener> |
listeners |
protected Log |
log |
protected DataOutputStream |
out |
protected String |
password |
protected boolean |
reconnect |
protected Thread |
runner |
protected boolean |
running |
protected Set<String> |
server_destinations |
protected String |
session_id |
protected Socket |
sock |
protected SocketFactory |
socket_factory |
protected Set<String> |
subscriptions |
protected String |
userid |
Constructor and Description |
---|
StompConnection(String dest) |
StompConnection(String dest,
boolean reconnect,
boolean ssl) |
StompConnection(String dest,
String userid,
String password,
boolean reconnect,
boolean ssl) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(StompConnection.Listener listener) |
protected void |
closeConnections() |
void |
connect() |
protected void |
connectToDestination(String dest) |
void |
disconnect() |
String |
getSessionId() |
boolean |
isConnected() |
static void |
main(String[] args) |
protected void |
notifyListeners(Map<String,String> info) |
protected void |
notifyListeners(Map<String,String> headers,
byte[] buf,
int offset,
int length) |
void |
removeListener(StompConnection.Listener listener) |
void |
run() |
void |
send(String destination,
byte[] buf) |
void |
send(String destination,
byte[] buf,
int offset,
int length) |
void |
send(String destination,
byte[] buf,
int offset,
int length,
String... headers) |
void |
send(String destination,
String... headers)
Sends an INFO without body
|
protected void |
sendConnect() |
protected void |
sendSubscribe(String destination) |
protected void |
sendUnsubscribe(String destination) |
void |
startReconnectingClient() |
protected void |
startRunner() |
void |
subscribe(String destination) |
void |
unsubscribe(String destination) |
protected SocketFactory socket_factory
protected Socket sock
protected DataInputStream in
protected DataOutputStream out
protected final Set<StompConnection.Listener> listeners
protected Thread runner
protected volatile boolean running
protected String session_id
protected String userid
protected String password
protected boolean reconnect
protected final Log log
public StompConnection(String dest)
dest
- IP address + ':' + port, e.g. "192.168.1.5:8787"public StompConnection(String dest, boolean reconnect, boolean ssl)
public String getSessionId()
public void addListener(StompConnection.Listener listener)
public void removeListener(StompConnection.Listener listener)
protected void startRunner()
protected void sendConnect()
public void subscribe(String destination)
protected void sendSubscribe(String destination)
public void unsubscribe(String destination)
protected void sendUnsubscribe(String destination)
public void send(String destination, byte[] buf, int offset, int length)
public void send(String destination, byte[] buf)
protected void notifyListeners(Map<String,String> headers, byte[] buf, int offset, int length)
public void connect() throws IOException
IOException
public void startReconnectingClient()
protected void connectToDestination(String dest) throws IOException
IOException
public void disconnect()
protected void closeConnections()
public boolean isConnected()
public static void main(String[] args) throws IOException
IOException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.