Class JournalRecoveryBehavior
Built-in Journal interceptors who will alter messages Recovery and/or Write of TestJournal.
Inherited Members
Namespace: Akka.Persistence.TestKit
Assembly: Akka.Persistence.TestKit.dll
Syntax
public class JournalRecoveryBehavior
Methods
| Improve this Doc View SourceFail()
Always fail all messages.
Declaration
public Task Fail()
Returns
Type | Description |
---|---|
Task |
Remarks
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
FailIf(Func<IPersistentRepresentation, Boolean>)
Fail message if predicate predicate
will return true
.
Declaration
public Task FailIf(Func<IPersistentRepresentation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
Func<IPersistentRepresentation, Boolean> | predicate |
Returns
Type | Description |
---|---|
Task |
Remarks
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | When |
FailIf(Func<IPersistentRepresentation, Task<Boolean>>)
Fail message if async predicate predicate
will return true
.
Declaration
public Task FailIf(Func<IPersistentRepresentation, Task<bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
Func<IPersistentRepresentation, Task<Boolean>> | predicate |
Returns
Type | Description |
---|---|
Task |
Remarks
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | When |
FailIfWithDelay(TimeSpan, Func<IPersistentRepresentation, Boolean>)
Fail message after specified delay if predicate predicate
will return true
.
Declaration
public Task FailIfWithDelay(TimeSpan delay, Func<IPersistentRepresentation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | |
Func<IPersistentRepresentation, Boolean> | predicate |
Returns
Type | Description |
---|---|
Task |
Remarks
Each message will be delayed individually.
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentException | When |
ArgumentNullException | When |
FailIfWithDelay(TimeSpan, Func<IPersistentRepresentation, Task<Boolean>>)
Fail message after specified delay if async predicate predicate
will return true
.
Declaration
public Task FailIfWithDelay(TimeSpan delay, Func<IPersistentRepresentation, Task<bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | |
Func<IPersistentRepresentation, Task<Boolean>> | predicate |
Returns
Type | Description |
---|---|
Task |
Remarks
Each message will be delayed individually.
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentException | When |
ArgumentNullException | When |
FailOnType(Type)
Fail message during processing message of type messageType
.
Declaration
public Task FailOnType(Type messageType)
Parameters
Type | Name | Description |
---|---|---|
Type | messageType |
Returns
Type | Description |
---|---|
Task |
Remarks
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
- If
messageType
is interface, journal will fail when message implements that interface. - If
messageType
is class, journal will fail when message can be assigned tomessageType
.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | When |
FailOnType<TMessage>()
Fail message during processing message of type TMessage
.
Declaration
public Task FailOnType<TMessage>()
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
TMessage |
Remarks
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
- If
TMessage
is interface, journal will fail when message implements that interface. - If
TMessage
is class, journal will fail when message can be assigned toTMessage
.
FailOnTypeWithDelay(TimeSpan, Type)
Fail message after specified delay if recovering message of type messageType
.
Declaration
public Task FailOnTypeWithDelay(TimeSpan delay, Type messageType)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | |
Type | messageType |
Returns
Type | Description |
---|---|
Task |
Remarks
Each message will be delayed individually.
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
- If
messageType
is interface, journal will fail when message implements that interface. - If
messageType
is class, journal will fail when message can be assigned tomessageType
.
Exceptions
Type | Condition |
---|---|
ArgumentException | When |
ArgumentNullException | When |
FailOnTypeWithDelay<TMessage>(TimeSpan)
Fail message after specified delay if recovering message of type TMessage
.
Declaration
public Task FailOnTypeWithDelay<TMessage>(TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
TMessage |
Remarks
Each message will be delayed individually.
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
- If
TMessage
is interface, journal will fail when message implements that interface. - If
TMessage
is class, journal will fail when message can be assigned toTMessage
.
Exceptions
Type | Condition |
---|---|
ArgumentException | When |
FailUnless(Func<IPersistentRepresentation, Boolean>)
Fail message unless predicate predicate
will return true
.
Declaration
public Task FailUnless(Func<IPersistentRepresentation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
Func<IPersistentRepresentation, Boolean> | predicate |
Returns
Type | Description |
---|---|
Task |
Remarks
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | When |
FailUnless(Func<IPersistentRepresentation, Task<Boolean>>)
Fail message unless async predicate predicate
will return true
.
Declaration
public Task FailUnless(Func<IPersistentRepresentation, Task<bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
Func<IPersistentRepresentation, Task<Boolean>> | predicate |
Returns
Type | Description |
---|---|
Task |
Remarks
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | When |
FailUnlessWithDelay(TimeSpan, Func<IPersistentRepresentation, Boolean>)
Fail message after specified delay unless predicate predicate
will return true
.
Declaration
public Task FailUnlessWithDelay(TimeSpan delay, Func<IPersistentRepresentation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | |
Func<IPersistentRepresentation, Boolean> | predicate |
Returns
Type | Description |
---|---|
Task |
Remarks
Each message will be delayed individually.
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentException | When |
ArgumentNullException | When |
FailUnlessWithDelay(TimeSpan, Func<IPersistentRepresentation, Task<Boolean>>)
Fail message after specified delay unless async predicate predicate
will return true
.
Declaration
public Task FailUnlessWithDelay(TimeSpan delay, Func<IPersistentRepresentation, Task<bool>> predicate)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | |
Func<IPersistentRepresentation, Task<Boolean>> | predicate |
Returns
Type | Description |
---|---|
Task |
Remarks
Each message will be delayed individually.
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentException | When |
ArgumentNullException | When |
FailWithDelay(TimeSpan)
Fail message after specified delay.
Declaration
public Task FailWithDelay(TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay |
Returns
Type | Description |
---|---|
Task |
Remarks
Each message will be delayed individually.
Journal will crash and UntypedPersistentActor.OnPersistFailure will be called on persistent actor.
Use this Journal behavior when it is needed to verify how well a persistent actor will handle network problems and similar issues with underlying journal.
Exceptions
Type | Condition |
---|---|
ArgumentException | When |
Pass()
Pass all messages to journal without interfering.
Declaration
public Task Pass()
Returns
Type | Description |
---|---|
Task |
Remarks
By using this interceptor TestJournal all journal operations will work like in standard MemoryJournal.
PassWithDelay(TimeSpan)
Delay passing all messages to journal by delay
.
Declaration
public Task PassWithDelay(TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | Time by which recovery operation will be delayed. |
Returns
Type | Description |
---|---|
Task |
Remarks
Each message will be delayed individually.
Exceptions
Type | Condition |
---|---|
ArgumentException | When |
SetInterceptorAsync(IJournalInterceptor)
Use custom, user defined interceptor.
Declaration
public Task SetInterceptorAsync(IJournalInterceptor interceptor)
Parameters
Type | Name | Description |
---|---|---|
IJournalInterceptor | interceptor | User defined interceptor which implements IJournalInterceptor interface. |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | When |