All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vlingo.lattice.model.process.Process Maven / Gradle / Ivy

Go to download

Tooling for reactive Domain-Driven Design projects that are highly concurrent. Includes compute grid, actor caching, spaces, cross-node cluster messaging, CQRS, and Event Sourcing support.

There is a newer version: 1.7.5
Show newest version
// Copyright © 2012-2020 VLINGO LABS. All rights reserved.
//
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain
// one at https://mozilla.org/MPL/2.0/.

package io.vlingo.lattice.model.process;

import java.util.List;
import java.util.function.Supplier;

import io.vlingo.common.Completes;
import io.vlingo.lattice.model.Command;
import io.vlingo.lattice.model.DomainEvent;
import io.vlingo.symbio.Source;

/**
 * Definition for a long-running process.
 * @param  my state type
 */
public interface Process {
  /**
   * Answer my state as a {@code Chronicle}.
   * @return {@code Chronicle}
   */
  Chronicle chronicle();

  /**
   * Answer my id, which is used for correlation among my collaborators.
   * @return String
   */
  String id();

  /**
   * Cause the {@code command} to be processed by persisting it as a {@code ProcessMessage}.
   * 

* Uses the underlying persistence mechanism to * ensure the {@code command} is permanent, enabling * a backing {@code Exchange} message to be enqueued * with guaranteed delivery semantics. * @param command the Command to apply */ void process(final Command command); /** * Answer {@code Completes}, while causing the {@code command} to be processed by persisting * it as a {@code ProcessMessage}, followed by the execution of a possible {@code andThen}. *

* Uses the underlying persistence mechanism to * ensure the {@code command} is permanent, enabling * a backing {@code Exchange} message to be enqueued * with guaranteed delivery semantics. * @param command the Command to apply * @param andThen the {@code Supplier} executed following the application of command * @param the return type of the andThen {@code Supplier} * @return {@code Completes} */ Completes process(final Command command, final Supplier andThen); /** * Cause the {@code event} to be processed by persisting it as a {@code ProcessMessage}. *

* Uses the underlying persistence mechanism to * ensure the {@code event} is permanent, enabling * a backing {@code Exchange} message to be enqueued * with guaranteed delivery semantics. * @param event the DomainEvent to apply */ void process(final DomainEvent event); /** * Answer {@code Completes}, while causing the {@code event} to be processed by persisting * it as a {@code ProcessMessage}, followed by the execution of a possible {@code andThen}. *

* Uses the underlying persistence mechanism to * ensure the {@code event} is permanent, enabling * a backing {@code Exchange} message to be enqueued * with guaranteed delivery semantics. * @param event the DomainEvent to apply * @param andThen the {@code Supplier} executed following the application of event * @param the return type of the andThen {@code Supplier} * @return {@code Completes} */ Completes process(final DomainEvent event, final Supplier andThen); /** * Cause the {@code sources} to be processed by persisting each as a {@code ProcessMessage}. *

* Uses the underlying persistence mechanism to * ensure the {@code sources} are permanent, enabling * a backing {@code Exchange} message to be enqueued * with guaranteed delivery semantics. * @param sources the {@code List>} of source instances to apply * @param the type of Source */ void processAll(final List> sources); /** * Answer {@code Completes}, while causing the {@code sources} to be processed by persisting * each as a {@code ProcessMessage}, followed by the execution of a possible {@code andThen}. *

* Uses the underlying persistence mechanism to * ensure the {@code sources} are permanent, enabling * a backing {@code Exchange} message to be enqueued * with guaranteed delivery semantics. * Emit all {@code sources} by applying them to myself, followed by * the execution of a possible {@code andThen}. * @param sources the {@code List>} of source instances to apply * @param andThen the {@code Supplier} executed following the application of sources * @param the type of Source * @param the return type of the andThen {@code Supplier} * @return {@code Completes} */ Completes processAll(final List> sources, final Supplier andThen); /** * Send the {@code command} to my collaborators via my Exchange. *

* Note that this is not expected to initially * persist the {@code command} to the underlying {@code Journal}. * Thus, the {@code command} is subject to the limitations of the * underlying {@code Exchange} mechanism, such as downed nodes * and network partitions/disconnections. * @param command the Command to send */ void send(final Command command); /** * Send the {@code event} to my collaborators via my Exchange. *

* Note that this is not expected to initially * persist the {@code event} to the underlying {@code Journal}. * Thus, the {@code event} is subject to the limitations of the * underlying {@code Exchange} mechanism, such as downed nodes * and network partitions/disconnections. * @param event the DomainEvent to apply */ void send(final DomainEvent event); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy