Interface MessagingGraph

All Superinterfaces:
AutoCloseable, RuntimeType.Api<MessagingConfig>

public interface MessagingGraph extends RuntimeType.Api<MessagingConfig>, AutoCloseable
One messaging topology and lifecycle.

A graph owns all channels, sources, routes, connectors, and their lifecycle. The topology is mutable only through its builder and is frozen by MessagingConfig.Builder.build(). Use each builder and its configuration for one graph only; do not reuse them after a build attempt, including a failed build. This ownership requirement is not enforced by the builder.

  • Method Details

    • builder

      static MessagingConfig.Builder builder()
      Create a builder for one graph. The builder must not be reused after a build attempt.
      Returns:
      graph builder
    • create

      static MessagingGraph create(Consumer<MessagingConfig.Builder> consumer)
      Create a graph with customized configuration.
      Parameters:
      consumer - messaging configuration builder consumer
      Returns:
      messaging graph
    • create

      static MessagingGraph create(MessagingConfig config)
      Create a graph from its immutable configuration.
      Parameters:
      config - messaging configuration
      Returns:
      messaging graph
    • create

      static MessagingGraph create(Config config)
      Create a graph from the messaging configuration node.
      Parameters:
      config - messaging configuration node
      Returns:
      messaging graph
    • start

      Validate and start the complete graph, waiting for outgoing connector startup and incoming connector readiness.

      The core runtime does not impose a startup deadline. ChannelConnection transport configuration may define its own connection or readiness limits. Waiting in this method is interruptible; concurrent close() cancels startup.

      Returns:
      this graph
    • emitter

      <T> Emitter<T> emitter(MessagingChannel<T> channel)
      Obtain an imperative emitter for a channel owned by this graph.
      Type Parameters:
      T - payload type
      Parameters:
      channel - channel handle
      Returns:
      channel emitter
      Throws:
      IllegalArgumentException - if the channel belongs to another graph
      IllegalStateException - when an emission is attempted while the graph is not running
    • close

      void close()
      Stop admission, drain admitted work, and close all graph-owned resources.

      When called from a delivery, source task, or connector lifecycle callback owned by this graph, shutdown is handed off so the current task can complete. Such a call returns after initiating shutdown; any eventual failure is recorded and reported to a later waiting caller. A call from any other thread waits for shutdown to complete.

      Specified by:
      close in interface AutoCloseable
      Throws:
      MessagingException - if shutdown cannot be initiated, or if a waiting caller observes a managed source failure or shutdown that cannot complete cleanly