public void connect(String username, String password) throws Exception { connect(username, password, null); }
public void connect(String username, String password) throws Exception { connect(username, password, null); }
public void connect(String username, String password) throws Exception { connect(username, password, null); }
public void connect(String username, String password) throws Exception { connect(username, password, null); }
public void connect(String username, String password, String client) throws Exception { HashMap<String, String> headers = new HashMap<String, String>(); headers.put("login", username); headers.put("passcode", password); if (client != null) { headers.put("client-id", client); } connect(headers); }
public void connect(String username, String password, String client) throws Exception { HashMap<String, String> headers = new HashMap<String, String>(); headers.put("login", username); headers.put("passcode", password); if (client != null) { headers.put("client-id", client); } connect(headers); }
public void connect(String username, String password, String client) throws Exception { HashMap<String, String> headers = new HashMap<String, String>(); headers.put("login", username); headers.put("passcode", password); if (client != null) { headers.put("client-id", client); } connect(headers); }
StompConnection connection = new StompConnection(); connection.open("localhost", 61613); connection.connect("system", "manager"); StompFrame connect = connection.receive(); if (!connect.getAction().equals(Stomp.Responses.CONNECTED)) { throw new Exception ("Not connected"); } connection.begin("tx1"); connection.send("/queue/test", "message1", "tx1", null); connection.send("/queue/test", "message2", "tx1", null); connection.commit("tx1"); connection.subscribe("/queue/test", Subscribe.AckModeValues.CLIENT); connection.begin("tx2"); StompFrame message = connection.receive(); System.out.println(message.getBody()); connection.ack(message, "tx2"); message = connection.receive(); System.out.println(message.getBody()); connection.ack(message, "tx2"); connection.commit("tx2"); connection.disconnect();