An RPC library for Kotlin services that strives to balance developer productivity and performance.

Related tags

Networking indie-rpc
Overview

IndieRpc

An RPC library for Kotlin services that strives to balance developer productivity and performance.

IndieRpc is inspired by Golang's net/rpc package, Twitch's Twirp, and of course gRPC.

Background

Working with gRPC was always difficult for both backend and client devs. Backend devs had to write custom tooling to deal with load balancing as it did not play nicely with existing http load balancers.

For client devs, the generated code was quite unergonomic to use and required a completely orthogonal architecture to the already existing http layer that was already there.

Usage

Register instances that implement your service interface. The same instance will be used to service each request . The only methods that will be registered will be the ones that take in a single parameter of type data class and return a data class.

-> val addResponseResult = indieClient.invokeRpcMethod( RpcTarget(serviceName, "sum"), MathService.AddRequest(1, 2), MathService.AddResponse::class.java ) ">
class MathService(private val const: Int) {
  data class AddRequest(val x: Int, val y: Int)
  data class AddResponse(val sum: Int)

  fun sum(addRequest: AddRequest): AddResponse {
    return AddResponse(addRequest.x + addRequest.y + const)
  }
}

val serviceName = "math.svc"
val mathService = MathService(5)
val indieServer = IndieRpcServer()
indieServer.registerService(serviceName, mathService)
indieServer.startServer()

val indieClient = IndieRpcClient()

// returns Result
    
      -> 
     
    
val addResponseResult = indieClient.invokeRpcMethod(
  RpcTarget(serviceName, "sum"),
  MathService.AddRequest(1, 2),
  MathService.AddResponse::class.java
)

Maven

In your pom file add

<repositories>
  <repository>
    <id>githubid>
    <url>https://maven.pkg.github.com/asad-awadia/indie-rpcurl>
  repository>
repositories>

  
<dependency>
  <groupId>dev.aawadiagroupId>
  <artifactId>indie-rpcartifactId>
  <version>0.1.1version>
dependency>

Tech notes

The server and client both use Vert.x. Service methods must be thread safe and can have blocking code.

Roadmap

Depending on the interest in this project these are the future enhancements planned

  1. Use proper logging instead of println
  2. Micrometer metrics
  3. Streaming messages via websockets
  4. Tcp and udp support
  5. Generate client SDK wrapper
You might also like...
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

Asynchronous socket, http(s) (client+server) and websocket library for android. Based on nio, not threads.

AndroidAsync AndroidAsync is a low level network protocol library. If you are looking for an easy to use, higher level, Android aware, http request li

Android library listening network connection state and change of the WiFi signal strength with event bus

NetworkEvents Android library listening network connection state and change of the WiFi signal strength with event bus. It works with any implementati

Flower - Super cool Android library to manage networking and database caching with ease

Flower Super cool Android library to manage networking and database caching with ease. It allows developers to use remote resources on-the-fly OR Comb

Volley is an HTTP library that makes networking for Android apps easier and, most importantly, faster.

Volley Volley is an HTTP library that makes networking for Android apps easier and, most importantly, faster. For more information about Volley and ho

SimpleApiCalls is a type-safe REST client for Android. The library provides the ability to interact with APIs and send network requests with HttpURLConnection.

SimpleApiCalls 📢 SimpleApiCalls is a type-safe REST client for Android. The library provides the ability to interact with APIs and send network reque

Kotlin-REST-Retrofit - Simple client to consume a REST API with Retrofit using Kotlin
Kotlin-REST-Retrofit - Simple client to consume a REST API with Retrofit using Kotlin

Kotlin REST Retrofit Sencillo cliente para consumir una API REST con Retrofit us

Monitoring water tanker level using NodeMCU ESP8266 and HC-SR04P Ultrasonic Sensor and broadcasting it using a simple HTTP server inside NodeMCU ESP8266 and show data in an Android App
Monitoring water tanker level using NodeMCU ESP8266 and HC-SR04P Ultrasonic Sensor and broadcasting it using a simple HTTP server inside NodeMCU ESP8266 and show data in an Android App

WaterLevel Preface This project aims to finding a tanker water level using NodeMCU with ESP8266 core and HC-SR04P Ultrasonic sensor and broadcasting i

Starter code for getting and saving data from the Internet using Kotlin.

Doggos Description Doggos is an app that fetches (pun intended) information from a third party API. The API returns data about a random dog that conta

Releases(v0.1.1)
Owner
Asad Awadia
https://blog.aawadia.dev
Asad Awadia
Cli lightning network server, based on LDK (rust-lightning). Provides DUMB-RPC interface (telnet friendly).

Hello Lightning Cli lightning network server, based on LDK (rust-lightning). Provides DUMB-RPC interface (telnet friendly). Example: Build it run it:

null 9 Mar 28, 2022
Kotlin-echo-client - Echo client using Kotlin with Ktor networking library

Overview This repository contains an echo server implemented with Kotlin and kto

Elliot Barlas 2 Sep 1, 2022
HttpMocker is a simple HTTP mocking library written in Kotlin to quickly and easily handle offline modes in your apps

HttpMocker HttpMocker is a very lightweight Kotlin library that allows to mock HTTP calls relying on either OkHttp or the Ktor client libraries. It ca

David Blanc 174 Nov 28, 2022
Ktorfit - a HTTP client/Kotlin Symbol Processor for Kotlin Multiplatform (Js, Jvm, Android, iOS, Linux) using KSP and Ktor clients inspired by Retrofit

Ktorfit is a HTTP client/Kotlin Symbol Processor for Kotlin Multiplatform (Js, Jvm, Android, iOS, Linux) using KSP and Ktor clients inspired by Retrofit

Jens Klingenberg 637 Dec 25, 2022
Kotlin HTTP requests library. Similar to Python requests.

khttp khttp is a simple library for HTTP requests in Kotlin. It functions similarly to Python's requests module. import khttp.get fun main(args: Arra

Anna Clemens 466 Dec 20, 2022
The easiest HTTP networking library for Kotlin/Android

Fuel The easiest HTTP networking library for Kotlin/Android. You are looking at the documentation for 2.x.y.. If you are looking for the documentation

Kittinun Vantasin 4.3k Jan 8, 2023
A "fluent" OkHTTP library for Kotlin based on string extensions.

okfluent A "fluent" OkHTTP library for Kotlin based on string extensions. Do not take this project seriously, I just wanted to show that this kind of

Duale Siad 0 Nov 23, 2021
A gRPC Kotlin based server and client starter that builds with Gradle and runs on the JVM

gRPC Kotlin starter Overview This directory contains a simple bar service written as a Kotlin gRPC example. You can find detailed instructions for bui

Hypto 8 Sep 19, 2022
A product registration service using the Kotlin language and the Micronaut and Grpc framework

A product registration service using the Kotlin language and the Micronaut and Grpc framework

Mateus AraĂşjo 30 Nov 2, 2022