Skip to content
Permalink
Browse files
Provided example for hands-off command handler logging, and documented
 it's constraints.
  • Loading branch information
myrle-krantz committed Jul 10, 2017
1 parent 7a59849 commit 9e03ed87002217cca55d8d91823f95254432f75b
Showing 4 changed files with 27 additions and 2 deletions.
@@ -20,4 +20,9 @@ public class InitializeServiceCommand {
public InitializeServiceCommand() {
super();
}

@Override
public String toString() {
return "InitializeServiceCommand{}";
}
}
@@ -29,4 +29,11 @@ public SampleCommand(final Sample sample) {
public Sample sample() {
return this.sample;
}

@Override
public String toString() {
return "SampleCommand{" +
"sample=" + sample.getIdentifier() +
'}';
}
}
@@ -50,7 +50,7 @@ public MigrationAggregate(@Qualifier(ServiceConstants.LOGGER_NAME) final Logger
this.flywayFactoryBean = flywayFactoryBean;
}

@CommandHandler
@CommandHandler(logStart = CommandLogLevel.INFO, logFinish = CommandLogLevel.INFO)
@Transactional
@EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.INITIALIZE)
public String initialize(final InitializeServiceCommand initializeServiceCommand) {
@@ -17,6 +17,7 @@

import io.mifos.core.command.annotation.Aggregate;
import io.mifos.core.command.annotation.CommandHandler;
import io.mifos.core.command.annotation.CommandLogLevel;
import io.mifos.core.command.annotation.EventEmitter;
import io.mifos.template.api.v1.events.EventConstants;
import io.mifos.template.service.internal.command.SampleCommand;
@@ -37,7 +38,19 @@ public SampleAggregate(final SampleJpaEntityRepository sampleJpaEntityRepository
this.sampleJpaEntityRepository = sampleJpaEntityRepository;
}

@CommandHandler
//TODO: Think about your command handler logging, then delete this comment.
// The log levels provided in the command handler cause log messages to be emitted each time this
// command handler is called before and after the call. Before the call, the command is logged
// using its toString() method, and after the call, the emitted event is logged via its toString()
// method.
//
// If you wish to adjust the information in the log messages, do so via the toString() methods.
// Financial transactions, passwords, and customer address data are examples of information which
// should not be placed in the logs.
//
// If a command handler should not emit a log message, change logStart and logFinish to:
// CommandLogLevel.NONE.
@CommandHandler(logStart = CommandLogLevel.INFO, logFinish = CommandLogLevel.INFO)
@Transactional
@EventEmitter(selectorName = EventConstants.SELECTOR_NAME, selectorValue = EventConstants.POST_SAMPLE)
public String sample(final SampleCommand sampleCommand) {

0 comments on commit 9e03ed8

Please sign in to comment.