Package javax.jms

Examples of javax.jms.InvalidDestinationException


      ManagedDestination mDest = dm.getDestination(jmsDestination.getName(), jmsDestination.isQueue());

      if (mDest == null)
      {
         throw new InvalidDestinationException("No such destination: " + jmsDestination + " has it been deployed?");
      }

      if (jmsDestination.isTemporary())
      {
         // Can only create a consumer for a temporary destination on the same connection
         // that created it
         if (!connectionEndpoint.hasTemporaryDestination(jmsDestination))
         {
            String msg = "Cannot create a message consumer on a different connection " +
                         "to that which created the temporary destination";
            throw new IllegalStateException(msg);
         }
      }

      String consumerID = GUIDGenerator.generateGUID();

      // Always validate the selector first
      Selector selector = null;

      if (selectorString != null)
      {
         selector = new Selector(selectorString);
      }

      Queue queue;

      if (jmsDestination.isTopic())
      {
         if (subscriptionName == null)
         {
            // non-durable subscription
            if (log.isTraceEnabled()) { log.trace(this + " creating new non-durable subscription on " + jmsDestination); }

            // Create the non durable sub

            queue = new MessagingQueue(nodeId, GUIDGenerator.generateGUID(),
                                idm.getID(), ms, pm, false,
                                mDest.getMaxSize(), selector,
                                mDest.getFullSize(),
                                mDest.getPageSize(),
                                mDest.getDownCacheSize(),
                                mDest.isClustered(),
                                sp.getRecoverDeliveriesTimeout());

            JMSCondition topicCond = new JMSCondition(false, jmsDestination.getName());

            postOffice.addBinding(new Binding(topicCond, queue, false), false);

            queue.activate();

            String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queue.getName();

            int dayLimitToUse = mDest.getMessageCounterHistoryDayLimit();
            if (dayLimitToUse == -1)
            {
               //Use override on server peer
               dayLimitToUse = sp.getDefaultMessageCounterHistoryDayLimit();
            }

            //We don't create message counters on temp topics
            if (!mDest.isTemporary())
            {
              MessageCounter counter =  new MessageCounter(counterName, null, queue, true, false, dayLimitToUse);

              sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
            }
         }
         else
         {
            if (jmsDestination.isTemporary())
            {
               throw new InvalidDestinationException("Cannot create a durable subscription on a temporary topic");
            }

            // We have a durable subscription, look it up
            String clientID = connectionEndpoint.getClientID();
            if (clientID == null)
View Full Code Here


         throw new IllegalStateException("Session is closed");
      }

      if (jmsDestination == null)
      {
         throw new InvalidDestinationException("null destination");
      }

      if (jmsDestination.isTopic())
      {
         throw new IllegalStateException("Cannot browse a topic");
View Full Code Here

               DestinationManager dm = serverPeer.getDestinationManager();

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

               dm.unregisterDestination(mDest);
            }
View Full Code Here

   QueueSession getQueueSessionInternal() throws JMSException
   {
      Session s = getSessionInternal();
      if (!(s instanceof QueueSession))
      {
         throw new InvalidDestinationException("Attempting to use QueueSession methods on: " + this);
      }
      return (QueueSession)s;
   }
View Full Code Here

   TopicSession getTopicSessionInternal() throws JMSException
   {
      Session s = getSessionInternal();
      if (!(s instanceof TopicSession))
      {
         throw new InvalidDestinationException("Attempting to use TopicSession methods on: " + this);
      }
      return (TopicSession)s;
   }
View Full Code Here

   {
      checkClosed();

      if (destination != null && !(destination instanceof HornetQDestination))
      {
         throw new InvalidDestinationException("Not a JBoss Destination:" + destination);
      }

      message.setJMSDeliveryMode(defaultDeliveryMode);

      message.setJMSPriority(defaultPriority);
View Full Code Here

   {
      checkClosed();

      if (destination != null && !(destination instanceof HornetQDestination))
      {
         throw new InvalidDestinationException("Not a JBoss Destination:" + destination);
      }

      message.setJMSDeliveryMode(deliveryMode);

      message.setJMSPriority(priority);
View Full Code Here

   public MessageProducer createProducer(final Destination destination) throws JMSException
   {
      if (destination != null && !(destination instanceof HornetQDestination))
      {
         throw new InvalidDestinationException("Not a JBoss Destination:" + destination);
      }

      try
      {
         HornetQDestination jbd = (HornetQDestination)destination;

         if (jbd != null)
         {
            BindingQuery response = session.bindingQuery(jbd.getSimpleAddress());

            if (!response.isExists())
            {
               throw new InvalidDestinationException("Destination " + jbd.getName() + " does not exist");
            }
         }

         ClientProducer producer = session.createProducer(jbd == null ? null : jbd.getSimpleAddress());
View Full Code Here

                                         final String messageSelector,
                                         final boolean noLocal) throws JMSException
   {
      if (destination == null)
      {
         throw new InvalidDestinationException("Cannot create a consumer with a null destination");
      }

      if (!(destination instanceof HornetQDestination))
      {
         throw new InvalidDestinationException("Not a HornetQDestination:" + destination);
      }

      HornetQDestination jbdest = (HornetQDestination)destination;

      if (jbdest.isTemporary() && !connection.containsTemporaryQueue(jbdest.getSimpleAddress()))
View Full Code Here

      {
         throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession");
      }
      if (topic == null)
      {
         throw new InvalidDestinationException("Cannot create a durable subscriber on a null topic");
      }
      if (!(topic instanceof HornetQDestination))
      {
         throw new InvalidDestinationException("Not a HornetQTopic:" + topic);
      }
      if ("".equals(messageSelector))
      {
         messageSelector = null;
      }

      HornetQDestination jbdest = (HornetQDestination)topic;
     
      if (jbdest.isQueue())
      {
         throw new InvalidDestinationException("Cannot create a subscriber on a queue");
      }

      return createConsumer(jbdest, name, messageSelector, noLocal);
   }
View Full Code Here

TOP

Related Classes of javax.jms.InvalidDestinationException

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.