mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1162215 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
35384de3a7
commit
82df23e4a4
|
@ -82,6 +82,10 @@ public interface FrameTranslator {
|
|||
headers.put(Stomp.Headers.Message.ORIGINAL_DESTINATION, ft.convertDestination(converter, message.getOriginalDestination()));
|
||||
}
|
||||
|
||||
if (message.isPersistent()) {
|
||||
headers.put(Stomp.Headers.Message.PERSISTENT, Stomp.TRUE);
|
||||
}
|
||||
|
||||
// now lets add all the message headers
|
||||
final Map<String, Object> properties = message.getProperties();
|
||||
if (properties != null) {
|
||||
|
|
|
@ -110,6 +110,7 @@ public interface Stomp {
|
|||
String BROWSER = "browser";
|
||||
String USERID = "JMSXUserID";
|
||||
String ORIGINAL_DESTINATION = "original-destination";
|
||||
String PERSISTENT = "persistent";
|
||||
}
|
||||
|
||||
public interface Subscribe {
|
||||
|
|
|
@ -1522,7 +1522,6 @@ public class StompTest extends CombinationTestSupport {
|
|||
headers.put(Stomp.Headers.Message.EXPIRATION_TIME, String.valueOf(timestamp));
|
||||
headers.put(Stomp.Headers.Send.PERSISTENT, "true");
|
||||
|
||||
|
||||
stompConnection.send("/queue/" + getQueueName(), "msg", null, headers);
|
||||
|
||||
stompConnection.subscribe("/queue/ActiveMQ.DLQ");
|
||||
|
@ -1531,8 +1530,35 @@ public class StompTest extends CombinationTestSupport {
|
|||
assertEquals(stompMessage.getHeaders().get(Stomp.Headers.Message.ORIGINAL_DESTINATION), "/queue/" + getQueueName());
|
||||
}
|
||||
|
||||
public void testPersistent() throws Exception {
|
||||
stompConnection.connect("system", "manager");
|
||||
|
||||
HashMap<String, String> headers = new HashMap<String, String>();
|
||||
headers.put(Stomp.Headers.Message.PERSISTENT, "true");
|
||||
|
||||
stompConnection.send("/queue/" + getQueueName(), "hello", null, headers);
|
||||
|
||||
stompConnection.subscribe("/queue/" + getQueueName());
|
||||
|
||||
StompFrame stompMessage = stompConnection.receive();
|
||||
assertNotNull(stompMessage);
|
||||
assertNotNull(stompMessage.getHeaders().get(Stomp.Headers.Message.PERSISTENT));
|
||||
assertEquals(stompMessage.getHeaders().get(Stomp.Headers.Message.PERSISTENT), "true");
|
||||
}
|
||||
|
||||
public void testPersistentDefaultValue() throws Exception {
|
||||
stompConnection.connect("system", "manager");
|
||||
|
||||
HashMap<String, String> headers = new HashMap<String, String>();
|
||||
|
||||
stompConnection.send("/queue/" + getQueueName(), "hello", null, headers);
|
||||
|
||||
stompConnection.subscribe("/queue/" + getQueueName());
|
||||
|
||||
StompFrame stompMessage = stompConnection.receive();
|
||||
assertNotNull(stompMessage);
|
||||
assertNull(stompMessage.getHeaders().get(Stomp.Headers.Message.PERSISTENT));
|
||||
}
|
||||
|
||||
protected void assertClients(int expected) throws Exception {
|
||||
org.apache.activemq.broker.Connection[] clients = broker.getBroker().getClients();
|
||||
|
|
Loading…
Reference in New Issue