{"id":16965294,"url":"https://github.com/s12v/akka-stream-sqs","last_synced_at":"2025-04-11T23:05:06.856Z","repository":{"id":57736722,"uuid":"67935011","full_name":"s12v/akka-stream-sqs","owner":"s12v","description":"Reactive SQS for Akka streams","archived":false,"fork":false,"pushed_at":"2019-01-07T11:46:11.000Z","size":47,"stargazers_count":9,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T11:14:53.113Z","etag":null,"topics":["akka-streams","aws","sqs"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/s12v.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-09-11T14:41:03.000Z","updated_at":"2020-05-16T01:19:58.000Z","dependencies_parsed_at":"2022-08-24T02:51:12.755Z","dependency_job_id":null,"html_url":"https://github.com/s12v/akka-stream-sqs","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s12v%2Fakka-stream-sqs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s12v%2Fakka-stream-sqs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s12v%2Fakka-stream-sqs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s12v%2Fakka-stream-sqs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s12v","download_url":"https://codeload.github.com/s12v/akka-stream-sqs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239805922,"owners_count":19700214,"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":["akka-streams","aws","sqs"],"created_at":"2024-10-13T23:45:35.547Z","updated_at":"2025-02-20T08:31:42.248Z","avatar_url":"https://github.com/s12v.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/s12v/akka-stream-sqs.svg?branch=master)](https://travis-ci.org/s12v/akka-stream-sqs)\n[![Maven Central](https://img.shields.io/maven-central/v/me.snov/akka-stream-sqs_2.11.svg?maxAge=2592000)](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22akka-stream-sqs_2.11%22)\n[![codecov](https://codecov.io/gh/s12v/akka-stream-sqs/branch/master/graph/badge.svg)](https://codecov.io/gh/s12v/akka-stream-sqs)\n\n# Note: This project is depreated\n\nPlease use [alpakka-sqs](https://github.com/akka/alpakka/tree/master/sqs/src)\n\n# akka-stream-sqs\n\nReactive SQS implementation for [Akka streams](http://doc.akka.io/docs/akka/current/scala/stream/)\npowered by [AWS SDK for Java](http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/overview-summary.html)\n\nAvailable at Maven Central for Scala 2.11 and 2.12:\n```\nlibraryDependencies += \"me.snov\" %% \"akka-stream-sqs\" % \"0.2.2\"\n```\n\n## Overview\n\n- Provides building blocks (partial graphs) for Akka streams integration with SQS\n- Based on AWS SDK for Java and operates with raw objects from the SDK\n- Lightweight, no unnecessary layers over AWS SDK\n- Supports Typesafe config\n- Consumer automatically reconnects on failure\n- Supports delayed message requeue\n\n## Quick example\n\n### Message processing with acknowledgement\n\nRead SQS configuration from config file, pull messages from the queue, process, and acknowledge.\nThis stream listens for new messages and never stops.\n\n```\nval sqsSettings = SqsSettings(system) // use existing ActorSystem\nSource.fromGraph(SqsSourceShape(settings))\n\t.mapAsync(parallelism = 4)({ message: Message =\u003e Future {\n\t\tprintln(s\"Processing ${message.getMessageId}\")\n\n\t\t(message, Ack())\n\t  }\n\t})\n\t.runWith(Sink.fromGraph(SqsAckSinkShape(settings)))\n```\n\n### Send a message\n\nSend \"hello\" to the queue and wait for result.\n\n```\nval sqsSettings = SqsSettings(system) // use existing ActorSystem\nval future = Source.single(new SendMessageRequest().withMessageBody(\"test\"))\n\t.runWith(Sink.fromGraph(SqsPublishSinkShape(sqsSettings)))\nAwait.ready(future, 1.second)\t\n```\n\n## Components\n\n### SqsSourceShape\n\n- Type: Source\n- Emits `com.amazonaws.services.sqs.model.Message`\n\nInfinite source of SQS messages.\nOnly queries Amazon services when there's demand from upstream (i.e. all previous messages have been consumed).\nMessages are loaded in batches by `maxNumberOfMessages` and pushed one by one.\n\nWhen SQS is not available, it tries to reconnect infinitely.\n\n\n### SqsAckSinkShape\n\n- Type: Sink\n- Accepts `(com.amazonaws.services.sqs.model.Message, MessageAction)`\n- Materialized value: `Future[Done]`\n\nAcknowledges processed messages.\nCompletes with `Done` when all messages are processed or `Failure` on upstream failure.\n\nYour flow must decide which action to take and push it with message:\n- `Ack` - delete message from the queue.\n- `RequeueWithDelay(delaySeconds: Int)` - schedule a retry.\n\n\n### SqsPublishSinkShape\n\n- Type: Sink\n- Accepts `com.amazonaws.services.sqs.model.SendMessageRequest`\n- Materialized value: `Future[Done]`\n\nPublishes messages to the Amazon service.\nCompletes with `Done` when all messages are processed or `Failure` on upstream failure.\n\n\n### Types\n\n`akka-stream-sqs` uses raw types from AWS SDK when possible.  \n\n- `SqsMessageWithAction` - alias for `(SqsMessage, MessageAction)`\n- `MessageActionPair` - either `Ack` which means \"delete message\"\n                        or `RequeueWithDelay(delaySeconds: Int)` which means \"requeue and try later\"\n\n\n## Configuration\n\n### Typesafe configuration\n\nIf you provide `ActorSystem` to `SqsSettings`, it will read your configuration file:\n\n```\nakka-stream-sqs {\n\n  # QueueUrl\n  #\n  # The URL of the Amazon SQS queue to take action on.\n  queue-url = \"http://localhost:9324/queue/queue1\"\n\n  # MaxNumberOfMessages\n  #\n  # The maximum number of messages to return. Amazon SQS never returns more messages than this value\n  # but may return fewer. Values can be from 1 to 10.\n  # Default: 10\n  max-number-of-messages = 10\n\n  # WaitTimeSeconds\n  #\n  # The duration (in seconds) for which the call will wait for a message to arrive in the queue\n  # before returning. If a message is available, the call will return sooner than WaitTimeSeconds.\n  # Default: 10\n  wait-time-seconds = 10\n\n  # VisibilityTimeout\n  #\n  # The duration (in seconds) that the received messages are hidden from subsequent retrieve requests\n  # after being retrieved by a ReceiveMessage request.\n  # Optional\n  # visibility-timeout = 60\n\n  # AWS endpoint and region override.\n  #\n  # Note you have to provide both values if you want to override \n  # the endpoint settings. This is due to the EndpointConfiguration object.\n  # Optional\n  # endpoint = \"http://localhost:9324/\"\n  # region = \"eu-west-1\n  \n  # MessageAttributeNames\n  #\n  # A list of message attributes wich will be received if present in the message. \n  # you can send a list of attribute names to receive, or you can return all\n  # of the attributes by specifying \"All\" or \".*\". You can also use all message\n  # attributes starting with a prefix, for example \"bar.*\".\n  # message-attributes = [\"foo\", \"bar\", \"All\", \"foo.*\"]\n}\n```\n\n### SqsSettings\n\nWrapper for AWS SDK settings. You can override client and its configuration, credentials provider, and queue options.\n\n - `awsClient` - `AmazonSQSAsync`, by default, `AmazonSQSAsyncClient` is used\n - `awsCredentialsProvider` - `AWSCredentialsProvider`, by default [`DefaultAWSCredentialsProviderChain`](http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html)\n                              is used\n - `awsClientConfiguration` - `ClientConfiguration`, by default `ClientConfiguration`\n - `queueUrl` - The URL of the Amazon SQS queue to take action on. Queue URLs are case-sensitive.\n - `maxNumberOfMessages` - The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer.\n \t\t\t\t\t\t   Values can be from 1 to 10. Default is 1. All of the messages are not necessarily returned. Default is `10`\n - `waitTimeSeconds` - The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning.\n                       If a message is available, the call will return sooner than WaitTimeSeconds. Default is '10'\n - `visibilityTimeout` - The duration (in seconds) that the received messages are hidden from subsequent retrieve\n                         requests after being retrieved by a ReceiveMessage request.\n- `MessageAttributeNames - A list of MessageAttributeNames you want to be able to receive, if you don't provide values here than all message attributes\nwill be ignored. \n\nFor more information, please refer to [AWS SDK for Java](http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/overview-summary.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs12v%2Fakka-stream-sqs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs12v%2Fakka-stream-sqs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs12v%2Fakka-stream-sqs/lists"}