Examples: Channel Import
This page contains example interceptors that can be registered with Channel Import module.
The following interceptor is intended to be used within the Channel Import module as a starter interceptor. The purpose of the pointcut is to provide customers with the capability to inspect, modify or reject messages being processed by the module.
/*-
* #%L
* Smile CDR - CDR
* %%
* Copyright (C) 2016 - 2024 Smile CDR, Inc.
* %%
* All rights reserved.
* #L%
*/
package com.smilecdr.demo.channelimport;
import ca.cdr.api.fhir.interceptor.CdrHook;
import ca.cdr.api.fhir.interceptor.CdrPointcut;
import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.rest.server.messaging.json.ResourceOperationJsonMessage;
import ca.uhn.fhir.util.StopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Sample Channel Import Interceptor implementing all CHANNEL_IMPORT_MESSAGE_PRE_PROCESSED pointcuts.
* It is intended to be used in CHANNEL IMPORT module 'Interceptor Bean Types'.
* Can be used as a starting point for your channel import interceptor.
*/
@SuppressWarnings({"unused", "EmptyTryBlock"})
@Interceptor
public class ChannelImportInterceptorTemplate {
private static final Logger ourLog = LoggerFactory.getLogger(ChannelImportInterceptorTemplate.class);
@CdrHook(CdrPointcut.CHANNEL_IMPORT_MESSAGE_PRE_PROCESSED)
public Boolean channelImportMessagePreProcessed(
ResourceOperationJsonMessage theMsg) {
ourLog.info("Interceptor CHANNEL_IMPORT_MESSAGE_PRE_PROCESSED - started");
StopWatch stopWatch = new StopWatch();
try {
// your implementation goes here
}
finally {
ourLog.info("Interceptor CHANNEL_IMPORT_MESSAGE_PRE_PROCESSED - ended, execution took {}", stopWatch);
}
// should return a boolean indicating whether to proceed
return null;
}
}