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.