{"id":18634851,"url":"https://github.com/umran/mq","last_synced_at":"2026-04-20T06:03:04.538Z","repository":{"id":96192114,"uuid":"249917437","full_name":"umran/mq","owner":"umran","description":"A Cloud-Agnostic Go Library for Publishing to and Consuming from Message Queues","archived":false,"fork":false,"pushed_at":"2021-12-15T10:37:32.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-23T05:05:59.352Z","etag":null,"topics":["aws","aws-sns-sqs","broker","gcp","google-cloud-pubsub","message","messaging","mq","pubsub","queue","sns","sqs","subscription","topic"],"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/umran.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}},"created_at":"2020-03-25T07:49:53.000Z","updated_at":"2021-12-14T19:17:02.000Z","dependencies_parsed_at":"2023-04-13T09:32:20.335Z","dependency_job_id":null,"html_url":"https://github.com/umran/mq","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/umran/mq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umran%2Fmq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umran%2Fmq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umran%2Fmq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umran%2Fmq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umran","download_url":"https://codeload.github.com/umran/mq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umran%2Fmq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018217,"owners_count":26086308,"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-14T02:00:06.444Z","response_time":60,"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":["aws","aws-sns-sqs","broker","gcp","google-cloud-pubsub","message","messaging","mq","pubsub","queue","sns","sqs","subscription","topic"],"created_at":"2024-11-07T05:22:11.525Z","updated_at":"2025-10-14T07:42:44.298Z","avatar_url":"https://github.com/umran.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MQ - A Cloud-Agnostic Go Library for Publishing to and Consuming from Message Queues\nThis library exposes a simple interface with methods to publish to and consume from an underlying message queue. Implementations for AWS SNS+SQS and Google Cloud PubSub come out of the box, with future plans to implement other providers like RabbitMQ and Kafka.\n\n## Installation\n```\ngo get github.com/umran/mq\n```\n\n## Creating a Broker Configured for Google Cloud PubSub\n```go\nbroker, err := mq.Broker(\u0026mq.Config{\n    Provider: mq.ProviderGCP,\n})\n```\n\n## Creating a Broker Configured for AWS SNS+SQS\n```go\nbroker, err := mq.Broker(\u0026mq.Config{\n    Provider: mq.ProviderAWS,\n})\n```\n\n## Usage\nOnce a Broker is created, the rest of the API behaves the same regardless of the underlying provider\n\n### Creating a Topic\n```go\nerr := broker.CreateTopic(\"Topic_ID\")\n```\n\n### Creating a Subscription to a Topic\nThis operation is equivalent to creating a queue and subscribing the queue to a specified topic\n```go\nerr := broker.CreateSubscription(\"Subscription_ID\", \u0026mq.SubscriptionOptions{\n    TopicID: \"Topic_ID\" // the ID of the topic to subscribe to,\n    AckDeadline:       10,\n    RetentionDuration: 7 * 24 * 60 * 60,\n})\n```\n\n### Publishing to a Topic\n```go\nerr := broker.Publish(\"Topic_ID\", \u0026mq.Message{\n    Data: []byte(\"this is a message\"),\n    // Attributes are an optional set of key value pairs of strings\n    Attributes: map[string]string{\n        \"key\": \"value\",\n    },\n})\n```\n\n### Consuming from a Subscription\nConsume listens for new messages published to a subscription and processes them according to a handler function.\nThe return type of the handler function is an error. If the handler function returns an error, the message is nacked, thereby causing the message to be republished. If the handler function returns no error, the message is acked. However, since arbitrary failures such as network failure can prevent messages that have already been successfully processed from being acked, there is no guarantee of exactly once delivery. For this reason, the handler function should be idempotent.\n\nThis method also requires a second argument, which specifies some parameters that determine the behaviour of the consuming process.\n\nNote also that this is a blocking operation as it keeps an open connection while listening for new messages\n```go\nerr := broker.Consume(\"Subscription_ID\", func(msg *mq.Message) error {\n    fmt.Println(string(msg.Data))\n    return nil\n}, \u0026mq.ConsumerOptions{\n    MaxOutstandingMessages: 1,  // the number of messages to take off the queue at a time  \n    Concurrency:            1,   // the number of go routines to deploy for handling messages\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumran%2Fmq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumran%2Fmq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumran%2Fmq/lists"}