Package org.jboss.jms.delegate

Examples of org.jboss.jms.delegate.ConsumerDelegate


         throw new InvalidDestinationException("Not a JBossDestination:" + d);
      }

      log.trace("attempting to create consumer for destination:" + d + (messageSelector == null ? "" : ", messageSelector: " + messageSelector) + (noLocal ? ", noLocal = true" : ""));

      ConsumerDelegate cd = delegate.
         createConsumerDelegate((JBossDestination)d, messageSelector, noLocal, null, false, true);

      return new JBossMessageConsumer(cd);
   }
View Full Code Here


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

      ConsumerDelegate cd =
         delegate.createConsumerDelegate((JBossTopic)topic, null, false, name, false, true);

      return new JBossMessageConsumer(cd);
   }
View Full Code Here

      if ("".equals(messageSelector))
      {
         messageSelector = null;
      }

      ConsumerDelegate cd = delegate.
         createConsumerDelegate((JBossTopic)topic, messageSelector, noLocal, name, false, true);

      return new JBossMessageConsumer(cd);
   }
View Full Code Here

   public Object handleCreateConsumerDelegate(Invocation invocation) throws Throwable
   {
      MethodInvocation mi = (MethodInvocation)invocation;

      ConsumerDelegate consumerDelegate = (ConsumerDelegate)invocation.invokeNext();

      boolean isCC = ((Boolean)mi.getArguments()[4]).booleanValue();

      // Create the message handler
      SessionState sessionState =
         (SessionState)((DelegateSupport)invocation.getTargetObject()).getState();
      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
      SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
      ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
      String consumerID = consumerState.getConsumerID();
      int prefetchSize = consumerState.getBufferSize();
      QueuedExecutor sessionExecutor = sessionState.getExecutor();
      int maxDeliveries = consumerState.getMaxDeliveries();
      long redeliveryDelay = consumerState.getRedeliveryDelay();
     
      //We need the queue name for recovering any deliveries after failover
      String queueName = null;
      if (consumerState.getSubscriptionName() != null)
      {
         // I have to use the clientID from connectionDelegate instead of connectionState...
         // this is because when a pre configured CF is used we need to get the clientID from
         // server side.
         // This was a condition verified by the TCK and it was fixed as part of
         // http://jira.jboss.com/jira/browse/JBMESSAGING-939
         queueName = MessageQueueNameHelper.
            createSubscriptionName(((ConnectionDelegate)connectionState.getDelegate()).getClientID(),
                                   consumerState.getSubscriptionName());
      }
      else if (consumerState.getDestination().isQueue())
      {
         queueName = consumerState.getDestination().getName();
      }
     
      boolean autoFlowControl = ((Boolean)mi.getArguments()[5]).booleanValue();
     
      ClientConsumer messageHandler =
         new ClientConsumer(isCC, sessionState.getAcknowledgeMode(),
                            sessionDelegate, consumerDelegate, consumerID, queueName,
                            prefetchSize, sessionExecutor, maxDeliveries, consumerState.isShouldAck(),
                            autoFlowControl, redeliveryDelay);
     
      sessionState.addCallbackHandler(messageHandler);
     
      CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
      cm.registerHandler(consumerID, messageHandler);
        
      consumerState.setClientConsumer(messageHandler);
     
      if (autoFlowControl)
      {
        //Now we have finished creating the client consumer, we can tell the SCD
        //we are ready
        consumerDelegate.changeRate(1);
      }

      return consumerDelegate;
   }
View Full Code Here

TOP

Related Classes of org.jboss.jms.delegate.ConsumerDelegate

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.