This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server: | |
shutdown: GRACEFUL | |
spring: | |
lifecycle: | |
timeout-per-shutdown-phase: 10s | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server: | |
shutdown: GRACEFUL | |
spring: | |
lifecycle: | |
timeout-per-shutdown-phase: 10s | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
@Suppress("unused") | |
fun servletWebServerFactory(applicationConfig: ApplicationConfig): ServletWebServerFactory { | |
val serverFactory = TomcatServletWebServerFactory() | |
serverFactory.addContextCustomizers(TomcatContextCustomizer { | |
if (it is StandardContext) { | |
val context = it | |
log.info("Current context unloadDelay: {}", context.unloadDelay) | |
context.unloadDelay = Duration.ofMinutes(2).toMillis() | |
log.info("Updated context unloadDelay: {}", context.unloadDelay) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
class LongPauseController (){ | |
@GetMapping("/test") | |
fun longPause(): ResponseEntity<String> { log.info("I AM STILL PROCESSING WILL TAKE AROUND 60 SECS. TO FINISH. PLEASE WAIT ....") | |
Thread.sleep(60 * 1000) | |
log.info("FINALLY! I AM DONE. YOU CAN SHUTDOWN NOW. :)") | |
return ResponseEntity.ok("Thank you for waiting.") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
class SomeController { | |
@Autowired | |
private lateinit var someService: SomeService | |
@Autowired | |
private lateinit var reactiveCircuitBreakerFactory: ReactiveCircuitBreakerFactory<*, *> | |
@GetMapping("/process", produces = [MediaType.TEXT_EVENT_STREAM_VALUE]) | |
fun somRequest(@RequestParam id: Int): Mono<String> { | |
return reactiveCircuitBreakerFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
fun defaultCustomizer(): Customizer<ReactiveResilience4JCircuitBreakerFactory> { | |
return Customizer { | |
it.configureDefault { | |
Resilience4JConfigBuilder.Resilience4JCircuitBreakerConfiguration() | |
.apply { | |
id = "default" | |
circuitBreakerConfig = CircuitBreakerConfig.ofDefaults() | |
timeLimiterConfig = TimeLimiterConfig.ofDefaults() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
class SomeController { | |
@Autowired | |
private lateinit var someService: SomeService | |
@GetMapping("/process", produces = [MediaType.TEXT_EVENT_STREAM_VALUE]) | |
fun somRequest(@RequestParam id: Int): Mono<String> { | |
return someService.process(id) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class SomeService { | |
fun process(id: Int): Mono<String> { | |
return if (id < 1) Mono.error{ IllegalArgumentException("oh!! invalid id") } | |
else Mono.just("Id Found!") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org | |
import akka.actor.{ActorRef, ActorSystem, Props} | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.server.Directives._ | |
import akka.http.scaladsl.server.directives.PathDirectives.pathPrefix | |
import akka.stream.ActorMaterializer | |
import org.user.actor.UserDataActor | |
import org.user.repositories.UserActivityRepositoryImpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.1' | |
services: | |
mongo: | |
image: mongo:4.2.0-rc2-bionic | |
ports: | |
- 1234:27017 | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: root | |
MONGO_INITDB_ROOT_PASSWORD: example |
NewerOlder