All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.caesarealabs.rpc4k.runtime.implementation.ServerUtils.kt Maven / Gradle / Ivy

package com.caesarealabs.rpc4k.runtime.implementation

import com.caesarealabs.logging.LoggingFactory
import com.caesarealabs.logging.PrintLoggingFactory
import com.caesarealabs.rpc4k.runtime.api.*
import com.caesarealabs.rpc4k.runtime.user.Rpc4kIndex
import com.caesarealabs.rpc4k.runtime.user.components.JsonFormat

public sealed interface RpcResult {
    public class Success(public val bytes: ByteArray) : RpcResult
    public class Error(public val message: String,public val errorType: RpcError) : RpcResult
}


public fun  Rpc4kIndex.createHandlerConfig(
    eventManager: EventManager,
    engine: RpcMessageLauncher,
    logging: LoggingFactory = PrintLoggingFactory,
    format: SerializationFormat = JsonFormat(),
    service: (I) -> S
): TypedHandlerConfig {
    return TypedHandlerConfig({ service(it) }, { createInvoker(it) }, format, eventManager, engine, logging)
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy