Skip to content
Permalink
Browse files

Initial commit

  • Loading branch information...
johanhaleby committed Sep 7, 2018
1 parent 62ea3cf commit 9fca9b233eeac2d65758424b6d61ea9f17b02477
@@ -1,23 +1,10 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*.iws
*.ipr
*.iml
.classpath
.project
.settings
.springBeans
.idea
.kobalt
kobaltBuild
@@ -0,0 +1,23 @@
# ![Logo](https://raw.githubusercontent.com/johanhaleby/kystrix/master/kystrix-logo.png "Kystrix")

Kystrix is a small DSL that allows working with [Hystrix](https://github.com/Netflix/Hystrix) easier from Kotlin.

For example:

```kotlin
val greeting = hystrixObservableCommand<Greeting> {
groupKey("Test")
commandKey("Test-Command")
command {
val response = Dsl.asyncHttpClient().executeRequest(Dsl.get("http://localhost:8080/greeting?firstName=John&lastName=Doe").build())
Observable.from(response).map(Response::getResponseBody).map { body -> ObjectMapper().registerKotlinModule().readValue<Greeting>(body) }
}
commandProperties {
withExecutionTimeoutInMilliseconds(2000)
withExecutionIsolationSemaphoreMaxConcurrentRequests(3)
withFallbackEnabled(false)
}
}.toBlocking().first()
```

This is a work in progress!
@@ -0,0 +1,30 @@
import com.beust.kobalt.*
import com.beust.kobalt.plugin.packaging.*
import com.beust.kobalt.plugin.application.*
import com.beust.kobalt.plugin.kotlin.*

val p = project {
name = "kystrix-core"
group = "com.example"
artifactId = name
version = "0.1"

dependencies {
// compile("com.beust:jcommander:1.68")
compile("org.jetbrains.kotlin:kotlin-runtime:1.2.10")
compile("org.jetbrains.kotlin:kotlin-stdlib:1.2.10")
}

dependenciesTest {
compile("org.testng:testng:6.11")
}

assemble {
jar {
}
}

application {
mainClass = "com.example.MainKt"
}
}
Binary file not shown.
@@ -0,0 +1 @@
kobalt.version=1.0.114
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar "`dirname "$0"`/kobalt/wrapper/kobalt-wrapper.jar" $*
@@ -0,0 +1,4 @@
@echo off
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
java -jar "%DIRNAME%/kobalt/wrapper/kobalt-wrapper.jar" %*
BIN +21.5 KB kystrix-logo.png
Binary file not shown.
@@ -0,0 +1,3 @@
package com.example

fun main(args: Array<String>) = println("\n\nHello Kotlin world from Kobalt\n\n")
@@ -0,0 +1,8 @@
package com.example

import org.testng.annotations.Test

class ExampleTest {
@Test
fun f() = println("Running test")
}

0 comments on commit 9fca9b2

Please sign in to comment.
You can’t perform that action at this time.