Package io.outbox.spring.boot
Class OutboxLifecycle
java.lang.Object
io.outbox.spring.boot.OutboxLifecycle
- All Implemented Interfaces:
org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
Manages the outbox lifecycle: starts the poller after all listeners are registered,
and stops the poller/dispatcher during application shutdown.
Spring guarantees SmartInitializingSingleton
(used by OutboxListenerRegistrar) runs before Lifecycle.start().
This eliminates the startup race where the poller could poll events before listeners
are registered.
stop() delegates to Outbox.close(), which drains in-flight events
and shuts down the poller and dispatcher threads.
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
getPhase, isAutoStartup, stop
-
Constructor Details
-
OutboxLifecycle
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-