metaData.addMetaData(InvokerInterceptor.REMOTING, InvokerInterceptor.CLIENT, client, PayloadKey.TRANSIENT);
invocationMetaData.addMetaData(InvokerInterceptor.REMOTING, InvokerInterceptor.CLIENT, client, PayloadKey.TRANSIENT);
   public Object invoke(Invocation invocation) throws Throwable   {      if (invocation instanceof MethodInvocation)      {         MethodInvocation mi = (MethodInvocation)invocation;         Method m = mi.getMethod();         if (m.getName().equals("createConsumerDelegate"))         {            // register/unregister a callback handler that deal with callbacks sent by the server            InvokerLocator locator =                  (InvokerLocator)invocation.getMetaData(InvokerInterceptor.REMOTING,                                                         InvokerInterceptor.INVOKER_LOCATOR);            if (locator == null)            {               throw new RuntimeException("No InvokerLocator supplied.  Can't invoke remotely!");            }            String subsystem = (String)invocation.getMetaData(InvokerInterceptor.REMOTING,                                                              InvokerInterceptor.SUBSYSTEM);            if (subsystem == null)            {               throw new RuntimeException("No subsystem supplied.  Can't invoke remotely!");            }            Client client = new Client(locator, subsystem);								SimpleMetaData metaData = invocation.getMetaData();				            MessageCallbackHandler msgHandler = new MessageCallbackHandler();				            client.addListener(msgHandler, Remoting.getCallbackServer().getLocator());                        // I created the client already, pass it along to be used by the InvokerInterceptor            metaData.addMetaData(InvokerInterceptor.REMOTING, InvokerInterceptor.CLIENT,                                 client, PayloadKey.TRANSIENT);            // I will need this on the server-side to create the ConsumerDelegate instance            metaData.addMetaData(JMSAdvisor.JMS, JMSAdvisor.REMOTING_SESSION_ID,                                 client.getSessionId(), PayloadKey.AS_IS);            Object consumerDelegate = invocation.invokeNext();            JMSConsumerInvocationHandler ih =                  (JMSConsumerInvocationHandler)Proxy.getInvocationHandler(consumerDelegate);            ih.setMessageHandler(msgHandler);								msgHandler.setSessionDelegate(getDelegate(invocation));				msgHandler.setReceiverID((String)ih.getMetaData().                                             getMetaData(JMSAdvisor.JMS, JMSAdvisor.CONSUMER_ID));            return consumerDelegate;         }      }      return invocation.invokeNext();   }