Package org.jboss.jms.destination

Examples of org.jboss.jms.destination.JBossDestination


     
      String consumerID = GUIDGenerator.generateGUID();
           
      int prefetchSize = connectionEndpoint.getPrefetchSize();
     
      JBossDestination dest = new JBossQueue(queueName);
     
      //We don't care about redelivery delays and number of attempts for a direct consumer
     
      ServerConsumerEndpoint ep =
         new ServerConsumerEndpoint(consumerID, binding.queue,
View Full Code Here


                 
         synchronized (temporaryDestinations)
         {
            for(Iterator i = temporaryDestinations.iterator(); i.hasNext(); )
            {
               JBossDestination dest = (JBossDestination)i.next();
  
               if (dest.isQueue())
               {    
                 // Temporary queues must be unbound on ALL nodes of the cluster
                
                 postOffice.removeBinding(dest.getName(), postOffice.isClustered());                
               }
               else
               {
                  //No need to unbind - this will already have happened, and removeAllReferences
                  //will have already been called when the subscriptions were closed
                  //which always happens before the connection closed (depth first close)    
                 //note there are no durable subs on a temporary topic
                
                 //Sanity check
                
                  Collection queues = serverPeer.getPostOfficeInstance().getQueuesForCondition(new JMSCondition(false, dest.getName()), true);
                
                  if (!queues.isEmpty())
                 {
                    //This should never happen
                    throw new IllegalStateException("Cannot delete temporary destination if it has consumer(s)");
View Full Code Here

         
          return;
        }
      }
     
      JBossDestination dest = (JBossDestination)msg.getJMSDestination();
     
      // This allows the no-local consumers to filter out the messages that come from the same
      // connection.

      // TODO Do we want to set this for ALL messages. Optimisation is possible here.
      msg.setConnectionID(id);


      // We must reference the message *before* we send it the destination to be handled. This is
      // so we can guarantee that the message doesn't disappear from the store before the
      // handling is complete. Each channel then takes copies of the reference if they decide to
      // maintain it internally
     
      MessageReference ref = msg.createReference();
     
      long schedDeliveryTime = msg.getScheduledDeliveryTime();
     
      if (schedDeliveryTime > 0)
      {
         ref.setScheduledDeliveryTime(schedDeliveryTime);
      }
     
      if (dest.isDirect())
      {
        //Route directly to queue - temp kludge for clustering
        
        Binding binding = postOffice.getBindingForQueueName(dest.getName());
       
        if (binding == null)
        {
          throw new IllegalArgumentException("Cannot find binding for queue " + dest.getName());
        }
       
        Queue queue = binding.queue;
       
         Long scid = (Long)ref.getMessage().removeHeader(Message.SOURCE_CHANNEL_ID);
        
         Delivery del = queue.handleMove(ref, scid.longValue());
       
        if (del == null)
        {
          throw new JMSException("Failed to route " + ref + " to " + dest.getName());
        }
      }
      else if (dest.isQueue())
      {
         if (!postOffice.route(ref, new JMSCondition(true, dest.getName()), tx))
         {
            throw new JMSException("Failed to route " + ref + " to " + dest.getName());
         }
      }
      else
      {
         postOffice.route(ref, new JMSCondition(false, dest.getName()), tx);  
      }
        
      if (trace) { log.trace("sent " + msg); }
   }
View Full Code Here

      String consumerID = GUIDGenerator.generateGUID();

      int prefetchSize = connectionEndpoint.getPrefetchSize();

      JBossDestination dest = new JBossQueue(queueName);

      //We don't care about redelivery delays for a direct consumer
      //We do care about number of attempts, see JBMESSAGING-1774
      ServerConsumerEndpoint ep =
         new ServerConsumerEndpoint(consumerID, binding.queue,
View Full Code Here

         synchronized (temporaryDestinations)
         {
            for(Iterator i = temporaryDestinations.iterator(); i.hasNext(); )
            {
               JBossDestination dest = (JBossDestination)i.next();

               if (dest.isQueue())
               {
                 // Temporary queues must be unbound on ALL nodes of the cluster

                 postOffice.removeBinding(dest.getName(), postOffice.isClustered());
               }
               else
               {
                  //No need to unbind - this will already have happened, and removeAllReferences
                  //will have already been called when the subscriptions were closed
                  //which always happens before the connection closed (depth first close)
                 //note there are no durable subs on a temporary topic

                 //Sanity check

                  Collection queues = serverPeer.getPostOfficeInstance().getQueuesForCondition(new JMSCondition(false, dest.getName()), true);

                  if (!queues.isEmpty())
                  {
                     // This should never happen
                     throw new IllegalStateException("Cannot delete temporary destination if it has consumer(s)");
                  }
               }

               //
               // Remove temporary destination from the DestinationManager (JBMESSAGING-1215)
               //
               DestinationManager dm = serverPeer.getDestinationManager();

               ManagedDestination mDest = dm.getDestination(dest.getName(), dest.isQueue());
               if (dm == null)
               {
                  throw new InvalidDestinationException("No such destination: " + dest);
               }
View Full Code Here

      return remotingClientSessionID;
   }

   boolean sendMessage(JBossMessage msg, Transaction tx, boolean checkForDuplicates) throws Exception
   {
      JBossDestination dest = (JBossDestination)msg.getJMSDestination();

      if (!dest.isDirect())
      {
         long msgID = serverPeer.getMessageIDMgr().getID();

         msg.setMessageId(msgID);
      }

      // Trace after the messageID was generated
      if (trace) { log.trace(this + " sending message " + msg + (tx == null ? " non-transactionally" : " in " + tx)); }

      // This allows the no-local consumers to filter out the messages that come from the same
      // connection.

      msg.setConnectionID(id);

      // We must reference the message *before* we send it the destination to be handled. This is
      // so we can guarantee that the message doesn't disappear from the store before the
      // handling is complete. Each channel then takes copies of the reference if they decide to
      // maintain it internally

      MessageReference ref = msg.createReference();

      if (checkForDuplicates)
      {
         if (serverPeer.getPersistenceManagerInstance().idExists(msg.getJMSMessageID()))
         {
            log.trace("ID exists in ID cache, probably duplicate sent on failover");

            return false;
         }
      }

      long schedDeliveryTime = msg.getScheduledDeliveryTime();

      if (schedDeliveryTime > 0)
      {
         ref.setScheduledDeliveryTime(schedDeliveryTime);
      }

      if (dest.isDirect())
      {
         if (trace) { log.trace(this + " routing " + msg + " to direct destination"); }
        //Route directly to queue - temp kludge for clustering

        Binding binding = postOffice.getBindingForQueueName(dest.getName());

        if (binding == null)
        {
          throw new IllegalArgumentException("Cannot find binding for queue " + dest.getName());
        }

        Queue queue = binding.queue;

         Long scid = (Long)ref.getMessage().removeHeader(Message.SOURCE_CHANNEL_ID);

         Delivery del = queue.handleMove(ref, scid.longValue());

        if (del == null)
        {
          throw new JMSException("Failed to route " + ref + " to " + dest.getName());
        }
      }
      else if (dest.isQueue())
      {
         if (trace) { log.trace(this + " routing " + msg + " to queue"); }
         if (!postOffice.route(ref, new JMSCondition(true, dest.getName()), tx))
         {
            throw new JMSException("Failed to route " + ref + " to " + dest.getName());
         }
      }
      else
      {
         if (trace) { log.trace(this + " routing " + msg + " to postoffice"); }
         postOffice.route(ref, new JMSCondition(false, dest.getName()), tx);
      }

      if (trace) { log.trace("sent " + msg); }

      return true;
View Full Code Here

         synchronized (temporaryDestinations)
         {
            for(Iterator i = temporaryDestinations.iterator(); i.hasNext(); )
            {
               JBossDestination dest = (JBossDestination)i.next();

               if (dest.isQueue())
               {
                 // Temporary queues must be unbound on ALL nodes of the cluster

                 postOffice.removeBinding(dest.getName(), postOffice.isClustered());
               }
               else
               {
                  //No need to unbind - this will already have happened, and removeAllReferences
                  //will have already been called when the subscriptions were closed
                  //which always happens before the connection closed (depth first close)
                 //note there are no durable subs on a temporary topic

                 //Sanity check

                  Collection queues = serverPeer.getPostOfficeInstance().getQueuesForCondition(new JMSCondition(false, dest.getName()), true);

                  if (!queues.isEmpty())
                  {
                     // This should never happen
                     throw new IllegalStateException("Cannot delete temporary destination if it has consumer(s)");
                  }
               }

               //
               // Remove temporary destination from the DestinationManager (JBMESSAGING-1215)
               //
               DestinationManager dm = serverPeer.getDestinationManager();

               ManagedDestination mDest = dm.getDestination(dest.getName(), dest.isQueue());
               if (dm == null)
               {
                  throw new InvalidDestinationException("No such destination: " + dest);
               }
View Full Code Here

      return remotingClientSessionID;
   }

   boolean sendMessage(JBossMessage msg, Transaction tx, boolean checkForDuplicates) throws Exception
   {
      JBossDestination dest = (JBossDestination)msg.getJMSDestination();

      if (!dest.isDirect())
      {
         long msgID = serverPeer.getMessageIDMgr().getID();

         msg.setMessageId(msgID);
      }

      // Trace after the messageID was generated
      if (trace) { log.trace(this + " sending message " + msg + (tx == null ? " non-transactionally" : " in " + tx)); }

      // This allows the no-local consumers to filter out the messages that come from the same
      // connection.

      msg.setConnectionID(id);

      // We must reference the message *before* we send it the destination to be handled. This is
      // so we can guarantee that the message doesn't disappear from the store before the
      // handling is complete. Each channel then takes copies of the reference if they decide to
      // maintain it internally

      MessageReference ref = msg.createReference();

      if (checkForDuplicates)
      {
         if (serverPeer.getPersistenceManagerInstance().idExists(msg.getJMSMessageID()))
         {
            log.trace("ID exists in ID cache, probably duplicate sent on failover");

            return false;
         }
      }

      long schedDeliveryTime = msg.getScheduledDeliveryTime();

      if (schedDeliveryTime > 0)
      {
         ref.setScheduledDeliveryTime(schedDeliveryTime);
      }

      if (dest.isDirect())
      {
         if (trace) { log.trace(this + " routing " + msg + " to direct destination"); }
        //Route directly to queue - temp kludge for clustering

        Binding binding = postOffice.getBindingForQueueName(dest.getName());

        if (binding == null)
        {
          throw new IllegalArgumentException("Cannot find binding for queue " + dest.getName());
        }

        Queue queue = binding.queue;

         Long scid = (Long)ref.getMessage().removeHeader(Message.SOURCE_CHANNEL_ID);

         Delivery del = queue.handleMove(ref, scid.longValue());

        if (del == null)
        {
          throw new JMSException("Failed to route " + ref + " to " + dest.getName());
        }
      }
      else if (dest.isQueue())
      {
         if (trace) { log.trace(this + " routing " + msg + " to queue"); }
         RouteResult result = postOffice.route(ref, new JMSCondition(true, dest.getName()), tx);
         if (!result.getResult())
         {
            throw new JMSException("Failed to route " + ref + " to " + dest.getName());
         }
      }
      else
      {
         if (trace) { log.trace(this + " routing " + msg + " to postoffice"); }
         RouteResult result = postOffice.route(ref, new JMSCondition(false, dest.getName()), tx);
         if (result.isFailue())
         {
            throw new JMSException("Failed to route " + ref + " to " + dest.getName());
         }
      }

      if (trace) { log.trace("sent " + msg); }

View Full Code Here

      // Test the default values
      assertEquals(new Integer(fullSize), ServerManagement.getAttribute(destObjectName, "FullSize"));
      assertEquals(new Integer(pageSize), ServerManagement.getAttribute(destObjectName, "PageSize"));
      assertEquals(new Integer(downCacheSize), ServerManagement.getAttribute(destObjectName, "DownCacheSize"));

      JBossDestination jbd2;
     
      if (isQueue())
      {
         jbd2 = new JBossQueue("PageableAttributes");
      }
      else
      {
         jbd2 = new JBossTopic("PageableAttributes");
      }
     
      ManagedDestination mDest = ServerManagement.getDestinationManager().getDestination(jbd2.getName(), jbd2.isQueue());
      
      assertEquals(fullSize, mDest.getFullSize());
      assertEquals(pageSize, mDest.getPageSize());
      assertEquals(downCacheSize, mDest.getDownCacheSize());
     
      // Try to change the values when destination lives, no effect
      ServerManagement.setAttribute(destObjectName, "FullSize", "1111");
      assertEquals(new Integer(fullSize), ServerManagement.getAttribute(destObjectName, "FullSize"));
      ServerManagement.setAttribute(destObjectName, "PageSize", "222");
      assertEquals(new Integer(pageSize), ServerManagement.getAttribute(destObjectName, "PageSize"));
      ServerManagement.setAttribute(destObjectName, "DownCacheSize", "33");
      assertEquals(new Integer(downCacheSize), ServerManagement.getAttribute(destObjectName, "DownCacheSize"));
     
      // Stop the destination and change the value then test them from MBean
      ServerManagement.invoke(destObjectName, "stop", null, null);
      ServerManagement.setAttribute(destObjectName, "DownCacheSize", "9999");
      assertEquals(new Integer(9999), ServerManagement.getAttribute(destObjectName, "DownCacheSize"));
      ServerManagement.setAttribute(destObjectName, "PageSize", "20019");
      assertEquals(new Integer(20019), ServerManagement.getAttribute(destObjectName, "PageSize"));
      ServerManagement.setAttribute(destObjectName, "FullSize", "751119");
      assertEquals(new Integer(751119), ServerManagement.getAttribute(destObjectName, "FullSize"));
      // Start the service again and test the value from core destination
      ServerManagement.invoke(destObjectName, "start", null, null);
     
      mDest = ServerManagement.getDestinationManager().getDestination(jbd2.getName(), jbd2.isQueue());
     
      // Must get the new core destination!     
      assertEquals(751119, mDest.getFullSize());
      assertEquals(20019, mDest.getPageSize());
      assertEquals(9999, mDest.getDownCacheSize());
View Full Code Here

      String consumerID = GUIDGenerator.generateGUID();

      int prefetchSize = connectionEndpoint.getPrefetchSize();

      JBossDestination dest = new JBossQueue(queueName);

      //We don't care about redelivery delays for a direct consumer
      //We do care about number of attempts, see JBMESSAGING-1774
      ServerConsumerEndpoint ep =
         new ServerConsumerEndpoint(consumerID, binding.queue,
View Full Code Here

TOP

Related Classes of org.jboss.jms.destination.JBossDestination

Copyright © 2018 www.massapicom. 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.