{"id":17163677,"url":"https://github.com/cyberdelia/motion","last_synced_at":"2025-03-24T16:53:38.219Z","repository":{"id":66704114,"uuid":"517368475","full_name":"cyberdelia/motion","owner":"cyberdelia","description":"Kinesis producer optimized for random partition keys.","archived":false,"fork":false,"pushed_at":"2024-04-29T15:39:20.000Z","size":249,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-02T05:54:00.803Z","etag":null,"topics":["kinesis","kotlin"],"latest_commit_sha":null,"homepage":"https://github.com/cyberdelia/motion","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyberdelia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-24T15:53:56.000Z","updated_at":"2024-05-06T14:21:48.310Z","dependencies_parsed_at":null,"dependency_job_id":"d0fb7efc-7104-424e-a071-3184f5603fd4","html_url":"https://github.com/cyberdelia/motion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmotion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmotion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmotion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyberdelia%2Fmotion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyberdelia","download_url":"https://codeload.github.com/cyberdelia/motion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245315290,"owners_count":20595216,"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":["kinesis","kotlin"],"created_at":"2024-10-14T22:49:44.859Z","updated_at":"2025-03-24T16:53:38.197Z","avatar_url":"https://github.com/cyberdelia.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Motion\n\nMotion is Kinesis producer optimized for random partition keys.\n\n### Installation\n\nAdd the library to your gradle dependencies:\n\n```kotlin\ndependencies {\n    implementation(\"com.lapanthere:motion:0.1\")\n}\n```\n\n### Usage\n\nTo create a stream:\n\n```kotlin\nval stream = Stream(\"kinesis-stream\", serializer = { value -\u003e objectMapper.writeValueAsBytes(value) })\n```\n\nTo publish to the stream:\n\n```kotlin\nval future = stream.publish(event, expires = Duration.ofSeconds(1))\n```\n\nEnsure you close the stream before shutting down your application:\n\n```kotlin\nstream.close()\n```\n\n#### Interceptors\n\nYou can specify interceptors that are allowed to intercept records before and after publication.\n\nInterceptors are also allowed to mutate the record before publication, each interceptor receives the record returned by\nthe previous interceptor in the chain.\n\n```kotlin\nclass MetricsInterceptor : Interceptor\u003cRecord\u003e {\n    override fun beforePublication(record: Record, context: Context): Record {\n        Metrics.count(\"kinesis.publication.count\").increment()\n        return record\n    }\n\n    override fun afterPublication(receipt: Receipt?, throwable: Throwable?, context: Context) {\n        if (receipt != null) {\n            Metrics.timer(\"kinesis.publication.latency\", \"shard_id\", receipt.shardID)\n                .record(receipt.duration)\n        }\n    }\n}\n\nval stream = Stream(\n    \"stream-name\", serializer = { value -\u003e objectMapper.writeValueAsBytes(value) },\n    interceptors = listOf(MetricsInterceptor())\n)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberdelia%2Fmotion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyberdelia%2Fmotion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberdelia%2Fmotion/lists"}