Package com.eventstore.dbclient
Class EventStoreDBProjectionManagementClient
- java.lang.Object
-
- com.eventstore.dbclient.EventStoreDBProjectionManagementClient
-
public class EventStoreDBProjectionManagementClient extends java.lang.Object
Represents EventStoreDB client for projections management. A client instance maintains a two-way communication to EventStoreDB. Many threads can use the EventStoreDB client simultaneously, or a single thread can make many asynchronous requests.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture
abort(java.lang.String projectionName)
Stops the projection without writing a checkpoint.java.util.concurrent.CompletableFuture
abort(java.lang.String projectionName, AbortProjectionOptions options)
Stops the projection without writing a checkpoint.static EventStoreDBProjectionManagementClient
create(EventStoreDBClientSettings settings)
Returns the Projection Management client based on the settings.java.util.concurrent.CompletableFuture
create(java.lang.String projectionName, java.lang.String query)
Creates a new projection in the stopped state.java.util.concurrent.CompletableFuture
create(java.lang.String projectionName, java.lang.String query, CreateProjectionOptions options)
Creates a new projection in the stopped state.java.util.concurrent.CompletableFuture
delete(java.lang.String projectionName)
Deletes the projection.java.util.concurrent.CompletableFuture
delete(java.lang.String projectionName, DeleteProjectionOptions options)
Deletes the projection.java.util.concurrent.CompletableFuture
disable(java.lang.String projectionName)
Disables the projection.java.util.concurrent.CompletableFuture
disable(java.lang.String projectionName, DisableProjectionOptions options)
Disables the projection.java.util.concurrent.CompletableFuture
enable(java.lang.String projectionName)
Enables the projection.java.util.concurrent.CompletableFuture
enable(java.lang.String projectionName, EnableProjectionOptions options)
Enables the projection.static EventStoreDBProjectionManagementClient
from(EventStoreDBClientBase existingClient)
Returns a Projection Management client based on existing client.<TResult> java.util.concurrent.CompletableFuture<TResult>
getResult(java.lang.String projectionName, java.lang.Class<TResult> type)
Gets the projection's result.<TResult> java.util.concurrent.CompletableFuture<TResult>
getResult(java.lang.String projectionName, java.lang.Class<TResult> type, GetProjectionResultOptions options)
Gets the projection's result.<TResult> java.util.concurrent.CompletableFuture<TResult>
getResult(java.lang.String projectionName, java.util.function.Function<com.fasterxml.jackson.databind.type.TypeFactory,com.fasterxml.jackson.databind.JavaType> javaTypeFunction)
Gets the projection's result.<TResult> java.util.concurrent.CompletableFuture<TResult>
getResult(java.lang.String projectionName, java.util.function.Function<com.fasterxml.jackson.databind.type.TypeFactory,com.fasterxml.jackson.databind.JavaType> javaTypeFunction, GetProjectionResultOptions options)
Gets the projection's result.<TResult> java.util.concurrent.CompletableFuture<TResult>
getState(java.lang.String projectionName, java.lang.Class<TResult> type)
Gets the state of the projection.<TResult> java.util.concurrent.CompletableFuture<TResult>
getState(java.lang.String projectionName, java.lang.Class<TResult> type, GetProjectionStateOptions options)
Gets the state of the projection.<TResult> java.util.concurrent.CompletableFuture<TResult>
getState(java.lang.String projectionName, java.util.function.Function<com.fasterxml.jackson.databind.type.TypeFactory,com.fasterxml.jackson.databind.JavaType> javaTypeFunction)
Gets the state of the projection.<TResult> java.util.concurrent.CompletableFuture<TResult>
getState(java.lang.String projectionName, java.util.function.Function<com.fasterxml.jackson.databind.type.TypeFactory,com.fasterxml.jackson.databind.JavaType> javaTypeFunction, GetProjectionStateOptions options)
Gets the state of the projection.java.util.concurrent.CompletableFuture<ProjectionDetails>
getStatistics(java.lang.String projectionName)
Gets the statistics for the projection.java.util.concurrent.CompletableFuture<ProjectionDetails>
getStatistics(java.lang.String projectionName, GetProjectionStatisticsOptions options)
Gets the statistics for the projection.java.util.concurrent.CompletableFuture<ProjectionDetails>
getStatus(java.lang.String projectionName)
Gets the projection's current status.java.util.concurrent.CompletableFuture<ProjectionDetails>
getStatus(java.lang.String projectionName, GetProjectionStatusOptions options)
Gets the projection's current status.boolean
isShutdown()
Checks if this client instance has been shutdown.java.util.concurrent.CompletableFuture<java.util.List<ProjectionDetails>>
list()
Lists all continuous projections.java.util.concurrent.CompletableFuture<java.util.List<ProjectionDetails>>
list(ListProjectionsOptions options)
Lists all continuous projections.java.util.concurrent.CompletableFuture
reset(java.lang.String projectionName)
Resets the projection, causing it to start again from the beginning of the stream/s it selects from.java.util.concurrent.CompletableFuture
reset(java.lang.String projectionName, ResetProjectionOptions options)
Resets the projection, causing it to start again from the beginning of the stream/s it selects from.java.util.concurrent.CompletableFuture
restartSubsystem()
Restarts the projection subsystem.java.util.concurrent.CompletableFuture
restartSubsystem(RestartProjectionSubsystemOptions options)
Restarts the projection subsystem.java.util.concurrent.CompletableFuture<java.lang.Void>
shutdown()
Closes a connection and cleans all its allocated resources.java.util.concurrent.CompletableFuture
update(java.lang.String projectionName, java.lang.String query)
Updates the projection's query and emit options.java.util.concurrent.CompletableFuture
update(java.lang.String projectionName, java.lang.String query, UpdateProjectionOptions options)
Updates the projection's query and emit options.
-
-
-
Method Detail
-
create
public static EventStoreDBProjectionManagementClient create(EventStoreDBClientSettings settings)
Returns the Projection Management client based on the settings.- Parameters:
settings
- The settings to use for constructing the client.
-
from
public static EventStoreDBProjectionManagementClient from(EventStoreDBClientBase existingClient)
Returns a Projection Management client based on existing client.- Parameters:
existingClient
- Existing client.
-
abort
public java.util.concurrent.CompletableFuture abort(java.lang.String projectionName)
Stops the projection without writing a checkpoint. This can be used to disable a projection that has been faulted.- Parameters:
projectionName
- Name of the projection.
-
abort
public java.util.concurrent.CompletableFuture abort(java.lang.String projectionName, AbortProjectionOptions options)
Stops the projection without writing a checkpoint. This can be used to disable a projection that has been faulted.- Parameters:
projectionName
- Name of the projection.options
- Additional options.
-
create
public java.util.concurrent.CompletableFuture create(java.lang.String projectionName, java.lang.String query)
Creates a new projection in the stopped state. Enable needs to be called separately to start the projection.- Parameters:
projectionName
- Name of the projection.query
- The JavaScript projection.
-
create
public java.util.concurrent.CompletableFuture create(java.lang.String projectionName, java.lang.String query, CreateProjectionOptions options)
Creates a new projection in the stopped state. Enable needs to be called separately to start the projection.- Parameters:
projectionName
- Name of the projection.query
- The JavaScript projection.options
- Additional options.
-
enable
public java.util.concurrent.CompletableFuture enable(java.lang.String projectionName)
Enables the projection.- Parameters:
projectionName
- Name of the projection.
-
enable
public java.util.concurrent.CompletableFuture enable(java.lang.String projectionName, EnableProjectionOptions options)
Enables the projection.- Parameters:
projectionName
- Name of the projection.options
- Additional options.
-
delete
public java.util.concurrent.CompletableFuture delete(java.lang.String projectionName)
Deletes the projection.- Parameters:
projectionName
- Name of the projection.
-
delete
public java.util.concurrent.CompletableFuture delete(java.lang.String projectionName, DeleteProjectionOptions options)
Deletes the projection.- Parameters:
projectionName
- Name of the projection.options
- Additional options.
-
disable
public java.util.concurrent.CompletableFuture disable(java.lang.String projectionName)
Disables the projection.- Parameters:
projectionName
- Name of the projection.
-
disable
public java.util.concurrent.CompletableFuture disable(java.lang.String projectionName, DisableProjectionOptions options)
Disables the projection.- Parameters:
projectionName
- Name of the projection.options
- Additional options.
-
getResult
public <TResult> java.util.concurrent.CompletableFuture<TResult> getResult(java.lang.String projectionName, java.lang.Class<TResult> type)
Gets the projection's result.- Type Parameters:
TResult
- The result type to return.- Parameters:
projectionName
- Name of the projection.type
- Type of the class to construct for the result.
-
getResult
public <TResult> java.util.concurrent.CompletableFuture<TResult> getResult(java.lang.String projectionName, java.lang.Class<TResult> type, GetProjectionResultOptions options)
Gets the projection's result.- Type Parameters:
TResult
- The result type to return.- Parameters:
projectionName
- Name of the projection.type
- Type of the class to construct for the result.
-
getResult
public <TResult> java.util.concurrent.CompletableFuture<TResult> getResult(java.lang.String projectionName, java.util.function.Function<com.fasterxml.jackson.databind.type.TypeFactory,com.fasterxml.jackson.databind.JavaType> javaTypeFunction)
Gets the projection's result.- Type Parameters:
TResult
- The result type to return.- Parameters:
projectionName
- Name of the projection.javaTypeFunction
- Factory method for constructing the return type.
-
getResult
public <TResult> java.util.concurrent.CompletableFuture<TResult> getResult(java.lang.String projectionName, java.util.function.Function<com.fasterxml.jackson.databind.type.TypeFactory,com.fasterxml.jackson.databind.JavaType> javaTypeFunction, GetProjectionResultOptions options)
Gets the projection's result.- Type Parameters:
TResult
- The result type to return.- Parameters:
projectionName
- Name of the projection.javaTypeFunction
- Factory method for constructing the return type.
-
getState
public <TResult> java.util.concurrent.CompletableFuture<TResult> getState(java.lang.String projectionName, java.lang.Class<TResult> type)
Gets the state of the projection.- Type Parameters:
TResult
- The result type to return.- Parameters:
projectionName
- Name of the projection.type
- Type of the class to construct for the result.
-
getState
public <TResult> java.util.concurrent.CompletableFuture<TResult> getState(java.lang.String projectionName, java.lang.Class<TResult> type, GetProjectionStateOptions options)
Gets the state of the projection.- Type Parameters:
TResult
- The result type to return.- Parameters:
projectionName
- Name of the projection.type
- Type of the class to construct for the result.
-
getState
public <TResult> java.util.concurrent.CompletableFuture<TResult> getState(java.lang.String projectionName, java.util.function.Function<com.fasterxml.jackson.databind.type.TypeFactory,com.fasterxml.jackson.databind.JavaType> javaTypeFunction)
Gets the state of the projection.- Type Parameters:
TResult
- The result type to return.- Parameters:
projectionName
- Name of the projection.javaTypeFunction
- Factory method for constructing the return type.
-
getState
public <TResult> java.util.concurrent.CompletableFuture<TResult> getState(java.lang.String projectionName, java.util.function.Function<com.fasterxml.jackson.databind.type.TypeFactory,com.fasterxml.jackson.databind.JavaType> javaTypeFunction, GetProjectionStateOptions options)
Gets the state of the projection.- Type Parameters:
TResult
- The result type to return.- Parameters:
projectionName
- Name of the projection.javaTypeFunction
- Factory method for constructing the return type.
-
getStatistics
public java.util.concurrent.CompletableFuture<ProjectionDetails> getStatistics(java.lang.String projectionName)
Gets the statistics for the projection.- Parameters:
projectionName
- Name of the projection.
-
getStatistics
public java.util.concurrent.CompletableFuture<ProjectionDetails> getStatistics(java.lang.String projectionName, GetProjectionStatisticsOptions options)
Gets the statistics for the projection.- Parameters:
projectionName
- Name of the projection.options
- Additional options.
-
getStatus
public java.util.concurrent.CompletableFuture<ProjectionDetails> getStatus(java.lang.String projectionName)
Gets the projection's current status.- Parameters:
projectionName
- Name of the projection.
-
getStatus
public java.util.concurrent.CompletableFuture<ProjectionDetails> getStatus(java.lang.String projectionName, GetProjectionStatusOptions options)
Gets the projection's current status.- Parameters:
projectionName
- Name of the projection.options
- Additional options.
-
list
public java.util.concurrent.CompletableFuture<java.util.List<ProjectionDetails>> list()
Lists all continuous projections.
-
list
public java.util.concurrent.CompletableFuture<java.util.List<ProjectionDetails>> list(ListProjectionsOptions options)
Lists all continuous projections.- Parameters:
options
- Additional options.
-
reset
public java.util.concurrent.CompletableFuture reset(java.lang.String projectionName)
Resets the projection, causing it to start again from the beginning of the stream/s it selects from. Resetting a projection will truncate all emitted streams and re-emit all events.- Parameters:
projectionName
- Name of the projection.
-
reset
public java.util.concurrent.CompletableFuture reset(java.lang.String projectionName, ResetProjectionOptions options)
Resets the projection, causing it to start again from the beginning of the stream/s it selects from. Resetting a projection will truncate all emitted streams and re-emit all events.- Parameters:
projectionName
- Name of the projection.options
- Additional options.
-
restartSubsystem
public java.util.concurrent.CompletableFuture restartSubsystem()
Restarts the projection subsystem. This can be used to recover from certain kinds of errors.
-
restartSubsystem
public java.util.concurrent.CompletableFuture restartSubsystem(RestartProjectionSubsystemOptions options)
Restarts the projection subsystem. This can be used to recover from certain kinds of errors.- Parameters:
options
- Additional options.
-
update
public java.util.concurrent.CompletableFuture update(java.lang.String projectionName, java.lang.String query)
Updates the projection's query and emit options.- Parameters:
projectionName
- Name of the projection.query
- The JavaScript projection.
-
update
public java.util.concurrent.CompletableFuture update(java.lang.String projectionName, java.lang.String query, UpdateProjectionOptions options)
Updates the projection's query and emit options.- Parameters:
projectionName
- Name of the projection.query
- The JavaScript projection.options
- Additional options.
-
shutdown
public java.util.concurrent.CompletableFuture<java.lang.Void> shutdown()
Closes a connection and cleans all its allocated resources.
-
isShutdown
public boolean isShutdown()
Checks if this client instance has been shutdown. After shutdown a client instance can no longer process new operations and a new client instance has to be created.- Returns:
true
if client instance has been shutdown.
-
-