Package com.google.genkit.ai.agent
Interface SnapshotSubscriber
- All Known Implementing Classes:
CosmosSessionStore,DynamoDbSessionStore,FileSessionStore,FirestoreSessionStore,InMemorySessionStore,MongoSessionStore,PostgresSessionStore
public interface SnapshotSubscriber
Optional capability: subscribe to a snapshot's status changes.
Stores that support real-time notifications (e.g. Firestore) implement this interface. Required for detach/abort workflows that need to observe when a running snapshot transitions to a terminal state.
-
Method Summary
Modifier and TypeMethodDescriptiononSnapshotStateChange(String snapshotId, Consumer<SessionSnapshot<?>> cb, SessionStoreOptions options) Subscribes to status changes for the snapshot identified bysnapshotId.
-
Method Details
-
onSnapshotStateChange
AutoCloseable onSnapshotStateChange(String snapshotId, Consumer<SessionSnapshot<?>> cb, SessionStoreOptions options) Subscribes to status changes for the snapshot identified bysnapshotId.Invokes
cbimmediately with the current snapshot and again on every subsequent change. The returnedAutoCloseableunsubscribes when closed.- Parameters:
snapshotId- the snapshot to observecb- callback invoked with the updated snapshot on each changeoptions- store options- Returns:
- a handle that cancels the subscription when
AutoCloseable.close()is called
-