{"id":19638458,"url":"https://github.com/droxer/rxgo","last_synced_at":"2025-10-15T14:40:51.945Z","repository":{"id":57508300,"uuid":"47025844","full_name":"droxer/RxGo","owner":"droxer","description":"Experimental Reactive Extensions implementation for the Go Programming Language","archived":false,"fork":false,"pushed_at":"2022-06-09T16:13:39.000Z","size":31,"stargazers_count":14,"open_issues_count":6,"forks_count":2,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-06-01T09:52:52.655Z","etag":null,"topics":["golang","reactive"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/droxer.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":"2015-11-28T14:10:13.000Z","updated_at":"2023-02-07T08:37:29.000Z","dependencies_parsed_at":"2022-08-29T22:41:34.148Z","dependency_job_id":null,"html_url":"https://github.com/droxer/RxGo","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/droxer%2FRxGo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droxer%2FRxGo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droxer%2FRxGo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droxer%2FRxGo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/droxer","download_url":"https://codeload.github.com/droxer/RxGo/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droxer%2FRxGo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259057180,"owners_count":22799106,"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":["golang","reactive"],"created_at":"2024-11-11T12:38:48.496Z","updated_at":"2025-10-15T14:40:51.918Z","avatar_url":"https://github.com/droxer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RxGo\n\nReactive Extensions for Go with full Reactive Streams 1.0.4 compliance.\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/droxer/RxGo)](https://goreportcard.com/report/github.com/droxer/RxGo)\n[![GoDoc](https://godoc.org/github.com/droxer/RxGo?status.svg)](https://godoc.org/github.com/droxer/RxGo)\n\n## Features\n\n- **Type-safe generics** - Full Go generics support\n- **Reactive Streams 1.0.4** - Complete specification compliance\n- **Backpressure strategies** - Buffer, Drop, Latest, Error\n- **Push \u0026 Pull Models** - Observable API (push) and Reactive Streams (pull with backpressure)\n- **Retry and backoff** - Fixed, Linear, Exponential backoff with configurable retry limits\n- **Context cancellation** - Graceful shutdown\n- **Thread-safe** - All APIs are safe for concurrent access with proper synchronization\n\n## Quick Start\n\nInstall the library:\n\n```bash\ngo get github.com/droxer/RxGo@latest\n```\n\n### Observable API (Push Model)\n\nSimple and intuitive API for basic reactive programming:\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \n    \"github.com/droxer/RxGo/pkg/observable\"\n)\n\nfunc main() {\n    // Basic usage\n    obs := observable.Just(1, 2, 3, 4, 5)\n    obs.Subscribe(context.Background(), observable.NewSubscriber(\n        func(v int) { fmt.Printf(\"Got %d\\n\", v) },\n        func() { fmt.Println(\"Done\") },\n        func(err error) { fmt.Printf(\"Error: %v\\n\", err) },\n    ))\n    \n    // Using new operators\n    numbers := observable.Range(1, 10)\n    firstFive := observable.Take(numbers, 5)\n    fmt.Println(\"\\nFirst five numbers:\")\n    firstFive.Subscribe(context.Background(), observable.NewSubscriber(\n        func(v int) { fmt.Printf(\"%d \", v) },\n        func() { fmt.Println(\"\\nCompleted\") },\n        func(err error) { fmt.Printf(\"Error: %v\\n\", err) },\n    ))\n}\n```\n\n**Output:**\n```\nGot 1\nGot 2\nGot 3\nGot 4\nGot 5\nDone\n\nFirst five numbers:\n1 2 3 4 5 \nCompleted\n```\n\n### Reactive Streams API (Pull Model with Backpressure)\n\nFull Reactive Streams 1.0.4 compliance with backpressure support:\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \n    \"github.com/droxer/RxGo/pkg/streams\"\n)\n\nfunc main() {\n    publisher := streams.NewCompliantRangePublisher(1, 5)\n    publisher.Subscribe(context.Background(), streams.NewSubscriber(\n        func(v int) { fmt.Printf(\"Received: %d\\n\", v) },\n        func(err error) { fmt.Printf(\"Error: %v\\n\", err) },\n        func() { fmt.Println(\"Completed\") },\n    ))\n    \n    // Using new processors\n    fmt.Println(\"\\nUsing TakeProcessor:\")\n    numbers := streams.NewCompliantRangePublisher(1, 10)\n    takeProcessor := streams.NewTakeProcessor[int](5)\n    numbers.Subscribe(context.Background(), takeProcessor)\n    takeProcessor.Subscribe(context.Background(), streams.NewSubscriber(\n        func(v int) { fmt.Printf(\"%d \", v) },\n        func(err error) { fmt.Printf(\"Error: %v\\n\", err) },\n        func() { fmt.Println(\"\\nTake completed\") },\n    ))\n}\n```\n\n\n**Output:**\n```\nReceived: 1\nReceived: 2\nReceived: 3\nReceived: 4\nReceived: 5\nCompleted\n\nUsing TakeProcessor:\n1 2 3 4 5 \nTake completed\n```\n\n\n### Backpressure Strategies\n\nHandle producer/consumer speed mismatches with four strategies:\n\n```go\nimport \"github.com/droxer/RxGo/pkg/streams\"\n\n// Buffer - keep all items in bounded buffer\npublisher := streams.NewBufferedPublisher[int](\n    streams.WithBufferStrategy(streams.Buffer),\n    streams.WithBufferSize(100),\n)\n\n// Drop - discard new items when full\npublisher := streams.NewBufferedPublisher[int](\n    streams.WithBufferStrategy(streams.Drop),\n    streams.WithBufferSize(50),\n)\n\n// Latest - keep only latest item\npublisher := streams.NewBufferedPublisher[int](\n    streams.WithBufferStrategy(streams.Latest),\n    streams.WithBufferSize(1),\n)\n\n// Error - signal error on overflow\npublisher := streams.NewBufferedPublisher[int](\n    streams.WithBufferStrategy(streams.Error),\n    streams.WithBufferSize(10),\n)\n```\n\n### Bridging APIs\n\nYou can easily convert between the `Observable` and `Publisher` APIs using adapters. This is useful when you need to combine the simplicity of the `observable` package with the backpressure support of the `streams` package.\n\n```go\nimport (\n    \"github.com/droxer/RxGo/pkg/adapters\"\n    \"github.com/droxer/RxGo/pkg/observable\"\n    \"github.com/droxer/RxGo/pkg/streams\"\n)\n\n// Convert an Observable to a Publisher\nobs := observable.Just(1, 2, 3)\npublisher := adapters.ObservablePublisherAdapter(obs)\n\n// Convert a Publisher to an Observable\npub := streams.NewCompliantRangePublisher(1, 5)\nobservable := adapters.PublisherToObservableAdapter(pub)\n```\n\n## Documentation\n\n- [Architecture](./docs/architecture.md) - Package structure and design decisions\n- [Observable API](./docs/observable.md) - Simple Observable API examples\n- [Reactive Streams](./docs/reactive-streams.md) - Full Reactive Streams 1.0.4 compliance\n- [Backpressure](./docs/backpressure.md) - Handle producer/consumer speed mismatches\n- [Push vs Pull Models](./docs/push-pull-models.md) - Understanding push and pull models with backpressure\n- [Retry and Backoff](./docs/retry-backoff.md) - Configurable retry with backoff strategies\n- [Transformations](./docs/transformations.md) - Transform and process data streams with both Reactive Streams and Observable API\n- [Context Cancellation](./docs/context-cancellation.md) - Graceful cancellation using Go context\n- [Schedulers](./docs/schedulers.md) - Execution context control\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.\n\n## License\n\n[MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdroxer%2Frxgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdroxer%2Frxgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdroxer%2Frxgo/lists"}