Class ReactiveFeeder
java.lang.Object
software.spool.publisher.api.strategy.ReactiveFeeder
- All Implemented Interfaces:
FeederStrategy
Reactive
FeederStrategy that listens for InboxItemStored
events on the event bus and processes each one immediately.
When started, this strategy subscribes to InboxItemStored events.
Each event triggers the handler which updates the inbox status to
PUBLISHING, emits an ItemPublished event, and marks the
item as PUBLISHED.
This strategy is best suited for low-latency, event-driven architectures where items should be published as soon as they arrive in the inbox.
-
Constructor Summary
ConstructorsConstructorDescriptionReactiveFeeder(software.spool.core.port.EventBusListener eventBusListener, software.spool.core.control.Handler<software.spool.core.model.InboxItemStored> handler) Creates a new reactive feeder. -
Method Summary
Modifier and TypeMethodDescriptionsoftware.spool.core.port.Subscriptionstart()Subscribes toInboxItemStoredevents on the event bus.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.spool.publisher.api.strategy.FeederStrategy
stop
-
Constructor Details
-
ReactiveFeeder
public ReactiveFeeder(software.spool.core.port.EventBusListener eventBusListener, software.spool.core.control.Handler<software.spool.core.model.InboxItemStored> handler) Creates a new reactive feeder.- Parameters:
eventBusListener- the event bus listener to subscribe withhandler- the handler that processes each inbox item
-
-
Method Details
-
start
public software.spool.core.port.Subscription start()Subscribes toInboxItemStoredevents on the event bus.- Specified by:
startin interfaceFeederStrategy- Returns:
- a
Subscriptionthat can be cancelled to stop publishing
-