Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (27 sloc) 876 Bytes
package guide.modules.resilience
import io.github.resilience4j.bulkhead.Bulkhead
import io.github.resilience4j.bulkhead.BulkheadConfig
import org.http4k.core.Method
import org.http4k.core.Request
import org.http4k.core.Response
import org.http4k.core.Status
import org.http4k.core.then
import org.http4k.filter.ResilienceFilters
import kotlin.concurrent.thread
fun main() {
// configure the Bulkhead filter here
val config = BulkheadConfig.custom()
val bulkheading = ResilienceFilters.Bulkheading(Bulkhead.of("bulkhead", config)).then {
// throw a bunch of requests at the filter - only 5 should pass
(1..10).forEach {
thread {
println(bulkheading(Request(Method.GET, "/")).status)