@ Override public void process ( Request request ) { String correlationId = request . getHeader ( CORRELATION_ID ) ; // Generation on empty causes problems, since the request already has a value for Correlation-Id in this case. // The method call request.addHeader() only adds ANOTHER header to the request and doesn't fix the problem. // Currently then, the plugin only adds the header if it doesn't exist, assuming that if a client sets the // header to ANYTHING, that's the correlation ID they desired. if ( correlationId == null ) // || correlationId.trim().isEmpty()) { correlationId = UUID . randomUUID ( ) . toString ( ) ; } RequestContext . put ( CORRELATION_ID , correlationId ) ; request . addHeader ( CORRELATION_ID , correlationId ) ; }
Preprocessor method to pull the Correlation - Id header or assign one as well as placing it in the RequestContext .