{"id":18049522,"url":"https://github.com/iacobson/umbrella_stage","last_synced_at":"2025-10-08T04:11:21.224Z","repository":{"id":57556485,"uuid":"103641351","full_name":"iacobson/umbrella_stage","owner":"iacobson","description":"Subscribes GenStage consumers to producers across Elixir Umbrella apps.","archived":false,"fork":false,"pushed_at":"2017-11-09T16:17:55.000Z","size":9,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-06T13:53:27.334Z","etag":null,"topics":["genstage","umbrella"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/umbrella_stage/readme.html","language":"Elixir","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/iacobson.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}},"created_at":"2017-09-15T09:45:03.000Z","updated_at":"2025-03-12T06:39:13.000Z","dependencies_parsed_at":"2022-09-14T12:31:28.360Z","dependency_job_id":null,"html_url":"https://github.com/iacobson/umbrella_stage","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/iacobson/umbrella_stage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iacobson%2Fumbrella_stage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iacobson%2Fumbrella_stage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iacobson%2Fumbrella_stage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iacobson%2Fumbrella_stage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iacobson","download_url":"https://codeload.github.com/iacobson/umbrella_stage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iacobson%2Fumbrella_stage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278887185,"owners_count":26063134,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["genstage","umbrella"],"created_at":"2024-10-30T21:07:59.466Z","updated_at":"2025-10-08T04:11:21.206Z","avatar_url":"https://github.com/iacobson.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UmbrellaStage\n\nSubscribes GenStage consumers to producers across Elixir Umbrella apps.\n\n\n## Installation\n\nAdd `umbrella_stage` to your list of dependencies in `mix.exs`:\n\nElixir \u003e= 1.4 required\n\n```elixir\ndef deps do\n  [\n    {:umbrella_stage, \"~\u003e 0.1.1\"}\n  ]\nend\n```\n\n## Usage\n\n1. Configuration  \n`use` the `UmbrellaStage` in the GenStages servers. It required 2 arguments:  \n- `:type` - is the GenStage type: `:producer`, `:producer_consumer` or `:consumer`  \n- `:producers` - required only for **consumers** and **producer_consumers**. It's the list of producers, the consumer (or producer_consumer) will subscribe to, in the following format: `{ProducerName, [subscription_options]}`\n\n2. Call `umbrella_sync_subscribe()` in the GenStage `init`\n\nThis version of umbrella_stage implements just the [`GenStage.sync_subscribe/3`](https://hexdocs.pm/gen_stage/GenStage.html#sync_subscribe/3) subscription.\n\nPlease check [this blog post](https://medium.com/@iacobson/subscribe-genstages-under-umbrella-1fceec366633) for more details.\n## Examples\n\nA demo app is available [on GitHub](https://github.com/iacobson/blog_stockr).   \n\n### Consumer\n```elixir\ndefmodule App1.MyConsumer do\n  use UmbrellaStage,\n   type: :consumer,\n    producers: [\n      {MyProducerConsumer, [max_demand: 10]}\n    ]\n\n  def init() do\n    umbrella_sync_subscribe()\n    .....\n  end\nend\n```\n\n### ProducerConsumer\n```elixir\ndefmodule App2.MyProducerConsumer do\n  use UmbrellaStage,\n   type: :producer_consumer,\n    producers: [\n      {MyProducer, [max_demand: 10]}\n    ]\n\n  def init() do\n    umbrella_sync_subscribe()\n    .....\n  end\nend\n\n```\n\n### Producer\n```elixir\ndefmodule App3.MyProducer do\n  use UmbrellaStage,\n    type: :producer\n\n  def init() do\n    umbrella_sync_subscribe()\n    .....\n  end\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiacobson%2Fumbrella_stage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiacobson%2Fumbrella_stage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiacobson%2Fumbrella_stage/lists"}