Patch Bay includes a feature that lets you delay the delivery of a message until a specific time. To support this behavior, Patch Bay uses a class called atg.dms.patchbay.MessageLimbo that receives messages that are marked for delayed delivery, stores them in database tables until the specified delivery time, and then sends them to their intended destinations. The delivery time for a message can be specified by inserting a property in the header of the message. The name of this property is stored in the MessageLimbo DELIVERY_DATE field, and its value should be a Long datetime, specified as UTC milliseconds from the epoch start (1 January 1970 0:00 UTC).

For example, the following code creates an SQL JMS message and specifies that it should not be delivered until one hour has passed:

Message m = (Message) qs.createMessage();
long hourInMillis = 1000 * 60 * 60;
long now = System.currentTimeMillis();
Long deliveryDate = new Long(now + hourInMillis);
m.setObjectProperty(atg.dms.patchbay.MessageLimbo.DELIVERY_DATE, deliveryDate);

If you require delivery on a specific date and not just a time offset, you can use the Java Date or Calendar class to produce the UTC milliseconds for the specific delivery date.

Note: The message cannot be delivered any sooner than the specified time, but there is no guarantee how much later the delivery actually takes place.

Configuring Delayed Delivery

The following are key properties of the MessagingManager component that configure the delayed delivery feature: