Skip to content

greenarr0w/yass

 
 

Repository files navigation

yass (Yet Another Service Solution)

  • is a small library for efficient peer-to-peer communication

    • Kotlin
    • TypeScript
    • Python 2 & 3 (with support for type hints)
    • high throughput, low latency, reactive services
  • supports type-safe contracts with DTOs and interfaces

  • supports request/reply and OneWay style method invocations

  • supports sync/async client/server invocations

  • supports interceptors

  • provides session based bidirectional messaging

  • provides transports for

    • socket (including TLS)
    • WebSocket
  • has a fast and compact binary serializer

  • needs no third-party libraries

  • uses https://semver.org

  • is Open Source (BSD-3-Clause license)

HelloWorld

interface Calculator {
    fun add(a: Int, b: Int): Int
}

class CalculatorImpl : Calculator {
    override fun add(a: Int, b: Int) = a + b
}

fun useCalculator(calculator: Calculator) {
    println("2 + 3 = " + calculator.add(2, 3))
}

fun main(args: Array<String>) {
    val calculatorId = contractId<Calculator>(0, SimpleMethodMapperFactory)
    val messageSerializer = messageSerializer(JavaSerializer)
    val address = InetSocketAddress("localhost", 28947)
    val executor = Executors.newCachedThreadPool()
    val server = Server(Service(calculatorId, CalculatorImpl()))
    socketServer(ServerSetup(server, messageSerializer), executor)
        .start(executor, socketBinder(address))
    val client = socketClient(ClientSetup(messageSerializer), socketConnector(address))
    useCalculator(client.proxy(calculatorId))
}

About

Yet Another Service Solution

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 46.7%
  • Python 22.8%
  • Java 17.2%
  • TypeScript 12.1%
  • Batchfile 0.6%
  • HTML 0.2%
  • Other 0.4%