{"id":13413421,"url":"https://github.com/sybrexsys/RapidMQ","last_synced_at":"2025-03-14T19:32:15.142Z","repository":{"id":53581668,"uuid":"70006430","full_name":"sybrexsys/RapidMQ","owner":"sybrexsys","description":"RapidMQ is a pure, extremely productive, lightweight and reliable library for managing of the local messages queue","archived":false,"fork":false,"pushed_at":"2017-12-07T08:34:10.000Z","size":64,"stargazers_count":68,"open_issues_count":1,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-07-31T20:52:19.196Z","etag":null,"topics":[],"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/sybrexsys.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":"2016-10-04T21:07:48.000Z","updated_at":"2024-06-20T21:19:35.000Z","dependencies_parsed_at":"2022-08-30T23:10:20.387Z","dependency_job_id":null,"html_url":"https://github.com/sybrexsys/RapidMQ","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/sybrexsys%2FRapidMQ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sybrexsys%2FRapidMQ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sybrexsys%2FRapidMQ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sybrexsys%2FRapidMQ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sybrexsys","download_url":"https://codeload.github.com/sybrexsys/RapidMQ/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221498745,"owners_count":16833056,"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":[],"created_at":"2024-07-30T20:01:39.974Z","updated_at":"2024-10-26T05:30:52.713Z","avatar_url":"https://github.com/sybrexsys.png","language":"Go","funding_links":[],"categories":["Messaging","消息","\u003cspan id=\"消息-messaging\"\u003e消息 Messaging\u003c/span\u003e","消息传递","机器学习","消息系统","Relational Databases"],"sub_categories":["Advanced Console UIs","Search and Analytic Databases","检索及分析资料库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","高级控制台界面","交流","SQL 查询语句构建库","高級控制台界面"],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/sybrexsys/RapidMQ)](https://goreportcard.com/report/github.com/sybrexsys/RapidMQ)\n[![Build Status](https://travis-ci.org/sybrexsys/RapidMQ.svg?branch=master)](https://travis-ci.org/sybrexsys/RapidMQ)\n[![Coverage Status](https://coveralls.io/repos/github/sybrexsys/RapidMQ/badge.svg?branch=master)](https://coveralls.io/github/sybrexsys/RapidMQ?branch=master)\n[![GoDoc](https://godoc.org/github.com/sybrexsys/RapidMQ?status.png)](https://godoc.org/github.com/sybrexsys/RapidMQ)\n\n\nRapidMQ\n=======\nRapidMQ is a pure, extremely productive, lightweight and reliable library for managing of the local messages queue in the [Go programming language](http:golang.org).       \n\nInstallation\n-----------\n\n\tgo get github.com/sybrexsys/RapidMQ/queue\n\nRequirements\n-----------\n\n* Need at least `go1.4` or newer.\n\nUsage\n-----------\n\n***Queue***\n\nBase structure in the base is Queue\nQueue is created with that function:\n\n```\nfunc CreateQueue(Name, StoragePath string, Log Logging, Factory WorkerFactory, Options *Options) (*Queue, error)\n```\n\n|Parameters         | Type         | Description\n|:----------------- |:-------------|:---------------------- \n|Name \t            |string        | Queue name. Used for logging only\n|StoragePath        |string        | Path to the disk storages' files\n|Log \t\t\t    |Logging \t   | Interface is used to logging of the queue's events. If equal to nil, logging is ensent. Description bellow\n|Factory \t\t\t|WorkerFactory | Interface for abstract factory of the workers. Description bellow \n|Options \t\t\t|*Options      | Options of the queue\n\n```\nfunc (q *Queue) Insert(buf []byte) bool\n```\nAppends the message into the queue. In depends of the timeout's option either is trying to write message to the disk or is trying to process this message in the memory and writing to the disk only if timeout is expired shortly. Returns false if aren't processing / writing of the message in the during of the timeout or has some problems with  writing to disk    \n \n```\nfunc (q *Queue) Process(worker WorkerID, isOk bool)\n``` \nThat function must be called from the worker of the message. In depends of the `isOk` parameter either messages are deleting from the queue or are marking as faulty and again processing after some timeout     \n\n```\nfunc (q *Queue) Count() uint64\n``` \nReturns the count of the messages in the queue\n\n```\nfunc (q *Queue) Close()\n``` \nStops the handler of the messages, saves the messages located in the memory into the disk, closes all opened files.               \n\n***Message***\n\nDescription of the structure that will be sent to worker \n\n```\ntype Message struct {\n\tID      StorageIdx\n\tBuffer  []byte\n}\n```\n\n|Member             | Type         | Description\n|:----------------- |:-------------|:---------------------- \n| ID \t            | StorageIdx   | ID of the message\n| Buffer            |[]byte        | Buffer with content of the message\n\n\n\n\n***WorkerFactory***\n\nWorker factory is a structure that create workers for processing messages\nYour factory must support next interface: \n```\ntype WorkerFactory interface {\n\tCreateWorker() Worker\n\tNeedTimeoutProcessing() bool\n}\n```\n\n```\nCreateWorker() Worker\n```\nCreates new worker for this factory with unique ID\n\n```\nNeedTimeoutProcessing() bool\n```\nReturns true if possible used some messages in one action (for example, collect large SQL script from lot of the small messages)  \n\n\n\n***Worker***\n\nIf you are using of your worker, he must support next interface\n```\ntype Worker interface {\n\tProcessMessage(*Queue, *Message, chan Worker)\n\tProcessTimeout(*Queue, chan Worker)\n\tGetID() WorkerID\n\tClose()\n}\n```\n\n```\nProcessMessage(*Queue, *Message, chan Worker)\n``` \nProcesses message that is stored in `*Message`.\nAfter it the worker must call function `(*Queue).Process` with his unique identifier and with result of the processing, also must be pushed himself into chanal `Worker`\n\n```\nProcessTimeout(*Queue, chan Worker)\n```\nProcessing of the event when available messages is absent   \nAfter it the worker must call function `(*Queue).Process` with his unique identifier and with result of the processing, also must send himself into chanal `Worker`\n\n```\nGetID() WorkerID\n```\nReturns unique identifier of the worker\n\n```\nClose() \n```\nClose is called when queue is finishing work with worker. Here you can close connection to database or etc.\n\n\n***Logging***\n\nIf you are using of your logging system, it must support next interface\n\n``` \ntype Logging interface {\n\tTrace(msg string, a ...interface{})\n\tInfo(msg string, a ...interface{})\n\tWarning(msg string, a ...interface{})\n\tError(msg string, a ...interface{})\n} \n```\n \n \n\nAuthor\n------\n  ***Vadim Shakun:***  [vadim.shakun@gmail.com](mailto:vadim.shakun@gmail.com)\n\nLicense\n-------\nRapidMQ is under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsybrexsys%2FRapidMQ","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsybrexsys%2FRapidMQ","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsybrexsys%2FRapidMQ/lists"}