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 Thread |
runner |
protected boolean |
running |
protected Set<String> |
server_destinations |
protected String |
session_id |
protected Socket |
sock |
protected Set<String> |
subscriptions |
Constructor and Description |
---|
StompConnection(String dest) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(StompConnection.Listener listener) |
protected void |
close() |
void |
connect() |
protected void |
connect(String dest) |
void |
connect(String userid,
String password) |
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) |
protected static SocketAddress |
parse(String dest) |
protected String |
pickRandomDestination() |
void |
reconnect() |
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 |
startRunner() |
void |
subscribe(String destination) |
void |
unsubscribe(String destination) |
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 final Log log
public StompConnection(String dest)
dest
- IP address + ':' + port, e.g. "192.168.1.5:8787"public String getSessionId()
public void addListener(StompConnection.Listener listener)
public void removeListener(StompConnection.Listener listener)
public void connect(String userid, String password) throws IOException
IOException
public void reconnect() throws IOException
IOException
public void connect() throws IOException
IOException
public void disconnect()
public void subscribe(String destination)
public void unsubscribe(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)
protected String pickRandomDestination()
protected void connect(String dest) throws IOException
IOException
protected static SocketAddress parse(String dest) throws UnknownHostException
UnknownHostException
protected void close()
public boolean isConnected()
protected void startRunner()
public static void main(String[] args) throws IOException
IOException
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.