Package org.jboss.jms.delegate

Examples of org.jboss.jms.delegate.ConsumerDelegate


   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(),
                            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


   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(),
                            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

   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(),
                            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

   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 =
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 =
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

/* 232 */       throw new InvalidDestinationException("Not a JBossDestination:" + d);
/*     */     }
/*     */
/* 235 */     log.trace("attempting to create consumer for destination:" + d + (messageSelector == null ? "" : new StringBuilder().append(", messageSelector: ").append(messageSelector).toString()) + (noLocal ? ", noLocal = true" : ""));
/*     */
/* 237 */     ConsumerDelegate cd = this.delegate.createConsumerDelegate((JBossDestination)d, messageSelector, noLocal, null, false, true);
/*     */
/* 240 */     return new JBossMessageConsumer(cd);
/*     */   }
View Full Code Here

/* 274 */     if (!(topic instanceof JBossTopic))
/*     */     {
/* 276 */       throw new InvalidDestinationException("Not a JBossTopic:" + topic);
/*     */     }
/*     */
/* 279 */     ConsumerDelegate cd = this.delegate.createConsumerDelegate((JBossTopic)topic, null, false, name, false, true);
/*     */
/* 282 */     return new JBossMessageConsumer(cd);
/*     */   }
View Full Code Here

/* 304 */     if ("".equals(messageSelector))
/*     */     {
/* 306 */       messageSelector = null;
/*     */     }
/*     */
/* 309 */     ConsumerDelegate cd = this.delegate.createConsumerDelegate((JBossTopic)topic, messageSelector, noLocal, name, false, true);
/*     */
/* 312 */     return new JBossMessageConsumer(cd);
/*     */   }
View Full Code Here

/*     */   public Object handleCreateConsumerDelegate(Invocation invocation)
/*     */     throws Throwable
/*     */   {
/*  71 */     MethodInvocation mi = (MethodInvocation)invocation;
/*     */
/*  73 */     ConsumerDelegate consumerDelegate = (ConsumerDelegate)invocation.invokeNext();
/*     */
/*  75 */     boolean isCC = ((Boolean)mi.getArguments()[4]).booleanValue();
/*     */
/*  78 */     SessionState sessionState = (SessionState)((DelegateSupport)invocation.getTargetObject()).getState();
/*     */
/*  80 */     ConnectionState connectionState = (ConnectionState)sessionState.getParent();
/*  81 */     SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
/*  82 */     ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
/*  83 */     String consumerID = consumerState.getConsumerID();
/*  84 */     int prefetchSize = consumerState.getBufferSize();
/*  85 */     QueuedExecutor sessionExecutor = sessionState.getExecutor();
/*  86 */     int maxDeliveries = consumerState.getMaxDeliveries();
/*  87 */     long redeliveryDelay = consumerState.getRedeliveryDelay();
/*     */
/*  90 */     String queueName = null;
/*  91 */     if (consumerState.getSubscriptionName() != null)
/*     */     {
/*  98 */       queueName = MessageQueueNameHelper.createSubscriptionName(((ConnectionDelegate)connectionState.getDelegate()).getClientID(), consumerState.getSubscriptionName());
/*     */     }
/* 102 */     else if (consumerState.getDestination().isQueue())
/*     */     {
/* 104 */       queueName = consumerState.getDestination().getName();
/*     */     }
/*     */
/* 107 */     boolean autoFlowControl = ((Boolean)mi.getArguments()[5]).booleanValue();
/*     */
/* 109 */     ClientConsumer messageHandler = new ClientConsumer(isCC, sessionState.getAcknowledgeMode(), sessionDelegate, consumerDelegate, consumerID, queueName, prefetchSize, sessionExecutor, maxDeliveries, consumerState.isShouldAck(), autoFlowControl, redeliveryDelay);
/*     */
/* 115 */     sessionState.addCallbackHandler(messageHandler);
/*     */
/* 117 */     CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
/* 118 */     cm.registerHandler(consumerID, messageHandler);
/*     */
/* 120 */     consumerState.setClientConsumer(messageHandler);
/*     */
/* 122 */     if (autoFlowControl)
/*     */     {
/* 126 */       consumerDelegate.changeRate(1.0F);
/*     */     }
/*     */
/* 129 */     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.