This closes #3457
This commit is contained in:
commit
f451c42d22
|
@ -210,6 +210,10 @@ public class AmqpCoreConverter {
|
|||
throw new RuntimeException("Unexpected body type: " + body.getClass());
|
||||
}
|
||||
|
||||
// Initialize the JMS expiration with the value calculated during the scan of the AMQP message
|
||||
// to avoid a different value for each conversion based on System.currentTimeMillis() and ttl.
|
||||
result.setJMSExpiration(message.getExpiration());
|
||||
|
||||
processHeader(result, header);
|
||||
processMessageAnnotations(result, annotations);
|
||||
processApplicationProperties(result, applicationProperties);
|
||||
|
|
|
@ -992,6 +992,19 @@ public class AMQPMessageTest {
|
|||
assertTrue(decoded.getExpiration() > System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetExpirationFromCoreMessageUsingTTL() {
|
||||
final long ttl = 100000;
|
||||
|
||||
MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
|
||||
protonMessage.setHeader(new Header());
|
||||
protonMessage.setTtl(ttl);
|
||||
AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage);
|
||||
|
||||
ICoreMessage coreMessage = decoded.toCore();
|
||||
assertEquals(decoded.getExpiration(), coreMessage.getExpiration());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetExpirationFromMessageUsingAbsoluteExpiration() {
|
||||
final Date expirationTime = new Date(System.currentTimeMillis());
|
||||
|
|
Loading…
Reference in New Issue