{"id":13805984,"url":"https://github.com/bascan/aws-dropwizard","last_synced_at":"2025-05-13T21:31:56.757Z","repository":{"id":24472394,"uuid":"27876189","full_name":"bascan/aws-dropwizard","owner":"bascan","description":"Utility library that integrates the Amazon SQS and SNS offering with the Dropwizard REST framework.","archived":true,"fork":false,"pushed_at":"2019-12-01T14:15:41.000Z","size":163,"stargazers_count":14,"open_issues_count":1,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-18T22:31:05.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/bascan.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":"2014-12-11T14:50:31.000Z","updated_at":"2023-01-28T10:21:26.000Z","dependencies_parsed_at":"2022-08-22T16:40:23.096Z","dependency_job_id":null,"html_url":"https://github.com/bascan/aws-dropwizard","commit_stats":null,"previous_names":["bascan/sqs-dropwizard"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bascan%2Faws-dropwizard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bascan%2Faws-dropwizard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bascan%2Faws-dropwizard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bascan%2Faws-dropwizard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bascan","download_url":"https://codeload.github.com/bascan/aws-dropwizard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254031148,"owners_count":22002712,"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-08-04T01:01:06.892Z","updated_at":"2025-05-13T21:31:56.346Z","avatar_url":"https://github.com/bascan.png","language":"Java","funding_links":[],"categories":["Open Source"],"sub_categories":["Eclipse"],"readme":"# aws-dropwizard\nYou can find the latest release on Maven Central: \u003chttp://search.maven.org\u003e under:\n- Group ID: ``io.interact``\n- Artifact ID: ``sqs-dropwizard``\n\n## Introduction\n\naws-dropwizard is a utility library that integrates the Amazon SQS and SNS offerings with the Dropwizard REST framework.\nIt contains convenience classes for sending messages to - and receiving from - SQS queues while being managed\nby the Dropwizard framework. It also supports creating and managing SNS clients for push notifications.\n\n## Getting started\n- Add the following settings to your configuration yaml file:\n\n````yaml\n# Amazon SQS settings.\nawsFactory:\n  awsAccessKeyId: ...\n  awsSecretKey: ...\n  awsRegion: ...\n\nsqsListenQueueUrl: https://sqs...\n````\n\n- Add the Aws factory and the listen queue URL to your configuration class:\n\n````java\n    @Valid\n    @NotNull\n    @JsonProperty\n    private AwsFactory awsFactory;\n\n    @NotNull\n    @JsonProperty\n    private String sqsListenQueueUrl;\n\n    public AwsFactory getAwsFactory() {\n        return sqsFactory;\n    }\n\n    public void setAwsFactory(AwsFactory awsFactory) {\n        this.sqsFactory = sqsFactory;\n    }\n\n    public String getSqsListenQueueUrl() {\n        return sqsListenQueueUrl;\n    }\n\n    public void setSqsListenQueueUrl(String sqsListenQueueUrl) {\n        this.sqsListenQueueUrl = sqsListenQueueUrl;\n    }\n````\n\n## SQS\n\n- Extend the MessageHandler class and process the messages that you expect to receive in the handle() method\n(you can register multiple MessageHandler instances with the queue listener):\n\n````java\npackage ...;\n\nimport io.interact.sqsdw.sqs.MessageHandler;\n\npublic class MessageHandlerImpl extends MessageHandler {\n\n\tpublic MessageHandlerImpl() {\n        super(\"MyMessageType\");\n    }\n\n    public void handle(Message message) {\n\t\t// Message processing here.\n    }\n\n}\n````\n\n- Register the queue listener in the run() method of your application class\n(you can inject the constructor arguments into an SqsListenerImpl instance with Guice):\n\n````java\n    @Override\n    public void run(IlinkSfdcConfiguration conf, Environment env) {\n        final AmazonSQS sqs = conf.getSqsFactory().buildSQSClient(env);\n\n        final MessageHandler handler = ...\n\n        final Set\u003cMessageHandler\u003e handlers = new HashSet\u003c\u003e();\n        handlers.add(handler);\n        \n        final SqsListener sqsListener = new SqsListenerImpl(sqs, conf.getSqsListenQueueUrl(), handlers);\n\n        env.lifecycle().manage(sqsListener);\n        env.healthChecks().register(\"SqsListener\", new SqsListenerHealthCheck(sqsListener));\n    }\n````\n\n- Send messages to SQS from your client with the MessageDispatcher helper class:\n\n````java\nMessageDispatcher.dispatch(yourData, queueUrl, \"MyMessageType\", sqs);\n````\n\nDispatched messages of type \"MyMessageType\" will be handled by your MessageHandlerImpl class now.\nYou can loosely couple clients and message handlers by using several message types in your application(s).\n\nYou'll now have an extra health check called \"SqsListener\" that monitors the health of your queue.\n\n\n## SNS\n\n- You can also build an SNS client with your AwsFactory instance using the credentials and region specified in your .yaml file. The client will automatically be shutdown at the end of the application's lifecycle.\n\n````java\n    @Override\n    public void run(IlinkSfdcConfiguration conf, Environment env) {\n        final AmazonSNS sns = conf.getSqsFactory().buildSNSClient(env);\n        sns.publish(\"arn\", \"hello world\");\n   \n    }\n````\n\n\nThat's it!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbascan%2Faws-dropwizard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbascan%2Faws-dropwizard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbascan%2Faws-dropwizard/lists"}