Reputation: 303
I have Java EE REST API with Rabitt MQ.
The system will receive the message, create a unique ID, and publish it for processing.
I want to use the ContainerRequestFilter to intercept the HTTP request for logging purposes. In which I will publish to another queue for logging.
@Provider
@PreMatching
@LogHttp
public class LogInterceptor implements ContainerRequestFilter {
private static ThreadLocal<String> userContext=new ThreadLocal<>();
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
// create UID
// gather logging information and publish to queue
} }
I need to share the UID created to be used when data is received so that I can link between the message process and logging information.
I appreciate your help.
Upvotes: 2
Views: 87