diff --git a/index.html b/index.html index ae12d79..842238c 100644 --- a/index.html +++ b/index.html @@ -371,27 +371,12 @@
  • - + - Review Our IntelliJ Plugin + Check Our IntelliJ Plugin - -
  • @@ -423,186 +408,114 @@

    kediatR

    Mediator implementation for Kotlin.

    Usage

    -
    + $version = 3.0.0
    +
    + $version = 3.1.1
     
    Gradle -To use the SNAPSHOT version you need to add repository to your dependency management: - -
     maven {
    -     url = uri("https://oss.sonatype.org/content/repositories/snapshots")
    - }
    -
    - kediatR-core -
     implementation("com.trendyol:kediatr-core:$version")
    +
     implementation("com.trendyol:kediatr-core:$version")
     
    -kediatR-spring-starter +kediatR provides two different packages for spring-boot 2x and 3x. You can use the following dependencies according to +your spring-boot version. -
     implementation("com.trendyol:kediatr-spring-starter:$version")
    +
     implementation("com.trendyol:kediatr-spring-boot-2x-starter:$version")
    +
    +  // or
    +
    + implementation("com.trendyol:kediatr-spring-boot-3x-starter:$version")
     
    kediatR-koin-starter -
     implementation("com.trendyol:kediatr-koin-starter:$version")
    +
     implementation("com.trendyol:kediatr-koin-starter:$version")
     
    kediatR-quarkus-starter -
     implementation("com.trendyol:kediatr-quarkus-starter:$version")
    -
    - -
    - -
    -Maven - -To use the SNAPSHOT version you need to add repository to your dependency management: - -
    <profiles>
    -  <profile>
    -     <id>allow-snapshots</id>
    -        <activation><activeByDefault>true</activeByDefault></activation>
    -     <repositories>
    -       <repository>
    -         <id>snapshots-repo</id>
    -         <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    -         <releases><enabled>false</enabled></releases>
    -         <snapshots><enabled>true</enabled></snapshots>
    -       </repository>
    -     </repositories>
    -   </profile>
    -</profiles>
    -
    - -kediatR-core - -
    <dependency>
    -  <groupId>com.trendyol</groupId>
    -  <artifactId>kediatr-core</artifactId>
    -  <version>$version</version>
    -</dependency>
    -
    - -kediatR-spring-starter - -
    <dependency>
    -  <groupId>com.trendyol</groupId>
    -  <artifactId>kediatr-spring-starter</artifactId>
    -  <version>$version</version>
    -</dependency>
    -
    - -kediatR-koin-starter - -
    <dependency>
    -  <groupId>com.trendyol</groupId>
    -  <artifactId>kediatr-koin-starter</artifactId>
    -  <version>$version</version>
    -</dependency>
    -
    - -kediatR-quarkus-starter - -
    <dependency>
    -  <groupId>com.trendyol</groupId>
    -  <artifactId>kediatr-quarkus-starter</artifactId>
    -  <version>$version</version>
    -</dependency>
    +
     implementation("com.trendyol:kediatr-quarkus-starter:$version")
     

    Command dispatching

    -
    class ManualDependencyProvider(
    -    private val handlerMap: HashMap<Class<*>, Any>
    -) : DependencyProvider {
    -    override fun <T> getSingleInstanceOf(clazz: Class<T>): T {
    -        return handlerMap[clazz] as T
    -    }
    -
    -    override fun <T> getSubTypesOf(clazz: Class<T>): Collection<Class<T>> {
    -        return handlerMap
    -            .filter { it.key.interfaces.contains(clazz) }
    -            .map { it.key as Class<T> }
    -    }
    -}
    -
    -fun main() {
    -    val handler = HelloCommandHandler()
    -    val handlers: HashMap<Class<*>, Any> = hashMapOf(Pair(HelloCommandHandler::class.java, handler))
    -    val provider = ManualDependencyProvider(handlers)
    -    val mediator: Mediator = MediatorBuilder(provider).build()
    -    mediator.send(HelloCommand("hello"))
    -}
    -
    -class HelloCommand(val message: String) : Command
    -
    -class HelloCommandHandler : CommandHandler<HelloCommand> {
    -    override suspend fun handle(command: HelloCommand) {
    -        println(command.message)
    -    }
    -}
    +
    import com.trendyol.kediatr.MappingDependencyProvider.Companion.createMediator
    +
    +fun main() {
    +    val handler = HelloCommandHandler()
    +    val mediator: Mediator = createMediator(handlers = listOf(handler))
    +    mediator.send(HelloCommand("hello"))
    +}
    +
    +class HelloCommand(val message: String) : Command
    +
    +class HelloCommandHandler : CommandHandler<HelloCommand> {
    +    override suspend fun handle(command: HelloCommand) {
    +        println(command.message)
    +    }
    +}
     

    Query dispatching

    -
    fun main() {
    -    val handler = GetSomeDataQueryHandler()
    -    val handlers: HashMap<Class<*>, Any> = hashMapOf(Pair(GetSomeDataQuery::class.java, handler))
    -    val provider = ManualDependencyProvider(handlers)
    -    val mediator: Mediator = MediatorBuilder(provider).build()
    -    val result: String = mediator.send(GetSomeDataQuery(1))
    -    println(result)
    -}
    -
    -class GetSomeDataQuery(val id: Int) : Query<String>
    -
    -class GetSomeDataQueryHandler : QueryHandler<GetSomeDataQuery, String> {
    -    override suspend fun handle(query: GetSomeDataQuery): String {
    -        // you can use properties in the query object to retrieve data from somewhere
    -        // val result = getDataFromSomewhere(query.id)
    -        // return result
    -
    -        return "hello"
    -    }
    -}
    +
    import com.trendyol.kediatr.MappingDependencyProvider.Companion.createMediator
    +
    +fun main() {
    +    val handler = GetSomeDataQueryHandler()
    +    val mediator: Mediator = createMediator(handlers = listOf(handler))
    +    val result: String = mediator.send(GetSomeDataQuery(1))
    +    println(result)
    +}
    +
    +class GetSomeDataQuery(val id: Int) : Query<String>
    +
    +class GetSomeDataQueryHandler : QueryHandler<GetSomeDataQuery, String> {
    +    override suspend fun handle(query: GetSomeDataQuery): String {
    +        // you can use properties in the query object to retrieve data from somewhere
    +        // val result = getDataFromSomewhere(query.id)
    +        // return result
    +
    +        return "hello"
    +    }
    +}
     

    Pipeline Behavior

    -
    class CommandProcessingPipeline : PipelineBehavior {
    -    override suspend fun <TRequest, TResponse> handle(
    -        request: TRequest,
    -        next: RequestHandlerDelegate<TRequest, TResponse>
    -    ): TResponse {
    -        println("Starting process.")
    -        val result = next(request)
    -        println("Ending process.")
    -        return result
    -    }
    -}
    +
    class CommandProcessingPipeline : PipelineBehavior {
    +
    +    override val order: Int = 1
    +
    +    override suspend fun <TRequest, TResponse> handle(
    +        request: TRequest,
    +        next: RequestHandlerDelegate<TRequest, TResponse>
    +    ): TResponse {
    +        println("Starting process.")
    +        val result = next(request)
    +        println("Ending process.")
    +        return result
    +    }
    +}
     

    SpringBoot

    • Add kediatr-spring dependency to your maven or gradle dependencies
    -
    @Service
    -class UserService(private val mediator: Mediator) {
    -    suspend fun findUser(id: Long) {
    -        return mediator.send(GetUserByIdQuery(id))
    -    }
    -}
    -
    -class GetUserByIdQuery(private val id: Long) : Query<UserDto>
    -
    -@Component
    -class GetUserByIdQueryHandler(private val userRepository: UserRepository): QueryHandler<GetUserByIdQuery, UserDto> {
    -    override suspend fun handle(query: GetUserByIdQuery): UserDto {
    -        val user = userRepository.findById(query.id)
    -        // do some operation on user
    -        return UserDto(user.id, user.name, user.surname)
    -    }
    -}
    +
    @Service
    +class UserService(private val mediator: Mediator) {
    +    suspend fun findUser(id: Long) {
    +        return mediator.send(GetUserByIdQuery(id))
    +    }
    +}
    +
    +class GetUserByIdQuery(private val id: Long) : Query<UserDto>
    +
    +@Component
    +class GetUserByIdQueryHandler(private val userRepository: UserRepository): QueryHandler<GetUserByIdQuery, UserDto> {
    +    override suspend fun handle(query: GetUserByIdQuery): UserDto {
    +        val user = userRepository.findById(query.id)
    +        // do some operation on user
    +        return UserDto(user.id, user.name, user.surname)
    +    }
    +}
     

    Koin

    Simply inject KediatR as a singleton dependency with any module and inject handler instances. @@ -610,26 +523,26 @@

    Koin&par reflection. Please note that this is an experimental release and reflection strategy with koin is a little wonky. Please open a pull request if you think there is a better implementation.

    -
    val kediatRModule = module {
    -    single { KediatRKoin.getMediator() }
    -    single { GetUserByIdQueryHandler(get()) }
    -}
    -
    -class UserService(private val mediator: Mediator) {
    -    fun findUser(id: Long) {
    -        return mediator.send(GetUserByIdQuery(id))
    -    }
    -}
    -
    -class GetUserByIdQuery(private val id: Long) : Query<UserDto>
    -
    -class GetUserByIdQueryHandler(private val userRepository: UserRepository) : QueryHandler<GetUserByIdQuery, UserDto> {
    -    fun handle(query: GetUserByIdQuery): UserDto {
    -        val user = userRepository.findById(query.id)
    -        // do some operation on user
    -        return UserDto(user.id, user.name, user.surname)
    -    }
    -}
    +
    val kediatRModule = module {
    +    single { KediatRKoin.getMediator() }
    +    single { GetUserByIdQueryHandler(get()) }
    +}
    +
    +class UserService(private val mediator: Mediator) {
    +    fun findUser(id: Long) {
    +        return mediator.send(GetUserByIdQuery(id))
    +    }
    +}
    +
    +class GetUserByIdQuery(private val id: Long) : Query<UserDto>
    +
    +class GetUserByIdQueryHandler(private val userRepository: UserRepository) : QueryHandler<GetUserByIdQuery, UserDto> {
    +    fun handle(query: GetUserByIdQuery): UserDto {
    +        val user = userRepository.findById(query.id)
    +        // do some operation on user
    +        return UserDto(user.id, user.name, user.surname)
    +    }
    +}
     

    Quarkus

      @@ -637,37 +550,30 @@

      Quarkus
        quarkus:
      -    index-dependency:
      -      kediatr:
      -        group-id: com.trendyol
      -        artifact-id: kediatr-quarkus-starter
      - ```
      -
      -* Add @Startup annotation for every handler so that KediatR can prepare queries and commands on beginning of the
      -  application.
      -
      -```kotlin
      -class UserService(private val mediator: mediator) {
      -    fun findUser(id: Long) {
      -        return mediator.send(GetUserByIdQuery(id))
      -    }
      -}
      -
      -class GetUserByIdQuery(private val id: Long) : Query<UserDto>
      -
      -@ApplicationScoped
      -@Startup
      -class GetUserByIdQueryHandler(private val userRepository: UserRepository) : QueryHandler<GetUserByIdQuery, UserDto> {
      -    override suspend fun handle(query: GetUserByIdQuery): UserDto {
      -        val user = userRepository.findById(query.id)
      -        // do some operation on user
      -        return UserDto(user.id, user.name, user.surname)
      -    }
      -}
      +
        quarkus:
      +    index-dependency:
      +      kediatr:
      +        group-id: com.trendyol
      +        artifact-id: kediatr-quarkus-starter
      +
      +
      class UserService(private val mediator: mediator) {
      +    fun findUser(id: Long) {
      +        return mediator.send(GetUserByIdQuery(id))
      +    }
      +}
      +
      +class GetUserByIdQuery(private val id: Long) : Query<UserDto>
      +
      +@ApplicationScoped
      +class GetUserByIdQueryHandler(private val userRepository: UserRepository) : QueryHandler<GetUserByIdQuery, UserDto> {
      +    override suspend fun handle(query: GetUserByIdQuery): UserDto {
      +        val user = userRepository.findById(query.id)
      +        // do some operation on user
      +        return UserDto(user.id, user.name, user.surname)
      +    }
      +}
       
      -

      Review Our IntelliJ Plugin

      -

      Warning: This plugin does not support v2.0+ yet.

      +

      Check Our IntelliJ Plugin

      https://plugins.jetbrains.com/plugin/16017-kediatr-helper

      Screencast 1

      Screencast 2

      diff --git a/search/search_index.json b/search/search_index.json index 6f37085..0722de7 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"kediatR","text":"

      Mediator implementation for Kotlin.

      "},{"location":"#usage","title":"Usage","text":"
      + $version = 3.0.0\n
      Gradle To use the SNAPSHOT version you need to add repository to your dependency management:
       maven {\n     url = uri(\"https://oss.sonatype.org/content/repositories/snapshots\")\n }\n
      kediatR-core
       implementation(\"com.trendyol:kediatr-core:$version\")\n
      kediatR-spring-starter
       implementation(\"com.trendyol:kediatr-spring-starter:$version\")\n
      kediatR-koin-starter
       implementation(\"com.trendyol:kediatr-koin-starter:$version\")\n
      kediatR-quarkus-starter
       implementation(\"com.trendyol:kediatr-quarkus-starter:$version\")\n
      Maven To use the SNAPSHOT version you need to add repository to your dependency management:
      <profiles>\n  <profile>\n     <id>allow-snapshots</id>\n        <activation><activeByDefault>true</activeByDefault></activation>\n     <repositories>\n       <repository>\n         <id>snapshots-repo</id>\n         <url>https://oss.sonatype.org/content/repositories/snapshots</url>\n         <releases><enabled>false</enabled></releases>\n         <snapshots><enabled>true</enabled></snapshots>\n       </repository>\n     </repositories>\n   </profile>\n</profiles>\n
      kediatR-core
      <dependency>\n  <groupId>com.trendyol</groupId>\n  <artifactId>kediatr-core</artifactId>\n  <version>$version</version>\n</dependency>\n
      kediatR-spring-starter
      <dependency>\n  <groupId>com.trendyol</groupId>\n  <artifactId>kediatr-spring-starter</artifactId>\n  <version>$version</version>\n</dependency>\n
      kediatR-koin-starter
      <dependency>\n  <groupId>com.trendyol</groupId>\n  <artifactId>kediatr-koin-starter</artifactId>\n  <version>$version</version>\n</dependency>\n
      kediatR-quarkus-starter
      <dependency>\n  <groupId>com.trendyol</groupId>\n  <artifactId>kediatr-quarkus-starter</artifactId>\n  <version>$version</version>\n</dependency>\n
      "},{"location":"#command-dispatching","title":"Command dispatching","text":"
      class ManualDependencyProvider(\n    private val handlerMap: HashMap<Class<*>, Any>\n) : DependencyProvider {\n    override fun <T> getSingleInstanceOf(clazz: Class<T>): T {\n        return handlerMap[clazz] as T\n    }\n\n    override fun <T> getSubTypesOf(clazz: Class<T>): Collection<Class<T>> {\n        return handlerMap\n            .filter { it.key.interfaces.contains(clazz) }\n            .map { it.key as Class<T> }\n    }\n}\n\nfun main() {\n    val handler = HelloCommandHandler()\n    val handlers: HashMap<Class<*>, Any> = hashMapOf(Pair(HelloCommandHandler::class.java, handler))\n    val provider = ManualDependencyProvider(handlers)\n    val mediator: Mediator = MediatorBuilder(provider).build()\n    mediator.send(HelloCommand(\"hello\"))\n}\n\nclass HelloCommand(val message: String) : Command\n\nclass HelloCommandHandler : CommandHandler<HelloCommand> {\n    override suspend fun handle(command: HelloCommand) {\n        println(command.message)\n    }\n}\n
      "},{"location":"#query-dispatching","title":"Query dispatching","text":"
      fun main() {\n    val handler = GetSomeDataQueryHandler()\n    val handlers: HashMap<Class<*>, Any> = hashMapOf(Pair(GetSomeDataQuery::class.java, handler))\n    val provider = ManualDependencyProvider(handlers)\n    val mediator: Mediator = MediatorBuilder(provider).build()\n    val result: String = mediator.send(GetSomeDataQuery(1))\n    println(result)\n}\n\nclass GetSomeDataQuery(val id: Int) : Query<String>\n\nclass GetSomeDataQueryHandler : QueryHandler<GetSomeDataQuery, String> {\n    override suspend fun handle(query: GetSomeDataQuery): String {\n        // you can use properties in the query object to retrieve data from somewhere\n        // val result = getDataFromSomewhere(query.id)\n        // return result\n\n        return \"hello\"\n    }\n}\n
      "},{"location":"#pipeline-behavior","title":"Pipeline Behavior","text":"
      class CommandProcessingPipeline : PipelineBehavior {\n    override suspend fun <TRequest, TResponse> handle(\n        request: TRequest,\n        next: RequestHandlerDelegate<TRequest, TResponse>\n    ): TResponse {\n        println(\"Starting process.\")\n        val result = next(request)\n        println(\"Ending process.\")\n        return result\n    }\n}\n
      "},{"location":"#springboot","title":"SpringBoot","text":"
      • Add kediatr-spring dependency to your maven or gradle dependencies
      @Service\nclass UserService(private val mediator: Mediator) {\n    suspend fun findUser(id: Long) {\n        return mediator.send(GetUserByIdQuery(id))\n    }\n}\n\nclass GetUserByIdQuery(private val id: Long) : Query<UserDto>\n\n@Component\nclass GetUserByIdQueryHandler(private val userRepository: UserRepository): QueryHandler<GetUserByIdQuery, UserDto> {\n    override suspend fun handle(query: GetUserByIdQuery): UserDto {\n        val user = userRepository.findById(query.id)\n        // do some operation on user\n        return UserDto(user.id, user.name, user.surname)\n    }\n}\n
      "},{"location":"#koin","title":"Koin","text":"

      Simply inject KediatR as a singleton dependency with any module and inject handler instances. KediatRKoin.getMediator() must be in the same module with at least one Handler to get correct package name for reflection. Please note that this is an experimental release and reflection strategy with koin is a little wonky. Please open a pull request if you think there is a better implementation.

      val kediatRModule = module {\n    single { KediatRKoin.getMediator() }\n    single { GetUserByIdQueryHandler(get()) }\n}\n\nclass UserService(private val mediator: Mediator) {\n    fun findUser(id: Long) {\n        return mediator.send(GetUserByIdQuery(id))\n    }\n}\n\nclass GetUserByIdQuery(private val id: Long) : Query<UserDto>\n\nclass GetUserByIdQueryHandler(private val userRepository: UserRepository) : QueryHandler<GetUserByIdQuery, UserDto> {\n    fun handle(query: GetUserByIdQuery): UserDto {\n        val user = userRepository.findById(query.id)\n        // do some operation on user\n        return UserDto(user.id, user.name, user.surname)\n    }\n}\n
      "},{"location":"#quarkus","title":"Quarkus","text":"
      • Add kediatr-quarkus-starter dependency to your dependencies
      • Quarkus does not index 3rd party libraries unless you explicitly indicate. Add this configuration to ** application.properties** file.
        quarkus:\n    index-dependency:\n      kediatr:\n        group-id: com.trendyol\n        artifact-id: kediatr-quarkus-starter\n ```\n\n* Add @Startup annotation for every handler so that KediatR can prepare queries and commands on beginning of the\n  application.\n\n```kotlin\nclass UserService(private val mediator: mediator) {\n    fun findUser(id: Long) {\n        return mediator.send(GetUserByIdQuery(id))\n    }\n}\n\nclass GetUserByIdQuery(private val id: Long) : Query<UserDto>\n\n@ApplicationScoped\n@Startup\nclass GetUserByIdQueryHandler(private val userRepository: UserRepository) : QueryHandler<GetUserByIdQuery, UserDto> {\n    override suspend fun handle(query: GetUserByIdQuery): UserDto {\n        val user = userRepository.findById(query.id)\n        // do some operation on user\n        return UserDto(user.id, user.name, user.surname)\n    }\n}\n
      "},{"location":"#review-our-intellij-plugin","title":"Review Our IntelliJ Plugin","text":""},{"location":"#warning-this-plugin-does-not-support-v20-yet","title":"Warning: This plugin does not support v2.0+ yet.","text":"

      https://plugins.jetbrains.com/plugin/16017-kediatr-helper

      Source: https://github.com/bilal-kilic/kediatr-helper

      "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"kediatR","text":"

      Mediator implementation for Kotlin.

      "},{"location":"#usage","title":"Usage","text":"
      + $version = 3.1.1\n
      Gradle kediatR-core
       implementation(\"com.trendyol:kediatr-core:$version\")\n
      kediatR provides two different packages for spring-boot 2x and 3x. You can use the following dependencies according to your spring-boot version.
       implementation(\"com.trendyol:kediatr-spring-boot-2x-starter:$version\")\n\n  // or\n\n implementation(\"com.trendyol:kediatr-spring-boot-3x-starter:$version\")\n
      kediatR-koin-starter
       implementation(\"com.trendyol:kediatr-koin-starter:$version\")\n
      kediatR-quarkus-starter
       implementation(\"com.trendyol:kediatr-quarkus-starter:$version\")\n
      "},{"location":"#command-dispatching","title":"Command dispatching","text":"
      import com.trendyol.kediatr.MappingDependencyProvider.Companion.createMediator\n\nfun main() {\n    val handler = HelloCommandHandler()\n    val mediator: Mediator = createMediator(handlers = listOf(handler))\n    mediator.send(HelloCommand(\"hello\"))\n}\n\nclass HelloCommand(val message: String) : Command\n\nclass HelloCommandHandler : CommandHandler<HelloCommand> {\n    override suspend fun handle(command: HelloCommand) {\n        println(command.message)\n    }\n}\n
      "},{"location":"#query-dispatching","title":"Query dispatching","text":"
      import com.trendyol.kediatr.MappingDependencyProvider.Companion.createMediator\n\nfun main() {\n    val handler = GetSomeDataQueryHandler()\n    val mediator: Mediator = createMediator(handlers = listOf(handler))\n    val result: String = mediator.send(GetSomeDataQuery(1))\n    println(result)\n}\n\nclass GetSomeDataQuery(val id: Int) : Query<String>\n\nclass GetSomeDataQueryHandler : QueryHandler<GetSomeDataQuery, String> {\n    override suspend fun handle(query: GetSomeDataQuery): String {\n        // you can use properties in the query object to retrieve data from somewhere\n        // val result = getDataFromSomewhere(query.id)\n        // return result\n\n        return \"hello\"\n    }\n}\n
      "},{"location":"#pipeline-behavior","title":"Pipeline Behavior","text":"
      class CommandProcessingPipeline : PipelineBehavior {\n\n    override val order: Int = 1\n\n    override suspend fun <TRequest, TResponse> handle(\n        request: TRequest,\n        next: RequestHandlerDelegate<TRequest, TResponse>\n    ): TResponse {\n        println(\"Starting process.\")\n        val result = next(request)\n        println(\"Ending process.\")\n        return result\n    }\n}\n
      "},{"location":"#springboot","title":"SpringBoot","text":"
      • Add kediatr-spring dependency to your maven or gradle dependencies
      @Service\nclass UserService(private val mediator: Mediator) {\n    suspend fun findUser(id: Long) {\n        return mediator.send(GetUserByIdQuery(id))\n    }\n}\n\nclass GetUserByIdQuery(private val id: Long) : Query<UserDto>\n\n@Component\nclass GetUserByIdQueryHandler(private val userRepository: UserRepository): QueryHandler<GetUserByIdQuery, UserDto> {\n    override suspend fun handle(query: GetUserByIdQuery): UserDto {\n        val user = userRepository.findById(query.id)\n        // do some operation on user\n        return UserDto(user.id, user.name, user.surname)\n    }\n}\n
      "},{"location":"#koin","title":"Koin","text":"

      Simply inject KediatR as a singleton dependency with any module and inject handler instances. KediatRKoin.getMediator() must be in the same module with at least one Handler to get correct package name for reflection. Please note that this is an experimental release and reflection strategy with koin is a little wonky. Please open a pull request if you think there is a better implementation.

      val kediatRModule = module {\n    single { KediatRKoin.getMediator() }\n    single { GetUserByIdQueryHandler(get()) }\n}\n\nclass UserService(private val mediator: Mediator) {\n    fun findUser(id: Long) {\n        return mediator.send(GetUserByIdQuery(id))\n    }\n}\n\nclass GetUserByIdQuery(private val id: Long) : Query<UserDto>\n\nclass GetUserByIdQueryHandler(private val userRepository: UserRepository) : QueryHandler<GetUserByIdQuery, UserDto> {\n    fun handle(query: GetUserByIdQuery): UserDto {\n        val user = userRepository.findById(query.id)\n        // do some operation on user\n        return UserDto(user.id, user.name, user.surname)\n    }\n}\n
      "},{"location":"#quarkus","title":"Quarkus","text":"
      • Add kediatr-quarkus-starter dependency to your dependencies
      • Quarkus does not index 3rd party libraries unless you explicitly indicate. Add this configuration to ** application.properties** file.
        quarkus:\n    index-dependency:\n      kediatr:\n        group-id: com.trendyol\n        artifact-id: kediatr-quarkus-starter\n
      class UserService(private val mediator: mediator) {\n    fun findUser(id: Long) {\n        return mediator.send(GetUserByIdQuery(id))\n    }\n}\n\nclass GetUserByIdQuery(private val id: Long) : Query<UserDto>\n\n@ApplicationScoped\nclass GetUserByIdQueryHandler(private val userRepository: UserRepository) : QueryHandler<GetUserByIdQuery, UserDto> {\n    override suspend fun handle(query: GetUserByIdQuery): UserDto {\n        val user = userRepository.findById(query.id)\n        // do some operation on user\n        return UserDto(user.id, user.name, user.surname)\n    }\n}\n
      "},{"location":"#check-our-intellij-plugin","title":"Check Our IntelliJ Plugin","text":"

      https://plugins.jetbrains.com/plugin/16017-kediatr-helper

      Source: https://github.com/bilal-kilic/kediatr-helper

      "}]} \ No newline at end of file