Expose your functions to the network with just one annotation
LikesPro Function Call Protocol (LPFCP) Java lets you expose ordinary Java and Kotlin classes as remote-callable services with a single annotation. LPFCP Java implements the LPFCP protocol — check out the LPFCP protocol specification — and provides both server and client parts instrumentals.
- 🌐 Annotation-Driven – Turn any Java/Kotlin class object into an HTTP-accessible service by annotating your functions to expose.
- 🚀 Lightweight – Minimal dependencies and overhead; ideal for microservices and serverless deployments.
- 🔌 Java & Kotlin Support – Use LPFCP from either language with the same ease.
- 🛠 Zero-Boilerplate – No manual serialization or wiring; LPFCP takes care of it using reflection.
Read our Wiki
Gradle:
dependencies {
implementation("io.github.likespro:lpfcp-core:1.1.0") // Core features: getProcessor, .processRequest, etc.
implementation("io.github.likespro:lpfcp-ktor:1.1.0") // Integration with Ktor, for servers: lpfcpServer, Route.lpfcp, etc.
}Maven:
<!-- Core features: getProcessor, .processRequest, etc. -->
<dependency>
<groupId>io.github.likespro</groupId>
<artifactId>lpfcp-core</artifactId>
<version>1.1.0</version>
</dependency>
<!-- Integration with Ktor, for servers: lpfcpServer, Route.lpfcp, etc. -->
<dependency>
<groupId>io.github.likespro</groupId>
<artifactId>lpfcp-ktor</artifactId>
<version>1.1.0</version>
</dependency>interface Calculator {
fun add(a: Int, b: Int): Int
fun subtract(a: Int, b: Int): Int
}Annotate your implementation class functions with @LPFCP.ExposedFunction:
class CalculatorImpl : Calculator {
@LPFCP.ExposedFunction
override fun add(a: Int, b: Int) = a + b
@LPFCP.ExposedFunction
override fun subtract(a: Int, b: Int) = a - b
}Use the embedded server helper to expose your service over HTTP:
fun main() {
val calculator = CalculatorImpl()
lpfcpServer(processor = calculator, port = 8080)
.start(wait = true)
}Obtain a client-side proxy and invoke methods as if they were local:
fun main() {
val calculator: Calculator = LPFCP.getProcessor<Calculator>(
"http://localhost:8080/lpfcp"
)
println(calculator.add(1, 2)) // -> 3
println(calculator.subtract(5, 3)) // -> 2
}Check out the examples/ folder for a working example of the calculator app in Java & Kotlin.
Check out https://likespro.gitbook.io/lpfcp-java to view guides to LPFCP Java library.
Check out https://likespro.github.io/lpfcp-java/ to view auto generated documentation for the project by Dokka (similar to Javadoc)
LPFCP Java is released under the Mozilla Public License Version 2.0.
