SkillAgentSearch skills...

KediatR

Mediator implementation in Kotlin with native coroutine support

Install / Use

/learn @Trendyol/KediatR
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

kediatR Release codecov OpenSSF Scorecard

<img style="float: left" alt="Humus! The kediatr mascot" src="/humus.png" alt="drawing" width="80"/>

Mediator implementation in kotlin with native coroutine support. Supports Spring-Boot, Quarkus and Koin dependency providers.

[!TIP] "kedi" in Turkish means cat 🐱 and kediatR rhymes with the C# equivalent library mediatR :)

Documentation is available at https://trendyol.github.io/kediatR/

Show me the code

class PingCommand : Request.Unit // or
class PingQuery : Request<String> // or
class PingNotification : Notification

class PingCommandHandler : RequestHandler.Unit<PingCommand> {
  override suspend fun handle(command: PingCommand) : Unit {
    println("Pong!")
  }
}
class PingQueryHandler : RequestHandler<PingQuery, String> {
  override suspend fun handle(query: PingQuery): String {
    return "Pong!"
  }
}

class PingNotificationHandler : NotificationHandler<PingNotification> {
  override suspend fun handle(notification: PingNotification) {
    println("Pong!")
  }
}

class MeasurePipelineBehaviour : PipelineBehaviour {

  override val order: Int = 0

  override suspend fun <TRequest, TResponse> handle(
    request: TRequest,
    next: RequestHandlerDelegate<TRequest, TResponse>
  ): TResponse {
    val start = System.currentTimeMillis()
    val response = next(request)
    val end = System.currentTimeMillis()
    println("Request ${request::class.simpleName} took ${end - start} ms")
    return response
  }
}

val mediator = // create mediator instance in-memory or with dependency injection, take a look at the documentation
mediator.send(PingCommand()) // 1..1
mediator.send(PingQuery()) // 1..1
mediator.publish(PingNotification()) // 0..N

Related Skills

View on GitHub
GitHub Stars218
CategoryCustomer
Updated7h ago
Forks29

Languages

Kotlin

Security Score

100/100

Audited on Mar 30, 2026

No findings