use of com.kloia.eventapis.api.CommandHandler in project eventapis by kloiasoft.
the class CommandExecutionInterceptor method before.
@Before("this(com.kloia.eventapis.api.CommandHandler) && @annotation(command)")
public void before(JoinPoint jp, Command command) throws Throwable {
Object target = jp.getTarget();
if (!(target instanceof CommandHandler))
throw new IllegalArgumentException("Point is not Instance of CommandHandler");
CommandHandler commandHandler = (CommandHandler) target;
long commandTimeout = command.commandTimeout();
// Ability to generate new Context
operationContext.startNewContext(commandTimeout);
operationContext.setCommandContext(target.getClass().getSimpleName());
CommandRecord commandDto = recordCommand(jp, commandHandler, command);
log.debug("before method:" + (commandDto == null ? "" : commandDto.toString()));
}
Aggregations