Package org.hornetq.rest.topic

Source Code of org.hornetq.rest.topic.PushSubscription

package org.hornetq.rest.topic;

import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.rest.queue.push.PushConsumer;
import org.hornetq.rest.queue.push.PushStore;
import org.hornetq.rest.queue.push.xml.PushRegistration;

/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class PushSubscription extends PushConsumer
{
   private static final Logger log = Logger.getLogger(PushSubscription.class);

   public PushSubscription(ClientSessionFactory factory, String destination, String id, PushRegistration registration, PushStore store)
   {
      super(factory, destination, id, registration, store);
   }

   @Override
   public void disableFromFailure()
   {
      super.disableFromFailure();
      if (registration.isDurable()) deleteSubscriberQueue();
   }

   protected void deleteSubscriberQueue()
   {
      String subscriptionName = registration.getDestination();
      ClientSession session = null;
      try
      {
         session = factory.createSession();

         session.deleteQueue(subscriptionName);
      }
      catch (HornetQException e)
      {
         log.error(e);
      }
      finally
      {
         try
         {
            session.close();
         }
         catch (HornetQException e)
         {
         }
      }
   }

}
TOP

Related Classes of org.hornetq.rest.topic.PushSubscription

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.