package dsl
The atmos.dsl
package defines a domain specific language for constructing and using retry policies.
- Alphabetic
- By Inheritance
- dsl
- Deadlines
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
AbstractEventMonitorExtensions
extends AnyRef
A base class that adds DSL extension methods for the specified event monitors and actions.
-
trait
AbstractLogEventsExtensions
extends AbstractEventMonitorExtensions
A base class that implements DSL extension methods for all logging event monitors.
-
trait
AbstractPrintEventsExtensions
extends AbstractEventMonitorExtensions
A base class that implements DSL extension methods for all printing event monitors.
-
type
BackoffPolicy = atmos.BackoffPolicy
An alias to the
BackoffPolicy
type. -
final
case class
BackoffPolicyExtensions
(self: BackoffPolicy) extends AnyVal with Product with Serializable
Adds DSL extension methods to the backoff policy interface.
Adds DSL extension methods to the backoff policy interface.
- self
The backoff policy to add the extension methods to.
-
case class
BackoffPolicyFactory
(self: (FiniteDuration) ⇒ BackoffPolicy) extends Product with Serializable
A factory for duration-based backoff policies.
A factory for duration-based backoff policies.
- self
The mapping from durations to backoff policies.
-
type
ErrorClassification = atmos.ErrorClassification
An alias to the
ErrorClassification
type. -
type
ErrorClassifier = PartialFunction[Throwable, atmos.ErrorClassification]
An alias to the
ErrorClassifier
type. -
trait
EventLogLevels
[T] extends AnyRef
A tag for logging system specific level types, used to map generic action names to concrete logging levels.
-
type
EventMonitor = atmos.EventMonitor
An alias to the
EventMonitor
type. -
final
case class
LimitAttemptsTerminationFactory
(self: Int) extends AnyVal with Product with Serializable
Adds a termination policy factory named
attempts
toInt
.Adds a termination policy factory named
attempts
toInt
.- self
The maximum number of attempts that the resulting termination policy will specify.
-
case class
LogEventsWithAkkaExtensions
(self: LogEventsWithAkka) extends AbstractLogEventsExtensions with Product with Serializable
Adds DSL extension methods to the atmos.monitor.LogEventsWithAkka interface.
Adds DSL extension methods to the atmos.monitor.LogEventsWithAkka interface.
- self
The Akka event monitor to add the extension methods to.
-
case class
LogEventsWithJavaExtensions
(self: LogEventsWithJava) extends AbstractLogEventsExtensions with Product with Serializable
Exposes extensions on any instance of
monitor.LogEventsWithJava
. -
case class
LogEventsWithSlf4jExtensions
(self: LogEventsWithSlf4j) extends AbstractLogEventsExtensions with Product with Serializable
Exposes extensions on any instance of
monitor.LogEventsWithSlf4j
. -
case class
PrintEventsWithStreamExtensions
(self: PrintEventsWithStream) extends AbstractPrintEventsExtensions with Product with Serializable
Adds DSL extension methods to the atmos.monitor.PrintEventsWithStream interface.
Adds DSL extension methods to the atmos.monitor.PrintEventsWithStream interface.
- self
The print stream event monitor to add the extension methods to.
-
case class
PrintEventsWithWriterExtensions
(self: PrintEventsWithWriter) extends AbstractPrintEventsExtensions with Product with Serializable
Adds DSL extension methods to the atmos.monitor.PrintEventsWithWriter interface.
Adds DSL extension methods to the atmos.monitor.PrintEventsWithWriter interface.
- self
The print writer event monitor to add the extension methods to.
-
type
ResultClassification = atmos.ResultClassification
An alias to the
ResultClassification
type. -
type
ResultClassifier = PartialFunction[Any, atmos.ResultClassification]
An alias to the
ResultClassifier
type. - sealed trait ResultRejection extends AnyRef
-
type
RetryPolicy = atmos.RetryPolicy
An alias to the
RetryPolicy
type. -
final
case class
RetryPolicyExtensions
(self: RetryPolicy) extends AnyVal with Product with Serializable
Adds DSL extension methods to the retry policy interface.
Adds DSL extension methods to the retry policy interface.
- self
The retry policy to add the extension methods to.
-
type
TerminationPolicy = atmos.TerminationPolicy
An alias to the
TerminationPolicy
type. -
final
case class
TerminationPolicyExtensions
(self: TerminationPolicy) extends AnyVal with Product with Serializable
Adds DSL extension methods to the termination policy interface.
Adds DSL extension methods to the termination policy interface.
- self
The termination policy to add the extension methods to.
-
implicit
class
DeadlineSupport
[T] extends AnyRef
Extends the
Future
type with the ability to apply a deadline.Extends the
Future
type with the ability to apply a deadline.- T
The underlying type of the wrapped future.
- Definition Classes
- Deadlines
Value Members
-
val
ErrorClassification: atmos.ErrorClassification.type
An alias to the
ErrorClassification
companion. -
val
ErrorClassifier: atmos.ErrorClassifier.type
An alias to the
ErrorClassifier
companion. -
val
ResultClassification: atmos.ResultClassification.type
An alias to the
ResultClassification
companion. -
val
ResultClassifier: atmos.ResultClassifier.type
An alias to the
ResultClassifier
companion. -
val
RetryPolicy: atmos.RetryPolicy.type
An alias to the
RetryPolicy
companion. -
def
acceptResult: ResultClassification
Returns the
Acceptable
result classification. -
implicit
def
backoffPolicyToBackoffPolicyExtensions(policy: BackoffPolicy): BackoffPolicyExtensions
Provides an implicit extension of the backoff policy interface.
Provides an implicit extension of the backoff policy interface.
- policy
The backoff policy to extend the interface of.
-
def
constantBackoff: BackoffPolicyFactory
Creates a backoff policy that uses the same backoff after every attempt.
-
def
exponentialBackoff: BackoffPolicyFactory
Creates a backoff policy that increases the backoff duration exponentially after every attempt.
-
def
fibonacciBackoff: BackoffPolicyFactory
Creates a backoff policy that increases the backoff duration by repeatedly multiplying by the an approximation of the golden ratio (8 / 5, the sixth and fifth fibonacci numbers).
-
implicit
def
finiteDurationToTerminationPolicy(duration: FiniteDuration): TerminationPolicy
Creates a termination policy that limits a retry operation to the specified time frame for use in expressions like
retryFor { 5.minutes }
.Creates a termination policy that limits a retry operation to the specified time frame for use in expressions like
retryFor { 5.minutes }
.- duration
The maximum duration that the resulting termination policy will specify.
-
implicit
def
finiteDurationToTerminationPolicyExtensions(duration: FiniteDuration): TerminationPolicyExtensions
Adds logical and and or operators to durations for use in expressions like
retryFor { 5.minutes || 5.attempts }
.Adds logical and and or operators to durations for use in expressions like
retryFor { 5.minutes || 5.attempts }
.- duration
The maximum duration that the resulting termination policy will specify.
-
implicit
def
intToLimitAttemptsTerminationPolicyFactory(attempts: Int): LimitAttemptsTerminationFactory
Provides an implicit factory named
attempts
toInt
for use in expressions likeretryFor { 5.attempts }
.Provides an implicit factory named
attempts
toInt
for use in expressions likeretryFor { 5.attempts }
.- attempts
The maximum number of attempts that resulting termination policies will specify.
-
def
keepRetrying: ErrorClassification
Returns the
Recoverable
error classification. -
def
keepRetryingSilently: ErrorClassification
Returns the
SilentlyRecoverable
error classification. -
def
linearBackoff: BackoffPolicyFactory
Creates a backoff policy that increases the backoff duration linearly after every attempt.
-
def
logDebug[T](implicit arg0: EventLogLevels[T]): LogAt[T]
Returns a log action that will submit a log entry at a debug-equivalent level.
-
def
logError[T](implicit arg0: EventLogLevels[T]): LogAt[T]
Returns a log action that will submit a log entry at an error-equivalent level.
-
implicit
def
logEventsWithJavaToLogEventsWithJavaExtensions(policy: LogEventsWithJava): LogEventsWithJavaExtensions
Provides an implicit extension of the atmos.monitor.LogEventsWithJava interface.
Provides an implicit extension of the atmos.monitor.LogEventsWithJava interface.
- policy
The java logging event monitor to extend the interface of.
-
def
logInfo[T](implicit arg0: EventLogLevels[T]): LogAt[T]
Returns a log action that will submit a log entry at an info-equivalent level.
-
def
logNothing: LogNothing.type
Returns a log action that will not log anything.
-
def
logWarning[T](implicit arg0: EventLogLevels[T]): LogAt[T]
Returns a log action that will submit a log entry at a warning-equivalent level.
-
implicit
def
loggerToLogEventsWithJava(logger: Logger): LogEventsWithJava
Creates a new event monitor that submits events to a logger.
Creates a new event monitor that submits events to a logger.
- logger
The logger to supply with event messages.
-
implicit
def
loggerToLogEventsWithJavaExtensions(logger: Logger): LogEventsWithJavaExtensions
Creates a new event monitor extension interface for a logger.
Creates a new event monitor extension interface for a logger.
- logger
The logger to create a new event monitor extension interface for.
-
def
neverRetry: RetryPolicy
Creates a new retry policy that immediately terminates.
-
implicit
def
printEventsWithStreamToPrintEventsWithStreamExtensions(policy: PrintEventsWithStream): PrintEventsWithStreamExtensions
Provides an implicit extension of the atmos.monitor.PrintEventsWithStream interface.
Provides an implicit extension of the atmos.monitor.PrintEventsWithStream interface.
- policy
The print stream event monitor to extend the interface of.
-
implicit
def
printEventsWithWriterToPrintEventsWithWriterExtensions(policy: PrintEventsWithWriter): PrintEventsWithWriterExtensions
Provides an implicit extension of the atmos.monitor.PrintEventsWithWriter interface.
Provides an implicit extension of the atmos.monitor.PrintEventsWithWriter interface.
- policy
The print writer event monitor to extend the interface of.
-
def
printMessage: PrintAction
Returns a print action that will print only an event message.
-
def
printMessageAndStackTrace: PrintAction
Returns a print action that will print an event message and stack trace.
-
def
printNothing: PrintAction
Returns a print action that will print no text.
-
implicit
def
printStreamToPrintEventsWithStream(stream: PrintStream): PrintEventsWithStream
Creates a new event monitor that prints messages to a stream.
Creates a new event monitor that prints messages to a stream.
- stream
The stream to print events to.
-
implicit
def
printStreamToPrintEventsWithStreamExtensions(stream: PrintStream): PrintEventsWithStreamExtensions
Creates a new event monitor extension interface for a print stream.
Creates a new event monitor extension interface for a print stream.
- stream
The print stream to create a new event monitor extension interface for.
-
implicit
def
printWriterToPrintEventsWithWriter(writer: PrintWriter): PrintEventsWithWriter
Creates a new event monitor that prints messages to a writer.
Creates a new event monitor that prints messages to a writer.
- writer
The writer to print events to.
-
implicit
def
printWriterToPrintEventsWithWriterExtensions(writer: PrintWriter): PrintEventsWithWriterExtensions
Creates a new event monitor extension interface for a print writer.
Creates a new event monitor extension interface for a print writer.
- writer
The print writer to create a new event monitor extension interface for.
-
def
rejectResult: ResultRejection
Returns a factory for an
Unacceptable
result classification with an optional status. -
def
retry[T](name: Option[String])(operation: ⇒ T)(implicit policy: RetryPolicy, clock: Clock): T
Performs the specified optionally named operation synchronously, retrying according to the implicit retry policy.
Performs the specified optionally named operation synchronously, retrying according to the implicit retry policy.
- name
The optional name of the operation.
- operation
The operation to repeatedly perform.
- policy
The retry policy to execute with.
- clock
The clock used to track time and wait out backoff delays.
-
def
retry[T](name: String)(operation: ⇒ T)(implicit policy: RetryPolicy, clock: Clock): T
Performs the specified named operation synchronously, retrying according to the implicit retry policy.
Performs the specified named operation synchronously, retrying according to the implicit retry policy.
- name
The name of the operation.
- operation
The operation to repeatedly perform.
- policy
The retry policy to execute with.
- clock
The clock used to track time and wait out backoff delays.
-
def
retry[T]()(operation: ⇒ T)(implicit policy: RetryPolicy, clock: Clock): T
Performs the specified operation synchronously, retrying according to the implicit retry policy.
Performs the specified operation synchronously, retrying according to the implicit retry policy.
- operation
The operation to repeatedly perform.
- policy
The retry policy to execute with.
- clock
The clock used to track time and wait out backoff delays.
-
def
retryAsync[T](name: Option[String])(operation: ⇒ Future[T])(implicit policy: RetryPolicy, context: ExecutionContext, clock: Clock): Future[T]
Performs the specified optionally named operation asynchronously, retrying according to the implicit retry policy.
Performs the specified optionally named operation asynchronously, retrying according to the implicit retry policy.
- name
The optional name of the operation.
- operation
The operation to repeatedly perform.
- policy
The retry policy to execute with.
- context
The execution context to retry on.
- clock
The clock used to track time and schedule backoff notifications.
-
def
retryAsync[T](name: String)(operation: ⇒ Future[T])(implicit policy: RetryPolicy, context: ExecutionContext, clock: Clock): Future[T]
Performs the specified optionally named operation asynchronously, retrying according to the implicit retry policy.
Performs the specified optionally named operation asynchronously, retrying according to the implicit retry policy.
- name
The name of the operation.
- operation
The operation to repeatedly perform.
- policy
The retry policy to execute with.
- context
The execution context to retry on.
- clock
The clock used to track time and schedule backoff notifications.
-
def
retryAsync[T]()(operation: ⇒ Future[T])(implicit policy: RetryPolicy, context: ExecutionContext, clock: Clock): Future[T]
Performs the specified operation asynchronously, retrying according to the implicit retry policy.
Performs the specified operation asynchronously, retrying according to the implicit retry policy.
- operation
The operation to repeatedly perform.
- policy
The retry policy to execute with.
- context
The execution context to retry on.
- clock
The clock used to track time and schedule backoff notifications.
-
def
retryFor(termination: TerminationPolicy): RetryPolicy
Creates a new retry policy based on the specified termination policy.
Creates a new retry policy based on the specified termination policy.
- termination
The termination policy that will be used by the new retry policy.
-
def
retryForever: RetryPolicy
Creates a new retry policy that never terminates.
-
implicit
def
retryPolicyToRetryPolicyExtensions(policy: RetryPolicy): RetryPolicyExtensions
Provides an implicit extension of the retry policy interface.
Provides an implicit extension of the retry policy interface.
- policy
The retry policy to extend the interface of.
-
def
retrying: RetryPolicy
Creates a new default retry policy.
-
def
selectedBackoff(f: (Try[Any]) ⇒ BackoffPolicy): BackoffPolicy
Creates a backoff policy selects another policy based on the most recently evaluated outcome.
Creates a backoff policy selects another policy based on the most recently evaluated outcome.
- f
The function that maps from outcomes to backoff policies.
-
def
stopRetrying: ErrorClassification
Returns the
Fatal
error classification. -
implicit
def
terminationPolicyToTerminationPolicyExtensions(policy: TerminationPolicy): TerminationPolicyExtensions
Provides an implicit extension of the termination policy interface.
Provides an implicit extension of the termination policy interface.
- policy
The termination policy to extend the interface of.
-
object
AkkaSupport
Separate namespace for optional Akka support.
-
object
BackoffPolicyFactory
extends Serializable
Factory for backoff policy factories.
-
object
EventLogLevels
Declarations of the default logging level tags.
- object ResultRejection extends ResultRejection
-
object
Slf4jSupport
Separate namespace for optional SLF4J support.