Class AnnotationSimpleService

java.lang.Object
org.j7m.middleware.examples.annotation.AnnotationSimpleService

@J7mService(name="//apps/example/annotation/simple/GreetingService", exported=true, transport="default") @HighAvailability @PreferLocal public final class AnnotationSimpleService extends Object
Minimal annotation-first service with constructor injection and lifecycle hooks.

The service demonstrates descriptor-backed export metadata with J7mService, descriptor metadata with RemoteMethod, retry-safe descriptor metadata with Idempotent, and deterministic lifecycle callbacks. The annotations are public J7M metadata; low-level export APIs remain available for advanced callers.

  • Constructor Details

    • AnnotationSimpleService

      @Inject public AnnotationSimpleService(@Named("formal") AnnotationGreetingFormatter formatter, AnnotationExampleAudit audit, @ConfigValue(value="annotation.region",defaultValue="local") String region)
      Creates the service from public application capabilities.
      Parameters:
      formatter - named formatter capability
      audit - safe audit collector
      region - configured region
  • Method Details

    • initialize

      public void initialize()
      Initializes local state before startup.
    • start

      public void start()
      Starts the service after injection completes.
    • greet

      @Deadline(millis=250L) @Retry(maxAttempts=1) @Backpressure(maxConcurrent=8) public String greet(String name)
      Greets a caller using injected configuration.

      The remote, idempotent, deadline, retry, and backpressure annotations are descriptor metadata in this example. Runtime dispatch policy remains responsible for enforcing retries, deadlines, and admission control.

      Parameters:
      name - caller name
      Returns:
      greeting
    • health

      @HealthCheck public String health()
      Reports component health.
      Returns:
      safe health text
    • ready

      @ReadinessCheck public boolean ready()
      Reports readiness.
      Returns:
      true when startup ran
    • drain

      @Drain public void drain()
      Drains the service before shutdown.
    • shutdown

      public void shutdown()
      Shuts the service down.
    • lifecycleEvents

      public List<String> lifecycleEvents()
      Returns the deterministic lifecycle event order.
      Returns:
      lifecycle events