{"id":50878342,"url":"https://github.com/hbf/akka-throttler","last_synced_at":"2026-07-03T02:01:15.642Z","repository":{"id":4063438,"uuid":"5167255","full_name":"hbf/akka-throttler","owner":"hbf","description":"A throttler for Akka 2.0+","archived":false,"fork":false,"pushed_at":"2013-09-22T22:09:29.000Z","size":1240,"stargazers_count":45,"open_issues_count":0,"forks_count":12,"subscribers_count":10,"default_branch":"master","last_synced_at":"2023-03-25T21:23:07.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/hbf.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":"2012-07-24T15:17:12.000Z","updated_at":"2022-06-27T21:22:34.000Z","dependencies_parsed_at":"2022-07-29T01:39:04.486Z","dependency_job_id":null,"html_url":"https://github.com/hbf/akka-throttler","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/hbf/akka-throttler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbf%2Fakka-throttler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbf%2Fakka-throttler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbf%2Fakka-throttler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbf%2Fakka-throttler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hbf","download_url":"https://codeload.github.com/hbf/akka-throttler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbf%2Fakka-throttler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35069183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"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":[],"created_at":"2026-06-15T12:00:25.786Z","updated_at":"2026-07-03T02:01:15.630Z","avatar_url":"https://github.com/hbf.png","language":"Scala","funding_links":[],"categories":["容错组件"],"sub_categories":["微服务框架"],"readme":"NOTICE!\n-------\n\nThe code from this project will be included into [Akka 2.1][11] and will no longer be maintained here. Visit the [Experimental Modules][9] section in the [Akka Documentation][10] for the latest version.\n\nA throttler for Akka 2.0\n========================\n\n\nWhat is this about?\n--------------------\n\nA typical usage scenario for a throttler is this: your application needs to make calls to an external webservice and this webservice has a restriction in place. You may only make _X_ calls in _Y_ seconds. You get blocked or need to pay gold if you don't stay under this limit. With a throttler, you can ensure that the calls you make do not cross the threshold rate.\n\nYou create a throttler by specifying a _rate_, for example `3 msgsPer (1 second)` and a _target actor_. You can then send the throttler messages at any rate, and the throttler will send the messages to the target at a rate at most 3 msg/s.\n\nExample\n-------\n\n```scala\n// A simple actor that prints whatever it receives\nval printer = system.actorOf(Props(new Actor {\n  def receive = {\n    case x =\u003e println(x)\n  }\n}))\n\n// The throttler for this example, setting the rate\nval throttler = system.actorOf(Props(new TimerBasedThrottler(3 msgsPer (1 second))))\n\n// Set the target\nthrottler ! SetTarget(Some(printer))\n\n// These three messages will be sent to the printer immediately\nthrottler ! Queue(\"1\")\nthrottler ! Queue(\"2\")\nthrottler ! Queue(\"3\")\n\n// These two will wait at least until 1 second has passed\nthrottler ! Queue(\"4\")\nthrottler ! Queue(\"5\")\n\n```\n\nStatus\n------\nTake a look at the [API][3] to see what is provided. Most of the functionality is documented [here][7] and \"described\" in the [tests][6]. To run them, check out the code and do a `sbt test`. (You will need at least sbt version 0.11.3.)\n\nCurrently, the project only provides a timer-based implementation of a throttler, see [TimerBasedThrottler][2]. As [described][2] in the class documentation, this throttler only provides weak guarantees.\n\nThere are plans to add an implementation of a history-based throttler that provides stronger guarantees, like for example the [one][4] by Charles Cordingley.\n\nDownload, Maven, SBT\n--------------------\nThe packages are published to the Maven repository [http://hbf.github.com/akka-throttler/maven-repo][8]. You get the latest version using \n\n```scala\n    resolvers += \"akka-throttler-github-repository\" at \"http://hbf.github.com/akka-throttler/maven-repo\"\n    \n    libraryDependencies ++= Seq(\n      // ...\n      \"akka.pattern.throttle\"  %% \"akka-throttler\"   % \"1.0-SNAPSHOT\" withSources\n    )\n```\n\nThe Maven repository contains builds for Scala 2.9.1 and 2.9.2. If you need something else, open an issue to let me know.\n\nFor Maven, add the following to your `pom.xml`:\n\n```xml\n\t\u003crepositories\u003e\n\t\t\u003c!-- ... --\u003e\n\t\t\u003crepository\u003e\n\t\t\t\u003cid\u003eakka-throttler-github-repository\u003c/id\u003e\n\t\t\t\u003curl\u003ehttp://hbf.github.com/akka-throttler/maven-repo\u003c/url\u003e\n\t\t\u003c/repository\u003e\n\t\u003c/repositories\u003e\n\t\u003cdependencies\u003e\n\t\t\u003c!-- ... --\u003e\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003eakka-throttler\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003eakka.pattern.throttle_SCALAVERSION\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e1.0-SNAPSHOT\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\t\u003c/dependencies\u003e\n```\n\nHere, `SCALAVERSION` should be `2.9.1` or `2.9.2`.\n\n\nLicense\n-------\nThe code is available under the [Apache 2 License](http://www.apache.org/licenses/LICENSE-2.0.html), which is explained [here](http://www.tldrlegal.com/license/apache-license-2.0-(apache-2.0).\n\nIf you use the code in your project/product, please drop us a note – we are always interested in learning about new applications!\n\n  [1]: http://akka.io/\n  [2]: http://hbf.github.com/akka-throttler/doc/api/#akka.pattern.throttle.TimerBasedThrottler\n  [3]: http://hbf.github.com/akka-throttler/doc/api/\n  [4]: http://www.cordinc.com/blog/2010/04/java-multichannel-asynchronous.html\n  [5]: http://creativecommons.org/licenses/by/3.0/\n  [6]: https://github.com/hbf/akka-throttler/blob/master/src/test/scala/akka/pattern/throttle/TimerBasedThrottlerSpec.scala\n  [7]: http://hbf.github.com/akka-throttler/doc/api/#akka.pattern.throttle.Throttler\n  [8]: http://hbf.github.com/akka-throttler/maven-repo\n  [9]: http://doc.akka.io/docs/akka/snapshot/experimental/index.html\n  [10]: http://akka.io/docs/\n  [11]: http://akka.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhbf%2Fakka-throttler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhbf%2Fakka-throttler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhbf%2Fakka-throttler/lists"}