{"id":24791495,"url":"https://github.com/sofyan48/mq-router","last_synced_at":"2025-03-24T14:23:06.407Z","repository":{"id":57746876,"uuid":"521550731","full_name":"sofyan48/mq-router","owner":"sofyan48","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-07T01:39:23.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-19T14:07:48.748Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"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/sofyan48.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}},"created_at":"2022-08-05T07:48:55.000Z","updated_at":"2022-08-05T07:59:43.000Z","dependencies_parsed_at":"2022-09-03T00:21:20.307Z","dependency_job_id":null,"html_url":"https://github.com/sofyan48/mq-router","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fmq-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fmq-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fmq-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofyan48%2Fmq-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofyan48","download_url":"https://codeload.github.com/sofyan48/mq-router/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245285664,"owners_count":20590450,"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":"2025-01-29T19:17:15.869Z","updated_at":"2025-03-24T14:23:06.379Z","avatar_url":"https://github.com/sofyan48.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQS ROUTER\n\n\n## Install\n```\ngo get github.com/sofyan48/mq-router\n```\n## Example\n``` golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/aws/aws-sdk-go/aws\"\n\t\"github.com/aws/aws-sdk-go/aws/credentials\"\n\t\"github.com/aws/aws-sdk-go/aws/session\"\n\t\"github.com/aws/aws-sdk-go/service/sqs\"\n\t\"github.com/aws/aws-sdk-go/service/sqs/sqsiface\"\n\t\"github.com/sofyan48/mq-router\"\n)\n\nfunc main() {\n\tclient := newClient()\n\ttopic1Url := \"https://sqs.ap-southeast-1.amazonaws.com/AWS_ID/sqs-example-topic\"\n\n\trouter := mq.NewRouter()\n\n\trouter.Handle(\"/push/wa\", mq.HandlerFunc(func(m *mq.Message) error {\n\t\tfmt.Println(\"WA:\u003e \", aws.StringValue(m.SQSMessage.Body))\n\t\treturn nil\n\t})).Method(\"POST\")\n\trouter.Handle(\"/push/pu\", mq.HandlerFunc(func(m *mq.Message) error {\n\t\tfmt.Println(\"PU:\u003e \", aws.StringValue(m.SQSMessage.Body))\n\t\treturn nil\n\t})).Method(\"POST\")\n\n\ttopic1 := mq.NewServer(topic1Url, router, mq.WithClient(client))\n\n\tfor {\n\t\ttopic1.Start()\n\t\ttime.Sleep(1 * time.Second)\n\t}\n}\n\nfunc newClient() sqsiface.SQSAPI {\n\n\tcreds := credentials.NewStaticCredentials(\n\t\t\"ACCESS_KEY\",\n\t\t\"SECRET_KEY\", \"\")\n\n\tcredential := \u0026aws.Config{\n\t\tCredentials: creds,\n\t\tRegion:      aws.String(\"ap-southeast-1\"),\n\t}\n\treturn sqs.New(session.New(), credential)\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofyan48%2Fmq-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofyan48%2Fmq-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofyan48%2Fmq-router/lists"}