#250 Patch 742604 - New vendor-specific JMS properties

v3.2
open
nobody
JBossMQ (8)
5
2003-05-27
2003-05-27
Elias Ross
No

Applied a patch which adds the following JBoss
vendor-specific JMS properties:

"JMS_JBOSS_SCHEDULED_DELIVERY";
"JMS_JBOSS_REDELIVERY_DELAY";
"JMS_JBOSS_REDELIVERY_COUNT";
"JMS_JBOSS_REDELIVERY_LIMIT";

1. Scheduled delivery, paused (delayed) re-delivery
2. Track number of delivery attempts of a message
3. Set maximum delivery attempts per message
4. Proactively expire messages, without having to
restore
the whole message from disk if cached. Also, the
same timer
thread which handles scheduled messages proactively
"reaps" expired messages.

Discussion

  • Elias Ross
    Elias Ross
    2003-05-27

    • summary: New vendor-specific JMS properties --> Patch 742604 - New vendor-specific JMS properties
     
  • Logged In: YES
    user_id=962868

    Can we make this as a configurable property in service xml?
    If the current message doesn't contain the property,
    then BasicQueue.java can use the default value configured in
    the service xml.

    jms-service.xml
    --------------
    <?xml version="1.0" encoding="UTF-8"?>
    <server>

    <mbean code="org.jboss.mq.server.jmx.Queue"

    name="jboss.mq.destination:service=Queue,name=
    jms/TestQueue">
    <depends optional-attribute-
    name="DestinationManager">jboss.mq:service=DestinationM
    anager</depends>
    <attribute
    name="JNDIName">jms/TestQueue</attribute>
    <attribute
    name="RedeliveryDelay">30000</attribute>
    <attribute
    name="RedeliveryLimit">100</attribute>
    </mbean>
    </server>

    BasicQueue.java
    ---------------
    ....

    /**
    * Restore a message to the queue
    */
    class RestoreMessageTask implements Runnable
    {

    ....

    public void run()
    {
    if (log.isTraceEnabled())
    log.trace("Restoring message: " + message);

    try
    {
    SpyMessage spyMessage = message.getMessage();

    // Set redelivered, vendor-specific flags
    spyMessage.setJMSRedelivered(true);
    if (spyMessage.propertyExists
    (SpyMessage.PROPERTY_REDELIVERY_DELAY))
    {
    log.trace("message has redelivery delay");
    long delay = spyMessage.getLongProperty
    (SpyMessage.PROPERTY_REDELIVERY_DELAY);
    message.messageScheduledDelivery =
    System.currentTimeMillis() + delay;
    }
    //[Devaraj]--->
    // If redelivery delay is not specified in the message header,
    then use the value specified
    // in queue configuration.

    else if( parameters.redeliveryDelay > 0 )
    {

    message.messageScheduledDelivery =
    System.currentTimeMillis() + parameters.redeliveryDelay;
    }

    //If message doesnt have Redelivery Limit, then use the
    value specified
    // in queue configuration.
    if (! spyMessage.propertyExists
    (SpyMessage.PROPERTY_REDELIVERY_LIMIT) &&
    parameters.redeliveryLimit >= -1 )
    {

    spyMessage.header.jmsProperties.put
    (SpyMessage.PROPERTY_REDELIVERY_LIMIT, new Integer
    (parameters.redeliveryLimit));
    }

    //<---[Devaraj]

    ....

    BasicQueueParameters.java
    ------------------------
    public class BasicQueueParameters
    {
    /** The maximum depth of a queue */
    public int maxDepth = 0;

    //[Devaraj]--->
    /** The delay in milliseconds before the rolled back
    or recovered messages are redelivered **/
    public long redeliveryDelay =-1 ;

    /** The number of times a message will be
    redelivered after a recover or rollback. **/
    public int redeliveryLimit =-1 ;

    //<---[Devaraj]
    }

    Queue.java
    ---------
    public class Queue
    extends DestinationMBeanSupport
    implements QueueMBean
    {
    JMSQueue destination;

    //[Devaraj]--->

    /**
    * Get the redelivery limit.
    *
    */
    public int getRedeliveryLimit( )
    {
    return parameters.redeliveryLimit;
    }

    /**
    * Set the redelivery limit.
    *
    */
    public void setRedeliveryLimit(int limit )
    {
    parameters.redeliveryLimit = limit;
    }

    /**
    * Gets redelivery delay attribute of the BasicQueue
    object
    */
    public long getRedeliveryDelay( )
    {
    return parameters.redeliveryDelay;
    }

    /**
    * Set redelivery delay attribute
    */
    public void setRedeliveryDelay(long rDelay )
    {
    //update it to basic queue parameters
    parameters.redeliveryDelay = rDelay;
    }
    //<---[Devaraj]
    ....