jbertram commented on a change in pull request #3279:
URL: https://github.com/apache/activemq-artemis/pull/3279#discussion_r533543627
##########
File path:
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java
##########
@@ -1260,5 +1262,60 @@ public void testReceiveRejecting() throws Exception {
connection.close();
}
+ @Test(timeout = 60000)
+ public void testIngressTimestampSendCore() throws Exception {
+ internalTestIngressTimestamp(Protocol.CORE);
+ }
+
+ @Test(timeout = 60000)
+ public void testIngressTimestampSendAMQP() throws Exception {
+ internalTestIngressTimestamp(Protocol.AMQP);
+ }
+
+ @Test(timeout = 60000)
+ public void testIngressTimestampSendOpenWire() throws Exception {
+ internalTestIngressTimestamp(Protocol.OPENWIRE);
+ }
+
+ private void internalTestIngressTimestamp(Protocol protocol) throws
Exception {
+ server.getAddressSettingsRepository().addMatch(getQueueName(), new
AddressSettings().setEnableIngressTimestamp(true));
+ long beforeSend = System.currentTimeMillis();
+ if (protocol == Protocol.CORE) {
+ sendMessagesCore(getQueueName(), 1, true);
+ } else if (protocol == Protocol.OPENWIRE) {
+ sendMessagesOpenWire(getQueueName(), 1, true);
+ } else {
+ sendMessages(getQueueName(), 1, true);
+ }
+ long afterSend = System.currentTimeMillis();
+ AmqpClient client = createAmqpClient();
+ AmqpConnection connection = addConnection(client.connect());
+ AmqpSession session = connection.createSession();
+
+ AmqpReceiver receiver = session.createReceiver(getQueueName());
+
+ Queue queueView = getProxyToQueue(getQueueName());
+ assertEquals(1, queueView.getMessageCount());
+
+ receiver.flow(1);
+ AmqpMessage receive = receiver.receive(5, TimeUnit.SECONDS);
+ assertNotNull(receive);
+ instanceLog.info(receive);
+ Object ingressTimestamp =
receive.getMessageAnnotation(AMQPMessageSupport.INGRESS_TIMESTAMP.toString());
+ assertNotNull(ingressTimestamp);
+ assertTrue(ingressTimestamp instanceof Long);
+ long ingressTs = (Long) ingressTimestamp;
+ assertTrue(beforeSend <= ingressTs && afterSend >= ingressTs);
+ receiver.close();
+
+ assertEquals(1, queueView.getMessageCount());
+
+ connection.close();
+ }
+
+ private enum Protocol {
+ CORE, AMQP, OPENWIRE
+ }
+
Review comment:
Good point.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]