Class LogOutput
java.lang.Object
org.chenile.core.interceptors.BaseChenileInterceptor
org.chenile.core.interceptors.LogOutput
- All Implemented Interfaces:
Command<ChenileExchange>
Logs the output from the response object. This is required if the service is asynchronous i.e. its
response is not emitted back but needs to be used to keep track of success and failure by
logging the response into some medium (such as files, queues, topics etc.)
The original entry point (that constructed the ChenileExchange) can give us a callback to invoke or can ask us to log into a file. That can then be used to transmit the status to the original caller or displayed in a UI.
The original entry point (that constructed the ChenileExchange) can give us a callback to invoke or can ask us to log into a file. That can then be used to transmit the status to the original caller or displayed in a UI.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ExternalApiLogSupportprivate ExternalApiPropertiesprivate ExternalApiPublisherprivate static final Stringprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbypassInterception(ChenileExchange exchange) Over-ride this to bypass interception in special circumstancesprivate voidcopyParamHeaders(LogRecord record, ChenileExchange exchange) protected voiddoPostProcessing(ChenileExchange chenileExchange) Override this to do post processing.protected voiddoPreProcessing(ChenileExchange exchange) Override this to do pre-processing.private LongdurationMillis(ChenileExchange exchange) private LogRecordmakeLogRecord(ChenileExchange exchange) private voidpublishExternalApiRecord(ChenileExchange exchange, LogRecord record) Methods inherited from class BaseChenileInterceptor
doContinue, execute, getExtensionByAnnotation, getExtensionByAnnotation, resumeFromSavedPoint, savePoint
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
LOG_START_TIME
- See Also:
-
externalApiPublisher
-
externalApiLogSupport
-
externalApiProperties
-
-
Constructor Details
-
LogOutput
public LogOutput()
-
-
Method Details
-
doPreProcessing
Description copied from class:BaseChenileInterceptorOverride this to do pre-processing. This will be called before the service is invoked. Don't expect to see exception or response being set inChenileExchange. However you can check forChenileExchange.getBody()to manipulate the body if this interceptor is a Chenile post processor or a service specific or operation specific interceptor.
If this interceptor is a Chenile pre-processor, thenChenileExchange.getBody()will return null. Then you need to look at headers only.- Overrides:
doPreProcessingin classBaseChenileInterceptor- Parameters:
exchange-
-
doPostProcessing
Description copied from class:BaseChenileInterceptorOverride this to do post processing. This will be called even if there is an exception downstream. So make sure that if you don't want to do any processing in case of exception, check ifChenileExchange.getException()returns null value. If you happen to throw an exception in this method, it will get added to the set of errors that would ultimately be returned. See alsoChenileExchange.setException(Throwable)- Overrides:
doPostProcessingin classBaseChenileInterceptor- Parameters:
chenileExchange- Chenile Exchange
-
makeLogRecord
-
publishExternalApiRecord
-
copyParamHeaders
-
bypassInterception
Description copied from class:BaseChenileInterceptorOver-ride this to bypass interception in special circumstances- Overrides:
bypassInterceptionin classBaseChenileInterceptor- Parameters:
exchange-- Returns:
-
durationMillis
-