{"id":16800169,"url":"https://github.com/bsideup/liiklus","last_synced_at":"2025-04-13T09:51:04.255Z","repository":{"id":29339880,"uuid":"121391917","full_name":"bsideup/liiklus","owner":"bsideup","description":"Reactive (RSocket/gRPC) Gateway for the event-based systems","archived":false,"fork":false,"pushed_at":"2023-01-26T06:05:01.000Z","size":801,"stargazers_count":235,"open_issues_count":70,"forks_count":35,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-27T01:12:20.467Z","etag":null,"topics":["cqrs","eventsourcing","grpc","java","kafka","pulsar","reactive","rsocket"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsideup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-13T14:25:27.000Z","updated_at":"2024-10-16T21:25:55.000Z","dependencies_parsed_at":"2023-02-14T14:35:22.420Z","dependency_job_id":null,"html_url":"https://github.com/bsideup/liiklus","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsideup%2Fliiklus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsideup%2Fliiklus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsideup%2Fliiklus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsideup%2Fliiklus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsideup","download_url":"https://codeload.github.com/bsideup/liiklus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248695300,"owners_count":21146952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cqrs","eventsourcing","grpc","java","kafka","pulsar","reactive","rsocket"],"created_at":"2024-10-13T09:31:18.803Z","updated_at":"2025-04-13T09:51:04.234Z","avatar_url":"https://github.com/bsideup.png","language":"Java","funding_links":[],"categories":["Java","进程间通信"],"sub_categories":["Spring Cloud框架"],"readme":"# Liiklus\n\u003e Liiklus **[li:klus]** (\"traffic\" in Estonian) - RSocket/gRPC-based Gateway for the event-based systems from the ones who think that Kafka is too low-level.\n\n## Why\n* horizontally scalable **RSocket/gRPC streaming gateway**\n* supports as many client languages as RSocket+gRPC do (Java, Go, C++, Python, etc...)\n* reactive first\n* Per-partition **backpressure-aware** sources\n* at-least-once/at-most-once delivery guarantees\n* **pluggable** event storage (Kafka, Pulsar, Kinesis, etc...)\n* pluggable positions storage (DynamoDB, Cassandra, Redis, etc...)\n* WIP: cold event storage support (S3, Minio, SQL, key/value, etc...)\n\n## Who is using\n* https://vivy.com/ - 25+ microservices, an abstraction in front of Kafka for the Shared Log Infrastructure (Event Sourcing / CQRS)\n\n## Quick Start\nThe easiest (and recommended) way to run Liiklus is with Docker:\n```shell\n$ docker run \\\n    -e kafka_bootstrapServers=some.kafka.host:9092 \\\n    -e storage_positions_type=MEMORY \\ # only for testing, DO NOT use in production\n    -p 6565:6565 \\\n    bsideup/liiklus:$LATEST_VERSION\n```\nWhere the latest version is:  \n[![](https://img.shields.io/github/release/bsideup/liiklus.svg)](https://github.com/bsideup/liiklus/releases/latest)\n\nNow use [LiiklusService.proto](protocol/src/main/proto/LiiklusService.proto) to generate your client.\n\nThe clients must implement the following algorithm:  \n1. Subscribe to the assignments:  \n    ```\n    stub.subscribe(SubscribeRequest(\n        topic=\"your-topic\",\n        group=\"your-consumer-group\",\n        [autoOffsetReset=\"earliest|latest\"]\n    ))\n    ```\n1. For every emitted reply of `Subscribe`, using the same channel, subscribe to the records:  \n    ```\n    stub.receive(ReceiveRequest(\n        assignment=reply.getAssignment()\n    ))\n    ```\n1. ACK records\n    ```\n    stub.ack(AckRequest(\n        assignment=reply.getAssignment(),\n        offset=record.getOffset()\n    ))\n    ```\n    **Note 1:** If you ACK record before processing it you get at-most-once, after processing - at-least-once  \n    **Note 2:** It's recommended to ACK every n-th record, or every n seconds to reduce the load on the positions storage\n\n\n## Java example:\nExample code using [Project Reactor](http://projectreactor.io) and [reactive-grpc](https://github.com/salesforce/reactive-grpc):\n```java\nvar stub = ReactorLiiklusServiceGrpc.newReactorStub(channel);\nstub\n    .subscribe(\n        SubscribeRequest.newBuilder()\n            .setTopic(\"user-events\")\n            .setGroup(\"analytics\")\n            .setAutoOffsetReset(AutoOffsetReset.EARLIEST)\n            .build()\n    )\n    .flatMap(reply -\u003e stub\n        .receive(ReceiveRequest.newBuilder().setAssignment(reply.getAssignment()).build())\n        .window(1000) // ACK every 1000th records\n        .concatMap(\n            batch -\u003e batch\n                .map(ReceiveReply::getRecord)\n                // TODO process instead of Mono.delay(), i.e. by indexing to ElasticSearch\n                .concatMap(record -\u003e Mono.delay(Duration.ofMillis(100)))\n                .sample(Duration.ofSeconds(5)) // ACK every 5 seconds\n                .onBackpressureLatest()\n                .delayUntil(record -\u003e stub.ack(\n                    AckRequest.newBuilder()\n                        .setAssignment(reply.getAssignment())\n                        .setOffset(record.getOffset())\n                        .build()\n                )),\n            1\n        )\n    )\n    .blockLast()\n```\n\nAlso check [examples/java/](examples/java/) for a complete example\n\n## Configuration\nThe project is based on Spring Boot and uses [it's configuration system](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/html/boot-features-external-config.html)  \nPlease check [application.yml](app/src/main/resources/application.yml) for the available configuration keys.\n\n## License\n\nSee [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsideup%2Fliiklus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsideup%2Fliiklus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsideup%2Fliiklus/lists"}