- ..- .-. -... --- -.. ... .-.. - ..- .-. -... --- -.. ... .-..
___________ ______
___ ___/ __/ / ________ _____ ___
__ /__ __ _,___ / /_ ____ __ __ \ / ___/ / /
____ // / / // ___// __ \ / __ \ ____ / / / \ \ / /
__ // /_/ // / / (_/ // (_/ / __ /_/ /___\ \ / /___
_____/ \__,_//_/ /_,___/ \____/ _________//_____//______/
io.turbodsl
- ..- .-. -... --- -.. ... .-.. - ..- .-. -... --- -.. ... .-..
A DSL-engine to turbo-charge your Kotlin development.
io.turbodsl
will not make your application faster, but will make your development easier, and most importantly, write asynchronous code in a natural way using DSL expressions.
io.turbodsl:io-turbodsl-core:1.2.4
:Default
constants to represent0
,1
,-1
.- Parameter
throwOnFailure
forAsyncScope
s. - Additional functions in
AsyncResult
.
io.turbodsl:io-turbodsl-core:1.2.3
:Default
mechanisms update.- Introduce
it
for collection scopes. - Include prefix
async
for all collection DSL expressions.
io.turbodsl:io-turbodsl-core:1.2.2
: Additional functionality for collections- Parallel processing on collections, adding functions for
map
,filter
,forEach
,all
,any
,none
, andcontains
. - Multiple modes for collection asynchronous execution: parallel, buckets, pool.
- All extension-functions for collections use prefix
async
to avoid naming mistakes with existing Kotlin functions. - Parallel flag added for
AsyncScope
to trigger sequential execution for debug / development purposes.
- Parallel processing on collections, adding functions for
io.turbodsl:io-turbodsl-core:1.2.1
: Some-breaking changes- Default values for optional parameters - see Kotlin nullable generics and default values
- Changed:
default
parameter has a default valueUndefined.Parameter
- Added:
defaultFun
parameter to avoid creating instances when a default value is not needed
- Changed:
- Added:
TurboDslError
extendsError
to separate scope-exception hierarchy. - Renamed
ScopeImplementationException
intoScopeImplementationError
, extendingTurboDslError
- Default values for optional parameters - see Kotlin nullable generics and default values
io.turbodsl:io-turbodsl-core:1.2.0
: Breaking changes- Rename
context
toinput
- Rename
dispatcher
tocontext
to follow Kotlin standards forCoroutineContext
- Retry-mechanisms extracted into
retry {...}
expression - refactored to its ownRetryScope
- Rename
io.turbodsl:io-turbodsl-core:1.1.0
: Minor bug fixesio.turbodsl:io-turbodsl-core:1.0.0
: Initial release
// build.gradle.kts
repositories {
maven()
// Also through github-packages
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/migueltt/io-turbodsl")
credentials {
username = <github-user>
password = <github-personal-access-token>
}
}
}
dependencies {
implementation("io.turbodsl:io-turbodsl-core:<version>")
}
Check https://github.com/migueltt/io-turbodsl-tutorial
TurboScope.execute {
job { ... }
async(
job1 = asyncJob {...},
job2 = asyncJob {...},
// up to 10 jobs
job10 = asyncJob {...},
) { ok, r1, r2, ..., r10 ->
// process results
}
async {
// Add any number of asynchronous jobs
asyncJob {...}
:
}
}
Check https://www.turbodsl.io
- Everything is based on DSL expressions using Kotlin approach
- Scopes are created internally to maintain structure and call hierarchy
- Each scope allows additional DSL expressions, making
TurboDSL
usage more idiomatic - The runtime overhead is minimal, comparing to pure Kotlin coroutines implementation.
- Each scope has its own
input
. If it is not explicitly specified, it inherits the parent'sinput
.- This allows to avoid referencing variables across scopes.
- Provide immutability on how incoming data is processed. This is critical when having asynchronous code.
- Asynchronous execution allows 3 different modes:
AsyncMode.CancelNone
: Continue even if any job fails.AsyncMode.CancelFirst
: Cancel running jobs as soon as something fails, keeping results from those completed jobs.AsyncMode.CancelAll
: If one job fails, cancel all other jobs.
- Introduce initial delays, if required.
- Specify timeout (maximum execution time), if required.
- Specify retry mechanisms:
- Number of retries
- Delays between retries.
- Delay factor to increase or decrease delay on subsequent retries
- Retry strategy:
RetryMode.OnTimeoutOnly
: Retry only whentimeout
limit has been reached.RetryMode.OnErrorOnly
: Retry only when an unexpected error was thrown.RetryMode.Always
: Retry always, for any error.RetryMode.Never
: Never retry.