diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java index ee65e94ca2..41d061bfc1 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java @@ -81,6 +81,7 @@ class Send implements StompCommand { msg.setProducerId(format.getProducerId()); msg.setMessageId(format.createMessageId()); + msg.setJMSTimestamp(System.currentTimeMillis()); ActiveMQDestination d = DestinationNamer.convert(destination); diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java index e45ed5e4af..d52e7ed3de 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java @@ -155,6 +155,12 @@ public class StompTest extends CombinationTestSupport { TextMessage message = (TextMessage) consumer.receive(1000); assertNotNull(message); assertEquals("Hello World", message.getText()); + + // Make sure that the timestamp is valid - should + // be very close to the current time. + long tnow = System.currentTimeMillis(); + long tmsg = message.getJMSTimestamp(); + assertTrue( Math.abs(tnow - tmsg) < 1000 ); }