Class ManagedOutboxFactory

java.lang.Object
org.j7m.middleware.application.distributed.ManagedOutboxFactory
All Implemented Interfaces:
AutoCloseable, org.j7m.middleware.application.components.ManagedHostBindings.Factory, org.j7m.middleware.application.components.ManagedHostedResources.Factory

public final class ManagedOutboxFactory extends Object implements org.j7m.middleware.application.components.ManagedHostBindings.Factory, org.j7m.middleware.application.components.ManagedHostedResources.Factory, AutoCloseable
Ordinary-interface outbox producers plus automatically generated methodless relay lifecycles. Producer writes share the actual A11 guarded Connection; no queue send occurs in that transaction. One bounded host relay per logical SQL namespace survives individual binding departure. It uses stable native publication IDs, so a crash between send and SQL mark never creates a new message. Connections opened by relays are owned, while factories, codecs, queues and telemetry are borrowed.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    Finite ordinary producer capability.
    static final record 
    Safe aggregate relay status, without SQL values, payload or exception messages.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Builds finite explicit producer/relay registrations, rejecting conflicting shared SQL scopes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Set<Class<? extends Annotation>>
    Declares only the actual outbox annotation capability.
    Declares only the methodless backend kind implemented here; it grants no generic callback bypass.
    org.j7m.middleware.application.components.ManagedHostBindings.BoundValue
    bind(org.j7m.middleware.application.api.ManagedDependency dependency)
    Creates a revocable ordinary producer; actual enqueue requires this caller's owned JDBC scope.
    org.j7m.middleware.application.components.ManagedHostedResources.Binding
    bind(org.j7m.middleware.application.api.ManagedHostedFeature feature, org.j7m.middleware.application.api.ManagedComponentDefinition<?> definition, Object component, org.j7m.middleware.application.components.ManagedHostedResources.Bundle bundle, org.j7m.middleware.application.components.ManagedHostedResources.Invoker invoker)
    Joins one shared logical relay through an independently owned activation lease.
    void
    Releases host executors only after every owned lease has actually drained.
    status(String resource, String policy)
    Reads local safe counters without SQL or queue I/O.
    void
    validate(org.j7m.middleware.application.api.ManagedDependency dependency, org.j7m.middleware.annotations.Scope.Kind scope)
    Validates provider-only source binding without opening SQL or queue connections.
    void
    validate(org.j7m.middleware.application.api.ManagedHostedFeature feature, org.j7m.middleware.application.api.ManagedComponentDefinition<?> definition, org.j7m.middleware.application.components.ManagedHostedResources.Bundle bundle)
    Validates an actual methodless generated dependency feature before constructors.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.j7m.middleware.application.components.ManagedHostedResources.Factory

    requiredPolicies
  • Constructor Details

    • ManagedOutboxFactory

      public ManagedOutboxFactory(Map<String, ManagedOutboxFactory.Registration> resources, int maximumWorkers)
      Builds finite explicit producer/relay registrations, rejecting conflicting shared SQL scopes.
      Parameters:
      resources - named resource capabilities, at most256, at most64 distinct SQL namespaces
      maximumWorkers - physical relay workers1..16
      Throws:
      IllegalArgumentException - for invalid methods, profiles or conflicting shared capabilities
  • Method Details

    • annotationTypes

      public Set<Class<? extends Annotation>> annotationTypes()
      Declares only the actual outbox annotation capability.
      Specified by:
      annotationTypes in interface org.j7m.middleware.application.components.ManagedHostedResources.Factory
      Returns:
      exact immutable marker set
    • backendKinds

      public Set<String> backendKinds()
      Declares only the methodless backend kind implemented here; it grants no generic callback bypass.
      Specified by:
      backendKinds in interface org.j7m.middleware.application.components.ManagedHostedResources.Factory
      Returns:
      outbox-relay backend capability
    • validate

      public void validate(org.j7m.middleware.application.api.ManagedDependency dependency, org.j7m.middleware.annotations.Scope.Kind scope)
      Validates provider-only source binding without opening SQL or queue connections.
      Specified by:
      validate in interface org.j7m.middleware.application.components.ManagedHostBindings.Factory
      Parameters:
      dependency - generated exact resource edge
      scope - component capture scope
      Throws:
      IllegalArgumentException - for an unknown resource, direct capture or unsupported refresh
    • bind

      public org.j7m.middleware.application.components.ManagedHostBindings.BoundValue bind(org.j7m.middleware.application.api.ManagedDependency dependency)
      Creates a revocable ordinary producer; actual enqueue requires this caller's owned JDBC scope.
      Specified by:
      bind in interface org.j7m.middleware.application.components.ManagedHostBindings.Factory
      Parameters:
      dependency - validated producer dependency
      Returns:
      owned local binding, never owner of the borrowed backend registrations
    • validate

      public void validate(org.j7m.middleware.application.api.ManagedHostedFeature feature, org.j7m.middleware.application.api.ManagedComponentDefinition<?> definition, org.j7m.middleware.application.components.ManagedHostedResources.Bundle bundle)
      Validates an actual methodless generated dependency feature before constructors.
      Specified by:
      validate in interface org.j7m.middleware.application.components.ManagedHostedResources.Factory
      Parameters:
      feature - exact finite relay descriptor
      definition - owning component definition, including selected dependency sites
      bundle - verified immutable bundle context
      Throws:
      IllegalArgumentException - for forged callbacks, resource, profile or duplicate SQL configuration
    • bind

      public org.j7m.middleware.application.components.ManagedHostedResources.Binding bind(org.j7m.middleware.application.api.ManagedHostedFeature feature, org.j7m.middleware.application.api.ManagedComponentDefinition<?> definition, Object component, org.j7m.middleware.application.components.ManagedHostedResources.Bundle bundle, org.j7m.middleware.application.components.ManagedHostedResources.Invoker invoker)
      Joins one shared logical relay through an independently owned activation lease.
      Specified by:
      bind in interface org.j7m.middleware.application.components.ManagedHostedResources.Factory
      Parameters:
      feature - validated methodless descriptor
      definition - generated dependency owner
      component - unused and possibly null for a methodless backend; never constructed here
      bundle - verified immutable bundle
      invoker - actual admission guard; no application callback is invoked by the relay
      Returns:
      owned independent lease whose departure cannot stop another active owner
    • status

      public ManagedOutboxFactory.Status status(String resource, String policy)
      Reads local safe counters without SQL or queue I/O.
      Parameters:
      resource - exact host resource name
      policy - exact publication profile name
      Returns:
      local relay counters, zero when not currently bound
      Throws:
      IllegalArgumentException - for an unknown resource/profile
    • close

      public void close()
      Releases host executors only after every owned lease has actually drained.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IllegalStateException - while a relay lease or physical operation remains