Search in sources :

Example 1 with CommandHandler

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()));
}
Also used : CommandHandler(com.kloia.eventapis.api.CommandHandler) CommandRecord(com.kloia.eventapis.pojos.CommandRecord) Before(org.aspectj.lang.annotation.Before)

Aggregations

CommandHandler (com.kloia.eventapis.api.CommandHandler)1 CommandRecord (com.kloia.eventapis.pojos.CommandRecord)1 Before (org.aspectj.lang.annotation.Before)1