4 Replies Latest reply on Nov 20, 2012 1:54 AM by pjrhalicky

    configure delayed redelivery using core API?

    pjrhalicky

      Hi,

       

      I am using HornetQ embedded in my application, creating all queues programmatically and using the Core API (i.e. no config files, no JMS). I need to set delayed redelivery on the queues I create, but I can't find a way to do it. The documentation (section 21.1.1) says how to do it when using config files and JMS - but is there a way to do it in my scenario?

       

      Thanks for any advice!

        • 1. Re: configure delayed redelivery using core API?
          clebert.suconic

          You just do this on the address settings for the queues matching your names...

           

           

             <address-settings>

                <!--override the redelivery-delay  for the example queue-->

                <address-setting match="jms.queue.exampleQueue">

                   <redelivery-delay>5000</redelivery-delay>

                </address-setting>

             </address-settings>

           

           

          On the case if you don't have jms address, just use just the name for your queue, or look on the matching arguments... you can have something like

           

           

           

           

             <address-settings>

                <!--override the redelivery-delay  for the example queue-->

                <address-setting match="#">

                   <redelivery-delay>5000</redelivery-delay>

                </address-setting>

             </address-settings>

          1 of 1 people found this helpful
          • 2. Re: configure delayed redelivery using core API?
            pjrhalicky

            OK would this work to set 5 seconds redelivery delay on all queues in the system? (in other words, will the "#" match all queues?)

             

                    Map<String, AddressSettings> adrsettings = new HashMap<String, AddressSettings>();

                    AddressSettings as = new AddressSettings();

                    as.setRedeliveryDelay(5000);

                    adrsettings.put("#", as);

                    configuration.setAddressesSettings(adrsettings);

                   

                    // start the HornetQ server

                    server = HornetQServers.newHornetQServer(configuration);

            • 3. Re: configure delayed redelivery using core API?
              clebert.suconic

              Yes.. it should work...

               

               

              notice that redelivery means the current message, all subsequent messages will still be dleivered after this failure. and the redelivered message will be back to the queue in 5 seconds after a redelivery.

              • 4. Re: configure delayed redelivery using core API?
                pjrhalicky

                Thank you, I'll test this a bit later and will report back if there's a problem.