Skip to content

Instantly share code, notes, and snippets.

@ndemengel
Created April 26, 2020 15:27
Show Gist options
  • Save ndemengel/ca304b57f945da265d66905e61920961 to your computer and use it in GitHub Desktop.
Save ndemengel/ca304b57f945da265d66905e61920961 to your computer and use it in GitHub Desktop.
Command queue: execution policy
data class ExecutionPolicy(
/** How many processes (coroutines, really) to run in parallel. */
val concurrency: Int,
/**
* How much time to wait before processing a command specification/scheduled task.
*
* Consequently, that time is the window during which tasks are subject to deduplication.
*
* Note: that delay can't have a precision of less than 1 second.
*
* @see CommandSpecification.deduplicate
*/
val delayBeforeConsideringTask: Duration,
/**
* How many times to retry executing a command that fails, before giving up and putting it
* into quarantine.
*/
val maxRetriesBeforeQuarantine: Int,
/**
* Optional rate limit(s) to apply to command consumption, for instance so as to comply with
* limits of some other "provider" (i.e. external system called by commands to provide some
* service).
*/
val rateLimits: RateLimits = noRateLimits(),
/**
* Optional circuit breaking configuration to apply to command consumption.
*/
val circuitBreaking: CircuitBreaking? = null
) { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment