Infinitic Documentation

website·Indexed 32 days ago

https://docs.infinitic.io

Documentation for Infinitic, a distributed task and workflow orchestration engine. It covers the implementation of services and workflows using Java or Kotlin, worker configuration, batch processing (introduced in v0.16.2), and integration with Apache Pulsar and various databases. The guides include details on service executors, asynchronous tasks, saga workflows, and versioning, with the latest releases reaching v0.18.4.

Tokens
33.2K
Snippets
78
Records
260
Agent score
63%

What's inside Infinitic

  1. Overview of Infinitic Durable Execution

    Infinitic is a durable execution framework designed for building complex, time-dependent, or dynamic business processes (such as e-commerce inventory, financial transactions, or subscription billing) that must withstand failures and outages. It allows developers to define workflows using standard programming constructs (loops, conditions) in Java or Kotlin, ensuring that processes are resilient to service or worker failures and are horizontally scalable via an event-driven architecture.
  2. Overview of Infinitic Workflow Deployment Components

    Deploying Infinitic Workflows requires three stateless components:

    1. Workflow Executors: Execute workflow logic by replaying the workflow method, skipping completed steps using history, and dispatching new tasks or sub-workflows.
    2. Workflow State Engines: Maintain workflow state in a database, record history/state changes, and dispatch commands to Workflow Executors to advance instances.
    3. Workflow Tag Engines: Manage relationships between workflow tags and workflow IDs in a database to enable bulk operations on workflows.
  3. Overview of Service Tag Engines

    Service Tag Engines are stateless components used to perform operations on tasks based on their tags. They maintain the relationship between task IDs and task tags within a database. To set one up, you need transport configuration and a storage configuration for the tag-to-ID relationships.
  4. Overview of Infinitic Service Executors

    Service Executors are stateless components responsible for executing tasks for a Service. They implement the Service interface and handle the full task lifecycle: listening for tasks from the message broker, deserializing arguments, executing the task via the Service implementation, serializing the result, sending the result back to the broker, and managing completion or failures.
  5. Overview of Infinitic Workflow Exceptions

    Infinitic simplifies distributed error handling by tracking error chains. All workflow exceptions derive from the DeferredException base class. Exceptions are categorized into two main groups: those caused by Task failures and those caused by Workflow failures.
  6. Understand Infinitic's event-driven workflow architecture

    Infinitic allows developers to write business processes in Java or Kotlin using sequential coding patterns, while the underlying execution is event-driven and distributed. Key architectural components include:

    1. Event-Based RPC: Remote services are invoked via an event-based mechanism, making remote calls feel like local method calls.
    2. Reliable Messaging: Uses Apache Pulsar to ensure message persistence and efficient handling.
    3. Workflow Coordination: Dedicated services maintain a history for each workflow instance, allowing processes to resume from the last known state after failures.
    4. Resilience: Workflows are resilient to technical failures; failed tasks are automatically retried, and permanently failed workflows can be restarted from the point of failure once the issue is resolved.
  7. Interact with Infinitic using Clients

    Infinitic Clients are used to interact with the application to perform actions such as starting or cancelling workflows and retrying tasks. Infinitic currently supports Java and Kotlin clients.
  8. Optimize Infinitic performance using batch processing

    Batch processing (introduced in Infinitic 0.16.2) allows multiple messages to be processed together rather than individually, potentially improving throughput by up to 10x. It optimizes performance across three main stages:

    1. Message Consumption: Retrieves multiple messages from the broker in a single network call instead of individual calls.
    2. Message Processing:
      • Internal components (Workflow State Engine, Workflow Tag Engine, and Service Tag Engine) group multiple database operations into a single transaction.
      • User-defined tasks and outgoing messages are grouped into batches to reduce network calls.
    3. Message Acknowledgment: Groups multiple acknowledgments (ACKs) or negative acknowledgments (NACKs) into a single call to the message broker.
  9. Monitor workflow and task execution via the Infinitic Dashboard

    The Infinitic dashboard provides a high-level overview of all tasks and workflows processed through the cluster. It allows operators to monitor the number of deployed workers, total backlog, and throughput. To ensure near-real-time execution, the number of workers should be scaled to prevent the backlog from growing.
  10. Understand the role of Service Executors

    Service Executors are Infinitic Workers responsible for executing tasks. They perform the following operations:

    1. Concurrently listen for incoming task messages from Pulsar based on concurrency settings.
    2. Deserialize task arguments.
    3. Instantiate the target Service class and execute the requested method.
    4. Serialize the return value and send it back through Pulsar.
    5. Manage timeouts, exceptions, and task retries.

    Service Executors are stateless and horizontally scalable; deploying multiple instances increases throughput and provides redundancy.

  11. Manage workflows using Infinitic stubs

    The Infinitic client uses stubs built from workflow interfaces to manage workflow lifecycles. Stubs act as syntactic instances of a workflow and are used to trigger actions such as starting new workflows, cancelling running workflows, sending signals, or invoking methods on running workflows. Creating a stub is a local operation with no side effects; it simply creates an object containing the necessary targeting information.
  12. Use Java interfaces to define service contracts in Infinitic

    Infinitic uses Java interfaces to define the contract between services and their consumers. Instead of manually defining events, schemas, or routing logic, developers define public methods and parameters in a Java interface. Infinitic then automatically handles the underlying event-driven infrastructure, including:

    • Event Management: Automatically creates and manages events based on the service interface.
    • Schema & Serialization: Handles schema definition, maintenance, and the serialization/deserialization of method calls and parameters into events.
    • Routing: Automatically routes events to the appropriate services without requiring manual queue or topic configuration.
    • Broker Abstraction: Abstracts away Apache Pulsar specifics, meaning developers do not need to implement producers/consumers or manage partitioning strategies.
    • Reliability: Provides built-in error handling and retry mechanisms.

    This approach ensures type safety, contract enforcement, and better IDE support (auto-completion/refactoring) while allowing interfaces to be shared in common modules across teams for reuse.