Class SnapshotChannelImpl
- java.lang.Object
-
- io.axoniq.axonserver.connector.impl.AbstractAxonServerChannel<Void>
-
- io.axoniq.axonserver.connector.event.impl.SnapshotChannelImpl
-
- All Implemented Interfaces:
SnapshotChannel
public class SnapshotChannelImpl extends AbstractAxonServerChannel<Void> implements SnapshotChannel
SnapshotChannelimplementation, serving as the event connection between Axon Server and a client application.- Since:
- 2025.2.0
- Author:
- Silvano Biemans, Milan Savic
-
-
Constructor Summary
Constructors Constructor Description SnapshotChannelImpl(ClientIdentification clientIdentification, ScheduledExecutorService executor, AxonServerManagedChannel axonServerManagedChannel)Instantiate anAbstractAxonServerChannel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<AddSnapshotResponse>addSnapshot(AddSnapshotRequest request)Adds a snapshot to the store.voidconnect()Connect this channel with AxonServer.CompletableFuture<DeleteSnapshotsResponse>deleteSnapshots(DeleteSnapshotsRequest request)Deletes snapshots within a specified sequence range for a given key.voiddisconnect()Disconnect this channel from AxonServer.CompletableFuture<GetLastSnapshotResponse>getLastSnapshot(GetLastSnapshotRequest request)Retrieves the snapshot with the highest sequence number for a given key.booleanisReady()Validate whether this channel has all required streams connected with AxonServer.ResultStream<ListSnapshotsResponse>listSnapshots(ListSnapshotsRequest request)Lists snapshots for a given key within a specified sequence range.voidreconnect()Reconnect this channel with AxonServer.-
Methods inherited from class io.axoniq.axonserver.connector.impl.AbstractAxonServerChannel
processAck, scheduleImmediateReconnect, scheduleReconnect, sendInstruction
-
-
-
-
Constructor Detail
-
SnapshotChannelImpl
public SnapshotChannelImpl(ClientIdentification clientIdentification, ScheduledExecutorService executor, AxonServerManagedChannel axonServerManagedChannel)
Instantiate anAbstractAxonServerChannel.- Parameters:
clientIdentification- identifies a clientexecutor- aScheduledExecutorServiceused to schedule reconnectionsaxonServerManagedChannel- theAxonServerManagedChannelused to connect to AxonServer
-
-
Method Detail
-
addSnapshot
public CompletableFuture<AddSnapshotResponse> addSnapshot(AddSnapshotRequest request)
Description copied from interface:SnapshotChannelAdds a snapshot to the store. If a snapshot with the same key and sequence already exists, it will be replaced. When the prune flag is set to true, all snapshots with the same key and a sequence number less than the provided sequence will be removed.- Specified by:
addSnapshotin interfaceSnapshotChannel- Parameters:
request- The request containing the snapshot to add, including key, sequence, prune flag, and snapshot data- Returns:
- A CompletableFuture that resolves to an AddSnapshotResponse when the operation completes
-
deleteSnapshots
public CompletableFuture<DeleteSnapshotsResponse> deleteSnapshots(DeleteSnapshotsRequest request)
Description copied from interface:SnapshotChannelDeletes snapshots within a specified sequence range for a given key. The range is inclusive at the lower bound (fromSequence) and exclusive at the upper bound (toSequence).- Specified by:
deleteSnapshotsin interfaceSnapshotChannel- Parameters:
request- The request containing the key and sequence range to delete- Returns:
- A CompletableFuture that resolves to a DeleteSnapshotsResponse when the operation completes
-
listSnapshots
public ResultStream<ListSnapshotsResponse> listSnapshots(ListSnapshotsRequest request)
Description copied from interface:SnapshotChannelLists snapshots for a given key within a specified sequence range. The range is inclusive at the lower bound (fromSequence) and exclusive at the upper bound (toSequence). Snapshots are returned in ascending order by sequence number.- Specified by:
listSnapshotsin interfaceSnapshotChannel- Parameters:
request- The request containing the key and sequence range to list- Returns:
- A ResultStream of ListSnapshotsResponse objects containing the matching snapshots
-
getLastSnapshot
public CompletableFuture<GetLastSnapshotResponse> getLastSnapshot(GetLastSnapshotRequest request)
Description copied from interface:SnapshotChannelRetrieves the snapshot with the highest sequence number for a given key. If no snapshots exist for the key, the response will not contain a snapshot.- Specified by:
getLastSnapshotin interfaceSnapshotChannel- Parameters:
request- The request containing the key to get the last snapshot for- Returns:
- A CompletableFuture that resolves to a GetLastSnapshotResponse when the operation completes
-
connect
public void connect()
Description copied from class:AbstractAxonServerChannelConnect this channel with AxonServer.- Specified by:
connectin classAbstractAxonServerChannel<Void>
-
reconnect
public void reconnect()
Description copied from class:AbstractAxonServerChannelReconnect this channel with AxonServer.- Specified by:
reconnectin classAbstractAxonServerChannel<Void>
-
disconnect
public void disconnect()
Description copied from class:AbstractAxonServerChannelDisconnect this channel from AxonServer.- Specified by:
disconnectin classAbstractAxonServerChannel<Void>
-
isReady
public boolean isReady()
Description copied from class:AbstractAxonServerChannelValidate whether this channel has all required streams connected with AxonServer. If the state of the channel does not require any active streams, it is considered ready and will returntrue.- Specified by:
isReadyin classAbstractAxonServerChannel<Void>- Returns:
trueif this channel is connected with AxonServer or does not require any active connections,falseotherwise
-
-