cm.registerHandler(consumerID, messageHandler);
cm.registerHandler(serverId, consumerID, messageHandler);
   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();      int consumerID = consumerState.getConsumerID();      int prefetchSize = consumerState.getPrefetchSize();      QueuedExecutor sessionExecutor = sessionState.getExecutor();            MessageCallbackHandler messageHandler =         new MessageCallbackHandler(isCC, sessionState.getAcknowledgeMode(),                                    sessionDelegate, consumerDelegate, consumerID,                                    prefetchSize, sessionExecutor);            sessionState.addCallbackHandler(messageHandler);            CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();      cm.registerHandler(consumerID, messageHandler);               consumerState.setMessageCallbackHandler(messageHandler);            //Now we have finished creating the client consumer, we can tell the SCD      //we are ready      consumerDelegate.more();            return consumerDelegate;   }