0 Replies Latest reply on May 21, 2009 5:47 AM by Tomaž Ipavec

    How to pass/set ContextData to be available on interceptors

    Tomaž Ipavec Newbie

      I have 2 jboss instances. Clients connect to the first app1 on jboss1, which connects to the second app2 on jboss2 :

      client-> jboss 1 ->jboss2

      This means that each method that is invoked on jboss1 invokes some method(s) on jboss2. JBoss1 is just another client from Jboss2 point of view

      I have to log all user activity. Each jboss instance writes to it's own log file.
      I am ussing an interceptor to log all application's bean/method invocations on each jboss instance.

      public Object intercept(InvocationContext ctx) throws Exception {

      I want establish reliable corelation between jboss1 log and cluster jboss logs.

      How can I obtain client (jboss1) information on jboss2?

      Or, if that is not possible, how can I pass some context information from jboss1(app1) method to jboss2(app2) method, without explicitly changing method signature on app2?

      Ideally the information should be available on InvocationContext.getContextData() on the jboss2, but I don't know how to set contextdata on InvocationContext.

      Looking at InvocationContextImpl.java I can see that getContextData tries to get the metadata from ClientInterceptorUtil:
      metadata = ClientInterceptorUtil.getClientMetadataMap(wrapped);

      I don't know how/where to set the data to ClientInterceptorUtil.