congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
AggregateAnnotationCommandHandler
Code IndexAdd Tabnine to your IDE (free)

How to use
AggregateAnnotationCommandHandler
in
org.axonframework.modelling.command

Best Java code snippets using org.axonframework.modelling.command.AggregateAnnotationCommandHandler (Showing top 12 results out of 315)

origin: AxonFramework/AxonFramework

private void registerAggregateCommandHandlers() {
  ensureRepositoryConfiguration();
  if (!explicitCommandHandlersSet) {
    AggregateAnnotationCommandHandler.Builder<T> builder = AggregateAnnotationCommandHandler.<T>builder()
        .aggregateType(aggregateType)
        .parameterResolverFactory(parameterResolverFactory)
        .repository(this.repository);
    if (commandTargetResolver != null) {
      builder.commandTargetResolver(commandTargetResolver);
    }
    AggregateAnnotationCommandHandler<T> handler = builder.build();
    handler.subscribe(commandBus);
  }
}
origin: AxonFramework/AxonFramework

/**
 * Initializes a {@link AggregateAnnotationCommandHandler} as specified through this Builder.
 *
 * @return a {@link AggregateAnnotationCommandHandler} as specified through this Builder
 */
public AggregateAnnotationCommandHandler<T> build() {
  return new AggregateAnnotationCommandHandler<>(this);
}
origin: AxonFramework/AxonFramework

/**
 * Instantiate a {@link AggregateAnnotationCommandHandler} based on the fields contained in the {@link Builder}.
 * <p>
 * Will assert that the {@link Repository} and {@link CommandTargetResolver} are not {@code null}, and will throw
 * an {@link AxonConfigurationException} if either of them is {@code null}. Next to that, the provided Builder's
 * goal is to create an {@link AggregateModel} (describing the structure of a given aggregate). To instantiate this
 * AggregateModel, either an {@link AggregateModel} can be provided directly or an {@code aggregateType} of type
 * {@link Class} can be used. The latter will internally resolve to an AggregateModel. Thus, either the
 * AggregateModel <b>or</b> the {@code aggregateType} should be provided. An AxonConfigurationException is thrown
 * if this criteria is not met.
 *
 * @param builder the {@link Builder} used to instantiate a {@link AggregateAnnotationCommandHandler} instance
 */
protected AggregateAnnotationCommandHandler(Builder<T> builder) {
  builder.validate();
  this.repository = builder.repository;
  this.commandTargetResolver = builder.commandTargetResolver;
  this.supportedCommandNames = new HashSet<>();
  this.handlers = initializeHandlers(builder.buildAggregateModel());
}
origin: AxonFramework/AxonFramework

@Override
public void start() {
  registrations.add(commandHandler.get().subscribe(parent.commandBus()));
}
origin: AxonFramework/AxonFramework

    });
commandHandler = new Component<>(() -> parent, "aggregateCommandHandler<" + aggregate.getSimpleName() + ">",
                 c -> AggregateAnnotationCommandHandler.<A>builder()
                     .repository(repository.get())
                     .commandTargetResolver(commandTargetResolver.get())
origin: AxonFramework/AxonFramework

/**
 * Subscribe this command handler to the given {@code commandBus}. The command handler will be subscribed
 * for each of the supported commands.
 *
 * @param commandBus The command bus instance to subscribe to
 * @return A handle that can be used to unsubscribe
 */
public Registration subscribe(CommandBus commandBus) {
  List<Registration> subscriptions = supportedCommandNames()
      .stream()
      .map(supportedCommand -> commandBus.subscribe(supportedCommand, this))
      .filter(Objects::nonNull).collect(Collectors.toList());
  return () -> subscriptions.stream().map(Registration::cancel).reduce(Boolean::logicalOr).orElse(false);
}
origin: org.axonframework/axon-configuration

@Override
public void start() {
  registrations.add(commandHandler.get().subscribe(parent.commandBus()));
}
origin: org.axonframework/axon-configuration

    });
