{"id":19435949,"url":"https://github.com/ralscha/xodus-queue","last_synced_at":"2025-04-24T21:30:49.171Z","repository":{"id":57728740,"uuid":"133204599","full_name":"ralscha/xodus-queue","owner":"ralscha","description":"Persistent java.util.Queue implementation with Xodus","archived":false,"fork":false,"pushed_at":"2024-10-27T16:59:02.000Z","size":307,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-27T19:56:23.922Z","etag":null,"topics":["blocking-queue","java","kryo","persistent","queue","xodus"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/ralscha.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-13T04:12:34.000Z","updated_at":"2024-10-27T16:59:05.000Z","dependencies_parsed_at":"2023-01-30T19:15:53.544Z","dependency_job_id":"a864a50a-856f-4eaf-b240-19a06f771f17","html_url":"https://github.com/ralscha/xodus-queue","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fxodus-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fxodus-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fxodus-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fxodus-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ralscha","download_url":"https://codeload.github.com/ralscha/xodus-queue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223968314,"owners_count":17233445,"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":["blocking-queue","java","kryo","persistent","queue","xodus"],"created_at":"2024-11-10T15:08:32.448Z","updated_at":"2024-11-10T15:08:33.080Z","avatar_url":"https://github.com/ralscha.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Test Status](https://github.com/ralscha/xodus-queue/workflows/test/badge.svg)\n\nThis project provides a persistent `java.util.Queue` and `java.util.concurrent.BlockingQueue` implementation. It is using [Xodus](https://github.com/JetBrains/xodus) as the underlying storage engine. \nFor persisting POJOs, it relies on [Kryo](https://github.com/EsotericSoftware/kryo).\n\nxodus-queue is not a high-performance queue, and it only works within a single JVM. The primary motivation was to write a queue that survives a server restart and does not introduce a lot of external dependencies to my projects. Because I often use [Xodus](https://github.com/JetBrains/xodus) already in my projects, this library\nonly adds [Kryo](https://github.com/EsotericSoftware/kryo) as an additional dependency. \n\nAny contributions are welcome if something is missing or could be implemented better, submit a pull request, or create an issue.\n\n\n## Usage\n\nCreate an instance of `XodusQueue` or `XodusBlockingQueue` and specify the database directory and the class of the entries you want to put into the queue. \nThese can be either built-in Java types like String, Integer, Long, or a more complex POJO. \n\nIt is recommended to open the queue in an automatic resource management block because the underlying Xodus database should be closed when you no longer access the queue. \n \n```\ntry (XodusQueue\u003cString\u003e queue = new XodusQueue\u003c\u003e(\"./test\", String.class)) {\n\n}\n```\n\nAfter the instantiation, you can call any of the methods from the `java.util.Queue\u003cE\u003e` and `java.util.concurrent.BlockingQueue\u003cE\u003e` interface.\nSee the JavaDoc ([Queue](https://docs.oracle.com/javase/10/docs/api/java/util/Queue.html), [BlockingQueue](https://docs.oracle.com/javase/10/docs/api/java/util/concurrent/BlockingQueue.html)) for a list of all available methods.\n\nCurrently [`iterator()`](https://docs.oracle.com/javase/10/docs/api/java/util/Collection.html#iterator()) is not implemented.\nThe underlying storage engine requires that read and write operations have to run inside transactions, and I don't know how\nto implement that in an iterator. \n\n```\ntry (XodusQueue\u003cString\u003e queue = new XodusQueue\u003c\u003e(\"./queue\", String.class)) {\n  queue.add(\"one\");\n\n  String head = queue.poll(); // \"one\"\n}\n```\n\nThe blocking queue supports a capacity limit. The following example limits the number of elements in the queue to 3. \n`put` blocks the current thread when the queue is full and `take` blocks when the queue is empty.\n```\ntry (XodusBlockingQueue\u003cString\u003e queue = new XodusBlockingQueue\u003c\u003e(\"./blocking_queue\", String.class, 3)) {\n  queue.put(\"one\");\n  queue.put(\"two\");\n\n  String head = queue.take(); // \"one\"\n}\n```\n\n\n## Maven\nThe library is hosted on the Central Maven Repository\n```\n  \u003cdependency\u003e\n    \u003cgroupId\u003ech.rasc\u003c/groupId\u003e\n    \u003cartifactId\u003exodus-queue\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n  \u003c/dependency\u003e\n```\n\n\n## Changelog\n\n### 1.0.1 - May 19, 2018\n  * Fix key management in XodusQueue\n  * Add `java.util.concurrent.BlockingQueue` implementation: XodusBlockingQueue\n\n\n### 1.0.0 - May 15, 2018\n  * Initial release\n\n\n## License\nCode released under [the Apache license](http://www.apache.org/licenses/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fralscha%2Fxodus-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fralscha%2Fxodus-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fralscha%2Fxodus-queue/lists"}