[jboss-user] [Advanced Documentation] - How to pass/set ContextData to be available on interceptors

tomazi30 do-not-reply at jboss.com
Thu May 21 05:47:14 EDT 2009


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.

@AroundInvoke
	public Object intercept(InvocationContext ctx) throws Exception {
          ....
           log.info(ctx.getMethod().getName());
          ...
          ctx.proceed();
         }

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.


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4232443#4232443

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4232443



More information about the jboss-user mailing list