commandHandler = new Component<>(() -> parent, "aggregateCommandHandler<" + aggregate.getSimpleName() + ">",
                 c -> AggregateAnnotationCommandHandler.<A>builder()
                     .repository(repository.get())
                     .commandTargetResolver(commandTargetResolver.get())
origin: org.axonframework/axon-modelling

/**
 * Subscribe this command handler to the given {@code commandBus}. The command handler will be subscribed
 * for each of the supported commands.
 *
 * @param commandBus The command bus instance to subscribe to
 * @return A handle that can be used to unsubscribe
 */
public Registration subscribe(CommandBus commandBus) {
  Collection<Registration> subscriptions = new ArrayList<>();
  for (String supportedCommand : supportedCommandNames()) {
    Registration subscription = commandBus.subscribe(supportedCommand, this);
    if (subscription != null) {
      subscriptions.add(subscription);
    }
  }
  return () -> {
    subscriptions.forEach(Registration::cancel);
    return true;
  };
}
origin: AxonFramework/AxonFramework

@SuppressWarnings("unchecked")
@Before
public void setUp() {
  eventStore = spy(EmbeddedEventStore.builder().storageEngine(new InMemoryEventStorageEngine()).build());
  Repository<MyAggregate> myAggregateRepository = EventSourcingRepository.builder(MyAggregate.class)
                                      .eventStore(eventStore)
                                      .build();
  CommandBus commandBus = SimpleCommandBus.builder().build();
  commandGateway = DefaultCommandGateway.builder().commandBus(commandBus).build();
  AggregateAnnotationCommandHandler<MyAggregate> myAggregateCommandHandler =
      AggregateAnnotationCommandHandler.<MyAggregate>builder()
          .aggregateType(MyAggregate.class)
          .repository(myAggregateRepository)
          .build();
  myAggregateCommandHandler.subscribe(commandBus);
}
origin: org.axonframework/axon-modelling

/**
 * Initializes a {@link AggregateAnnotationCommandHandler} as specified through this Builder.
 *
 * @return a {@link AggregateAnnotationCommandHandler} as specified through this Builder
 */
public AggregateAnnotationCommandHandler<T> build() {
  return new AggregateAnnotationCommandHandler<>(this);
}
origin: org.axonframework/axon-modelling

/**
 * Instantiate a {@link AggregateAnnotationCommandHandler} based on the fields contained in the {@link Builder}.
 * <p>
 * Will assert that the {@link Repository} and {@link CommandTargetResolver} are not {@code null}, and will throw
 * an {@link AxonConfigurationException} if either of them is {@code null}. Next to that, the provided Builder's
 * goal is to create an {@link AggregateModel} (describing the structure of a given aggregate). To instantiate this
 * AggregateModel, either an {@link AggregateModel} can be provided directly or an {@code aggregateType} of type
 * {@link Class} can be used. The latter will internally resolve to an AggregateModel. Thus, either the
 * AggregateModel <b>or</b> the {@code aggregateType} should be provided. An AxonConfigurationException is thrown
 * if this criteria is not met.
 *
 * @param builder the {@link Builder} used to instantiate a {@link AggregateAnnotationCommandHandler} instance
 */
protected AggregateAnnotationCommandHandler(Builder<T> builder) {
  builder.validate();
  this.repository = builder.repository;
  this.commandTargetResolver = builder.commandTargetResolver;
  this.supportedCommandNames = new HashSet<>();
  this.handlers = initializeHandlers(builder.buildAggregateModel());
}
org.axonframework.modelling.commandAggregateAnnotationCommandHandler

Javadoc

Command handler that handles commands based on CommandHandler annotations on an aggregate. Those annotations may appear on methods, in which case a specific aggregate instance needs to be targeted by the command, or on the constructor. The latter will create a new Aggregate instance, which is then stored in the repository.

Most used methods

  • builder
    Instantiate a Builder to be able to create a AggregateAnnotationCommandHandler. The CommandTargetRe
  • subscribe
    Subscribe this command handler to the given commandBus. The command handler will be subscribed for e
  • <init>
    Instantiate a AggregateAnnotationCommandHandler based on the fields contained in the Builder. Will a
  • initializeHandlers
  • supportedCommandNames

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JFileChooser (javax.swing)
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now