{"id":18384920,"url":"https://github.com/natata/linkage","last_synced_at":"2025-10-08T22:13:14.202Z","repository":{"id":80615187,"uuid":"137382175","full_name":"Natata/linkage","owner":"Natata","description":"linkage is a job stream service based on server streaming gRPC.","archived":false,"fork":false,"pushed_at":"2018-08-20T10:17:12.000Z","size":2895,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-23T00:35:09.154Z","etag":null,"topics":["go","golang","grpc","message-queue","streaming"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Natata.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,"zenodo":null}},"created_at":"2018-06-14T16:20:40.000Z","updated_at":"2018-09-25T04:59:58.000Z","dependencies_parsed_at":"2023-07-08T02:45:57.063Z","dependency_job_id":null,"html_url":"https://github.com/Natata/linkage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Natata/linkage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Flinkage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Flinkage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Flinkage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Flinkage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Natata","download_url":"https://codeload.github.com/Natata/linkage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Natata%2Flinkage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000780,"owners_count":26082851,"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":["go","golang","grpc","message-queue","streaming"],"created_at":"2024-11-06T01:15:53.280Z","updated_at":"2025-10-08T22:13:14.196Z","avatar_url":"https://github.com/Natata.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linkage\n\nLinkage is a job stream service based on server streaming gRPC.\nOne incoming stream and multiple outcome stream. \n\n# Install\ngo get github.com/Natata/linkage\n\n# How to use\n\n1. Define yourself engine\nDefine an engine which implement engine interface.\nEngine interface defined in engine.go, look like below:\n```\ntype Engine interface {\n    // Start starts the engine, jobs would send to the engine throught the inbound channel\n    Start(inbound \u003c-chan *Job) error\n    // Register register an output destination, results generated by engine would send to the outbound channel\n    // the signal is used to notify down stream or service is closing\n    Register(sig chan Signal) (\u003c-chan *Job, error)\n}\n```\n\n2. Initial linkage service\nIniital linkage with\n- address: listen incoming message\n- engine: engine implement\n- grpc server options: if this service need credentials or other grpc server supported options\n- codeAssert: except credential, you can use codeAssert to tell client if it the right service connected\n- dial info: infomation of remote service this service will connect. Leave nil if this service not connect to any service.\n- waiting function: the waiting mechanism to retry to ask job frmo remote service.\n\n```\n    addr := \":8081\"\n    engine := \u0026MyEngine{}\n    codeAssert := func(code linkage.Code) bool {\n        return true\n    }   \n\n    di := \u0026linkage.DialInfo{\n        ConnCode:   \"yo\",\n        Addr:       \":8080\",\n        Opts:       []grpc.DialOption{grpc.WithInsecure()},\n        MaxAttempt: 2,\n    }   \n\n    srv, err := linkage.InitLinkage(addr, engine, []grpc.ServerOption{}, codeAssert, di, nil)\n```\n\n3. Run it\n\n```\nerr := srv.Run()\n```\n\nexample/ have full examples.\n\nrun ```go run example/rome/main.go``` and ```go run example/road/main.go``` in order to see what happened :)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatata%2Flinkage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatata%2Flinkage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatata%2Flinkage/lists"}