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 Summary
ConstructorsConstructorDescriptionAnnotationSimpleService(AnnotationGreetingFormatter formatter, AnnotationExampleAudit audit, String region) Creates the service from public application capabilities. -
Method Summary
Modifier and TypeMethodDescriptionvoiddrain()Drains the service before shutdown.Greets a caller using injected configuration.health()Reports component health.voidInitializes local state before startup.Returns the deterministic lifecycle event order.booleanready()Reports readiness.voidshutdown()Shuts the service down.voidstart()Starts the service after injection completes.
-
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 capabilityaudit- safe audit collectorregion- 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
-
ready
@ReadinessCheck public boolean ready()Reports readiness.- Returns:
truewhen startup ran
-
drain
@Drain public void drain()Drains the service before shutdown. -
shutdown
public void shutdown()Shuts the service down. -
lifecycleEvents
-