{"id":13706049,"url":"https://github.com/squaremo/rabbitmq-lvc-plugin","last_synced_at":"2025-03-22T07:32:12.027Z","repository":{"id":783345,"uuid":"476276","full_name":"squaremo/rabbitmq-lvc-plugin","owner":"squaremo","description":"A plugin exchange type for RabbitMQ that acts as a last-value-cache","archived":false,"fork":false,"pushed_at":"2024-03-11T18:26:37.000Z","size":222,"stargazers_count":42,"open_issues_count":0,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-18T09:37:41.531Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/squaremo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2010-01-17T17:30:49.000Z","updated_at":"2024-11-28T16:27:52.000Z","dependencies_parsed_at":"2024-10-28T12:30:46.522Z","dependency_job_id":"c7a32947-22ea-4dee-845b-822d8e993213","html_url":"https://github.com/squaremo/rabbitmq-lvc-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squaremo%2Frabbitmq-lvc-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squaremo%2Frabbitmq-lvc-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squaremo%2Frabbitmq-lvc-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squaremo%2Frabbitmq-lvc-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/squaremo","download_url":"https://codeload.github.com/squaremo/rabbitmq-lvc-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244925175,"owners_count":20532873,"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-02T22:00:51.665Z","updated_at":"2025-03-22T07:32:11.688Z","avatar_url":"https://github.com/squaremo.png","language":"Erlang","funding_links":[],"categories":["Toolbox"],"sub_categories":[],"readme":"# Last value caching exchange\n\n(**NB**: Simon keeps a fork of this which is more likely to be up-to-date with\nRabbitMQ releases, at\nhttps://github.com/simonmacmullen/rabbitmq-lvc-plugin)\n\nThis is a pretty simple implementation of a last value cache using\nRabbitMQ's pluggable exchange types feature.\n\nThe last value cache is intended to solve problems like the following:\nsay I am using messaging to send notifications of some changing values\nto clients; now, when a new client connects, it won't know the value\nuntil it changes.\n\nThe last value exchange acts like a direct exchange (binding keys are\ncompared for equality with routing keys); but, it also keeps track of\nthe last value that was published with each routing key, and when a\nqueue is bound, it automatically enqueues the last value for the\nbinding key.\n\n# How to build it\n\nSet up rabbitmq-public-umbrella, as per the instructions\nat http://www.rabbitmq.com/plugin-development.html:\n\n    $ hg clone http://hg.rabbitmq.com/rabbitmq-public-umbrella\n    $ cd rabbitmq-public-umbrella ; make checkout ; make\n\nThen get the LVC plugin and symlink it into plugins:\n\n    $ git clone git://github.com/squaremo/rabbitmq-lvc-plugin.git\n    $ (cd rabbitmq-lvc-plugin ; make)\n    $ mkdir -p rabbitmq-server/plugins\n    $ cd rabbitmq-server/plugins\n    $ ln -s ../../rabbitmq-lvc-plugin ./\n\nand finally, run the server:\n    $ cd ..\n    $ make run\n\nIn the startup banner you should see a line something like\n\n    starting rabbit_exchange_type_lvc                 ...done\n\nTo use the LVC exchange, with e.g., py-amqp:\n\n    import amqplib.client_0_8 as amqp\n    ch = amqp.Connection().channel()\n    ch.exchange_declare(\"lvc\", type=\"x-lvc\")\n    ch.basic_publish(amqp.Message(\"value\"),\n                     exchange=\"lvc\", routing_key=\"rabbit\")\n    ch.queue_declare(\"q\")\n    ch.queue_bind(\"q\", \"lvc\", \"rabbit\")\n    print ch.basic_get(\"q\").body\n\n# Limitations\n\n## \"Recent value cache\"\n\nAMQP is inherently racey.  It is quite possible to see different\nlast-values but the same subsequent message stream, from different\nclients.\n\nThis won't matter if you simply want to have a value to show until you\nget an update.  If it does matter, consider e.g. using sequence IDs so you\ncan notice out-of-order messages.\n\nThere's also a race in the pluggable exchanges hook, so that clients\ncan \"see\" the binding before the hook has been run; for the LVC, this\nmeans that there's a possiblity that messages will get queued before\nthe last value.  For this reason, I'm thinking of tagging the last\nvalue messages so that clients can fast-forward to it, or ignore it,\nif necessary.\n\n## Values v. deltas\n\nOne question that springs to mind when considering last value caches\nis \"what if I'm sending deltas rather than the whole value?\".  Thre\nLVC exchange doesn't address this use case, but you could do it by\nusing two exchanges and posting full values to the LVC (from the\noriginating process -- presumably you'd be using deltas to save on\ndownstream bandwidth).\n\n## Direct exchanges only\n\nThe semantics of another kind of value-caching exchange (other than\nfanout) aren't obvious.  To choose one option though, say a\nnewly-bound queue was to be given all values that match its binding\nkey -- this would require every supported exchange type to supply a\nreverse routing match procedure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquaremo%2Frabbitmq-lvc-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquaremo%2Frabbitmq-lvc-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquaremo%2Frabbitmq-lvc-plugin/lists"}