{"id":18815387,"url":"https://github.com/crosbymichael/messages","last_synced_at":"2025-04-13T21:51:35.641Z","repository":{"id":10627472,"uuid":"12850284","full_name":"crosbymichael/messages","owner":"crosbymichael","description":"Simple message passing across processes or the world via redis","archived":false,"fork":false,"pushed_at":"2014-08-03T22:41:44.000Z","size":208,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T12:11:35.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crosbymichael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-15T18:32:21.000Z","updated_at":"2019-05-21T16:32:36.000Z","dependencies_parsed_at":"2022-09-02T13:42:09.525Z","dependency_job_id":null,"html_url":"https://github.com/crosbymichael/messages","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/crosbymichael%2Fmessages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crosbymichael%2Fmessages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crosbymichael%2Fmessages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crosbymichael%2Fmessages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crosbymichael","download_url":"https://codeload.github.com/crosbymichael/messages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788855,"owners_count":21161726,"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-11-07T23:48:51.644Z","updated_at":"2025-04-13T21:51:35.615Z","avatar_url":"https://github.com/crosbymichael.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"##Messages\n\nMessages is a very simple go pkg to send and receive messages using redis as the broker.  The message format is simple so other languages can implement the format.\nA message consists of it's `ID`, unix timestamp when it was `Created`, the `Mailbox` that was used to send it, and the `Body` which is a json object.\n\nYou configure the redis connection via environment variables:\n\n```bash\nREDIS_PROTO=tcp\nREDIS_ADDR=127.0.0.0:6379\n```\n\n###Example\n\n**Create a new Mailbox**\n\n```golang\nmbox := messages.NewMailbox(\"feeds\") \n```\n\n\n**Create a new message with a json encoded body**\n```golang\nfeed := \u0026Feed{\n    Url:    \"http://crosbymichael.com/feeds/all.atom.xml\",\n    Author: \"Michael\",\n}\n\nm := mbox.NewMessage()\nif err := m.Marshal(feed); err != nil {\n    panic(err)\n}\n```\n\n**Send the message to the mailbox**\n```golang\nif err := mbox.Send(m); err != nil {\n    panic(err)\n}\n```\n\n**Wait for messages to arrive in the mailbox**\n```golang\nm, err := mbox.Wait()\nif err != nil {\n    panic(err)\n}\n```\n\n**Read data from the message**\n```golang\nvar newFeed Feed\nif err := m.Unmarshal(\u0026newFeed); err != nil {\n    panic(err)\n}\n\nfmt.Printf(\"ID: %s\\nMailbox: %s\\nCreated: %s\\n\", m.ID, m.Mailbox, m.Time().Format(time.RubyDate))\nfmt.Printf(\"Body: %v\\n\", newFeed)\n```\n\n**Destroy the message data from the mailbox after 500 seconds**\n```golang\nif err := mbox.DestoryAfter(m, 500); err != nil {\n    panic(err)\n}\n```\n\n**Result**\n```bash\nID: message:feeds:ec9cf5aee06277cff5dd0ea3e18c79db5d6422e731704e1f24bcfe189d93c7b5\nMailbox: feeds\nCreated: Sun Sep 15 18:27:25 +0000 2013\nBody: {http://crosbymichael.com/feeds/all.atom.xml Michael}\n```\n\nSimple messaging that works across process or the world.\n\n###License\nMIT\n\nCopyright (c) 2013 Michael Crosby. michael@crosbymichael.com\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation \nfiles (the \"Software\"), to deal in the Software without \nrestriction, including without limitation the rights to use, copy, \nmodify, merge, publish, distribute, sublicense, and/or sell copies \nof the Software, and to permit persons to whom the Software is \nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be \nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED,\nINCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \nHOLDERS BE LIABLE FOR ANY CLAIM, \nDAMAGES OR OTHER LIABILITY, \nWHETHER IN AN ACTION OF CONTRACT, \nTORT OR OTHERWISE, \nARISING FROM, OUT OF OR IN CONNECTION WITH \nTHE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrosbymichael%2Fmessages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrosbymichael%2Fmessages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrosbymichael%2Fmessages/lists"}