class VersionReturningAggregateAnnotationCommandHandler<T> extends AggregateAnnotationCommandHandler<T> {
public VersionReturningAggregateAnnotationCommandHandler(Class<T> aggregateType, Repository<T> repository) {
super(aggregateType, repository, new AnnotationCommandTargetResolver());
}
@Override
protected Object resolveReturnValue(CommandMessage<?> command, Aggregate<T> createdAggregate) {
return new VersionedAggregateIdentifier(createdAggregate.identifier().toString(), createdAggregate.version());
}
}
@Autowired
public void configure(AxonConfiguration configuration) {
for(ModuleConfiguration module : configuration.getModules()) {
if(module instanceof AggregateConfigurer<?>) {
AggregateConfigurer<?> aggregateConfigurer = (AggregateConfigurer<?>)module;
aggregateConfigurer.configureCommandHandler(c -> new VersionReturningAggregateAnnotationCommandHandler(
aggregateConfigurer.aggregateType(), aggregateConfigurer.repository()));
}
}
}
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@Override
public <T> MessageHandlingMember<T> wrapHandler(MessageHandlingMember<T> original)
{
return original.annotationAttributes(CommandHandler.class)
.map(attr -> (MessageHandlingMember<T>) new MethodCommandMessageHandlingMember<>(original, attr))
.orElse(original);
}
private static class MethodCommandMessageHandlingMember<T> extends WrappedMessageHandlingMember<T>
{
private MethodCommandMessageHandlingMember(MessageHandlingMember<T> delegate, Map<String, Object> annotationAttributes)
{
super(delegate);
}
}
To unsubscribe from this group and stop receiving emails from it, send an email to axonfr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.