{"id":19506820,"url":"https://github.com/calvinlfer/actors-and-streams","last_synced_at":"2025-07-09T08:04:31.871Z","repository":{"id":68736704,"uuid":"136421009","full_name":"calvinlfer/actors-and-streams","owner":"calvinlfer","description":"Yet another example showing how to use `Sink.actorRef` but with the added twist of using timers","archived":false,"fork":false,"pushed_at":"2018-06-07T04:18:45.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T08:04:06.168Z","etag":null,"topics":["akka","akka-actors","akka-streams","backpressure","scala","timers"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/calvinlfer.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":"2018-06-07T04:17:07.000Z","updated_at":"2021-03-20T21:55:38.000Z","dependencies_parsed_at":"2023-06-06T09:00:37.548Z","dependency_job_id":null,"html_url":"https://github.com/calvinlfer/actors-and-streams","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/calvinlfer/actors-and-streams","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calvinlfer%2Factors-and-streams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calvinlfer%2Factors-and-streams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calvinlfer%2Factors-and-streams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calvinlfer%2Factors-and-streams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calvinlfer","download_url":"https://codeload.github.com/calvinlfer/actors-and-streams/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calvinlfer%2Factors-and-streams/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264419452,"owners_count":23605197,"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","akka-actors","akka-streams","backpressure","scala","timers"],"created_at":"2024-11-10T22:38:37.326Z","updated_at":"2025-07-09T08:04:31.845Z","avatar_url":"https://github.com/calvinlfer.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example: Integrating Akka Actors with Akka Streams #\n\nThe purpose of this example is to show how to integrate a stateful actor which uses batching behavior and needs to \nback-pressure upstream if it receives too many elements whilst it waits to deposit those elements elsewhere. The act of\ndepositing elements elsewhere is done based on a timer. We send elements to this Actor and require back-pressure so that\nno elements are lost or elements are not sent too quickly. The idea behind this is that the Actor may have to poll a \ndata store periodically and store these elements in that data store. There could be a constraint on that data-store \nwhich only allows you to push X elements and no more. So we want to respect those constraints and signal demand\nappropriately upstream so that we don't overwhelm the data-store.\n\nThe `MessageReceiver` actor is responsible for modelling the interaction point between the theoretical data store and \nthe stream. You can imagine that we could be pulling data off a message-queue and feeding those elements downstream. \nThis actor hold an internal buffer and attempts to batch up 10 elements (and no more) in the internal buffer and writes \nthe content of the buffer out every 10 seconds. Note that when the internal buffer is full, we do not send the \nacknowledge message back to the sender (which causes the back-pressure to happen). We set a timer and delay the message\nin the hopes that when the message is received again, the buffer will be cleared and only then do we add it to the\ninternal buffer .\n\nIf you run the application, it will set up a Graph and run it where the upstream emits elements at a far greater pace \nthan the Actor Sink can handle. However, due to back-pressure, the Actor Sink is able to properly signal demand to the \nSource without getting overwhelmed and the entire stream conforms to the pace of the slowest moving part (in this case, \nthe `MessageReceiver`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalvinlfer%2Factors-and-streams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalvinlfer%2Factors-and-streams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalvinlfer%2Factors-and-streams/lists"}