Details
-
New Feature
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Relevant sections from the JMS 2.0 specification:
3.4.13.JMSDeliveryTime When a message is sent, the JMS provider calculates its delivery time by adding the delivery delay value specified on the send method to the time the message was sent(for transacted sends, this is the time the client sends the message, not the time the transaction is committed). It is represented as a long value which is defined as the difference, measured in milliseconds, between the delivery time time and midnight, January 1, 1970 UTC.On return from the send method, the message’s JMSDeliveryTime header field contains this value. When a message is received its JMSDeliveryTime header field contains this same value.A message's delivery time is the earliest time when a provider may make the message visible on the target destination and available for delivery to consumers. Clients must not receive messages before the delivery time has been reached.
7.9.Message delivery delay A client can specify a delivery delay value in milliseconds for each message it sends. This is used to determine the message’s delivery time which is calculated by adding the delivery delay value specified on the send method to the time the message was sent(for transacted sends, this is the time the client sends the message, not the time the transaction is committed).A message’s delivery time is the earliest time when a JMS provider may deliver the message to a consumer. The provider must not deliver messages before the delivery time has been reached.If a message is published to a topic, it will only be added to a durable or non-durable subscription on that topic if the subscription exists at the time the message is sent. An application may specify the required delivery delay using the method setDeliveryDelay on the producer object. This sets the delivery delay of all messages sent using that producer. Note however that the setDeliveryDelay method on Message cannot be used to set the delivery delay of a message. See also section 3.4.13 “JMSDeliveryTime”
Approach:
1. Use scheduler support to delay deliver of message until the specified time
2. Throw an exception from the Broker is the field is non-zero and scheduler support is disabled
3. MessageProducer sets JMSDeliveryTime header field value
4. Note: DeliveryDelay is not honored when set on the Message directly, must be set by the MessageProducer (similar to priority, expiry, etc)
Optional follow-on (probably separate JIRA):
1. Consider DestinationPolicy value to override client setting
2. Consider DestinationPolicy value to ignore client setting
JMS v1.1 compatibility support:
1. Add ConnectionFactory method .setDeliveryDelayAsProperty(boolean ) (default: true in 5.17.x)
2. Connection sets the delivery delay value as a Property on produce
3. Connection removes the property on consume
4. Test over network of brokers
5. Test scheduler delivery over network of brokers (ensure no double-scheduling occurs)
JMS v2.0 support:
1. Update to openwire v13 to add header field for deliveryDelay
2. Maintain DeliveryDelayAsProperty support