मैं JMS Android पर है, जो संदर्भ देता the experimental Stomp API ActiveMQ 5.2 और अधिक से अधिक (उदाहरण के नीचे की नकल की)
भी उल्लेख किया
कि REST API, मोबाइल उपकरणों के लिए एक बेहतर फिट हो सकता है राज्य बनाए रखा जाना करने के लिए अनुमति है में शामिल बारे में this forum discussion पाया पूरी तरह से दलाल पर।
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();
स्रोत
2012-02-20 17:47:28
बस उत्सुक ... अगर ग्राहक जावा है, क्यों Stomp का उपयोग कर? –
एप्लिकेशन एक एंड्रॉइड एप्लिकेशन है और मैं जेएमएस या ओपनवायर (जहां तक मुझे पता है) का उपयोग नहीं कर सकता। – mgiammarco
क्या आपको एक काम करने वाला स्टॉम्प + एसएसएल क्लाइंट मिला है? – alexvetter