{"id":14967162,"url":"https://github.com/golemfactory/ya-service-bus","last_synced_at":"2025-07-04T13:33:28.805Z","repository":{"id":42466581,"uuid":"309758884","full_name":"golemfactory/ya-service-bus","owner":"golemfactory","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-08T08:31:12.000Z","size":583,"stargazers_count":3,"open_issues_count":4,"forks_count":6,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-04-14T23:45:19.149Z","etag":null,"topics":["golem"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/golemfactory.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}},"created_at":"2020-11-03T17:25:25.000Z","updated_at":"2024-04-23T09:34:26.430Z","dependencies_parsed_at":"2024-04-23T09:34:14.814Z","dependency_job_id":"71d7e0b1-6ad3-4fc9-baa5-8595c2ea793c","html_url":"https://github.com/golemfactory/ya-service-bus","commit_stats":{"total_commits":231,"total_committers":22,"mean_commits":10.5,"dds":0.8008658008658008,"last_synced_commit":"dad884fa9b281be11af5011a9eb8c8781c756019"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemfactory%2Fya-service-bus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemfactory%2Fya-service-bus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemfactory%2Fya-service-bus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemfactory%2Fya-service-bus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golemfactory","download_url":"https://codeload.github.com/golemfactory/ya-service-bus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869245,"owners_count":16555571,"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":["golem"],"created_at":"2024-09-24T13:37:32.923Z","updated_at":"2024-10-07T10:06:10.729Z","avatar_url":"https://github.com/golemfactory.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Golem Service Bus (a.k.a. GSB)\n\nGSB is a message bus allowing Yagna services to communicate with one another.\nIt consist of two software components: router (`ya-sb-router`) and client crate\n(`ya-service-bus`). GSB router is a socket-based message dispatcher. The client\ncrate provides a high-level API for connecting to the router and allows local\n(i.e. within-process, in-memory) routing. GSB supports two distinct ways of\ncommunication: service calls (one-to-one, bidirectional) and broadcasts\n(one-to-many, unidirectional).\n\n### How to compile your own central net\n\nIt is useful for internal development of Golem components or if you want to create your \nown separated subnet of Golem Network.\n\nYA-SERVICE-BUS - your local repository path\n\nCompile steps:\n1. In terminal go to YA-SERVICE-BUS/crates/router\n2. Run: cargo build --bin ya-sb-router --features bin --release\n3. You should find binary in YA-SERVICE-BUS/target/release\n\nalternatively you can build from YA-SERVICE-BUS using more complicated command:\n1. cargo build --bin ya-sb-router --features ya-sb-router/bin --release --package ya-sb-router\n2. You should find binary in YA-SERVICE-BUS/target/release\n\nNote that ya-sb-router crate can be used as library or binary depending on usage, \nthus requiring --bin switch to compile correctly\n\n### Low-level router API\n\n#### Message format\nGSB messages are encoded with protobuf. Message types could be found in\n[`gsb_api.proto`](crates/proto/protos/gsb_api.proto) file. Each message is prepended with a 64-bit header.\nFirst 4 bytes of the header are interpreted as big-endian singed integer\nencoding message type (for mapping see [Packet](https://github.com/golemfactory/ya-service-bus/blob/3b8ff9cd49fb040cdfeee127f42b28e962a0a9f4/crates/proto/protos/gsb_api.proto#L32-L51) enum).\nNext 4 bytes of the header are interpreted as big-endian unsigned integer\nrepresenting message length.\n\n#### Operations\n\n##### Register\nRegister a service on the bus. Accepts service name as a parameter.\nRegistered service can be called by its name by other processes connected to GSB.\nService name is treated as a prefix, e.g. a service registered under `foo` will\nalso receive calls to `foo/bar` and `foo/baz`.\n\n##### Unregister\nUnregister a service from the bus. No longer receive calls.\n\n##### ServiceCall\nCall a service registered on the bus and wait for the reply. Every service call\nhas an ID, called service's address (name), and call data. Reply from the service\nwill be returned in one or more `CallReply` messages containing call request ID.\n\n##### Subscribe\nSubscribe to a broadcast topic in order to receive all messages published for\nthis topic.\n\n##### Unsubscribe\nUnsubscribe from a broadcast topic. No longer receive messages.\n\n##### Broadcast\nBroadcast a message to all subscribers of a given topic.\n\n#### Pings and disconnections\nEvery 60 seconds router checks for idle connections. If a client has not sent\nany message for 60 seconds it is pinged. If a client has not sent any message\nfor 120 seconds it is disconnected. The timeout is configurable via\n`GSB_PING_TIMEOUT` environment variable. When a client is disconnected all\nregistered services and broadcast subscriptions are removed. All pending calls\nto a service that got disconnected are answered with `ServiceFailure` reply.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemfactory%2Fya-service-bus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolemfactory%2Fya-service-bus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemfactory%2Fya-service-bus/lists"}