File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed
main/java/com/amazon/sqs/javamessaging
test/java/com/amazon/sqs/javamessaging Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -382,6 +382,7 @@ protected jakarta.jms.Message convertToJMSMessage(Message message) throws JMSExc
382
382
}
383
383
384
384
jmsMessage .setJMSTimestamp (getJMSTimestamp (message ));
385
+ jmsMessage .setJMSDeliveryTime (getApproximateFirstReceiveTimestamp (message ));
385
386
return jmsMessage ;
386
387
}
387
388
@@ -395,6 +396,16 @@ private long getJMSTimestamp(Message message) {
395
396
}
396
397
}
397
398
399
+ private long getApproximateFirstReceiveTimestamp (Message message ) {
400
+ Map <String , String > systemAttributes = message .attributesAsStrings ();
401
+ String timestamp = systemAttributes .get (SQSMessagingClientConstants .APPROXIMATE_FIRST_RECEIVE_TIMESTAMP );
402
+ if (timestamp != null ) {
403
+ return Long .parseLong (timestamp );
404
+ } else {
405
+ return 0L ;
406
+ }
407
+ }
408
+
398
409
protected void nackQueueMessages () {
399
410
// Also nack messages already in the messageQueue
400
411
synchronized (stateLock ) {
Original file line number Diff line number Diff line change @@ -80,6 +80,8 @@ public class SQSMessagingClientConstants {
80
80
81
81
public static final String SEQUENCE_NUMBER = "SequenceNumber" ;
82
82
83
+ public static final String APPROXIMATE_FIRST_RECEIVE_TIMESTAMP = "ApproximateFirstReceiveTimestamp" ;
84
+
83
85
static final String APPENDED_USER_AGENT_HEADER_VERSION ;
84
86
static {
85
87
try {
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ public class SQSMessage implements Message {
104
104
private String type ;
105
105
private SQSQueueDestination replyTo ;
106
106
private Destination destination ;
107
+ private long deliveryTime ;
107
108
108
109
private final Map <String , JMSMessagePropertyValue > properties = new HashMap <>();
109
110
@@ -422,13 +423,12 @@ public void setJMSExpiration(long expiration) throws JMSException {
422
423
423
424
@ Override
424
425
public long getJMSDeliveryTime () throws JMSException {
425
- // FIXME
426
- return 0 ;
426
+ return deliveryTime ;
427
427
}
428
428
429
429
@ Override
430
430
public void setJMSDeliveryTime (long deliveryTime ) throws JMSException {
431
- // FIXME
431
+ this . deliveryTime = deliveryTime ;
432
432
}
433
433
434
434
@ Override
Original file line number Diff line number Diff line change @@ -1830,7 +1830,7 @@ public void testRequestedMessageTracking(int numberOfMessagesToPrefetch) throws
1830
1830
1831
1831
// Wait to make sure the received calls have gotten far enough to
1832
1832
// wait on the message queue
1833
- allReceivesWaiting .await ();
1833
+ allReceivesWaiting .await (2000 , TimeUnit . MILLISECONDS );
1834
1834
1835
1835
assertEquals (concurrentReceives , consumerPrefetch .messagesRequested );
1836
1836
You can’t perform that action at this time.
0 commit comments