{"id":28194344,"url":"https://github.com/monkey-projects/oci-queue","last_synced_at":"2025-05-16T13:12:10.237Z","repository":{"id":198001258,"uuid":"699839779","full_name":"monkey-projects/oci-queue","owner":"monkey-projects","description":"Access the queue api from Oracle cloud using Clojure","archived":false,"fork":false,"pushed_at":"2023-10-05T13:02:02.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-10-06T13:12:29.306Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monkey-projects.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}},"created_at":"2023-10-03T12:54:08.000Z","updated_at":"2023-10-06T13:12:29.306Z","dependencies_parsed_at":"2023-10-04T01:09:45.947Z","dependency_job_id":null,"html_url":"https://github.com/monkey-projects/oci-queue","commit_stats":null,"previous_names":["monkey-projects/oci-queue"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkey-projects%2Foci-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkey-projects%2Foci-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkey-projects%2Foci-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkey-projects%2Foci-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monkey-projects","download_url":"https://codeload.github.com/monkey-projects/oci-queue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535798,"owners_count":22087399,"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":"2025-05-16T13:11:55.594Z","updated_at":"2025-05-16T13:12:10.229Z","avatar_url":"https://github.com/monkey-projects.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OCI Queue API\n\nThis is a Clojure library that allows you to access the [Oracle Cloud Queue\nAPI](https://docs.oracle.com/en-us/iaas/Content/queue/overview.htm#overview).\n\nIt uses [Martian](https://github.com/oliyh/martian) to map routing configuration\nto actual functions.\n\n## Usage\n\nInclude the lib in your project.\nFor CLI tools (`deps.edn`):\n```clojure\n{:com.monkeyprojects/oci-queue {:mvn/version \"\u003cversion\u003e\"}}\n```\nOr Leiningen:\n```clojure\n[com.monkeyprojects/oci-queue \"\u003cversion\u003e\"]\n```\n\nThe functions are in the `monkey.oci.queue.core` namespace.  First of all, you'll\nhave to create a context.  This must be passed to all functions subsequently.\nThe config needed to create the context should include all fields necessary\nto access the API.  The private key must be a Java PrivateKey object.  You can\nparse one using `monkey.oci.common.utils/load-privkey`.\n\n```clojure\n(require '[monkey.oci.queue.core :as qc])\n(require '[monkey.oci.common.utils :as u])\n\n;; The config is required to access the OCI API\n(def config {:user-ocid \"my-user-ocid\"\n             :tenancy-ocid \"my-tenancy\"\n\t     :key-fingerprint \"some fingerprint\"\n\t     :region \"eu-frankfurt-1\"\n\t     :private-key (u/load-privkey \"my-key-file\")})\n\t     \n\n(def ctx (qc/make-context config))\n\n;; Do some stuff\n@(qc/list-queues ctx {})\n; =\u003e Functions return a deferred so deref it\n```\n\nThe functions return the raw response from the API, where the body is parsed from JSON.\nThis is because sometimes you'll need the headers, e.g. for pagination.  Mostly you'll\njust need the `:body` and `:status`.  Some higher-order functions will be provided\nlater on to allow you to work with these values.\n\n### Queue Context\n\nNext to the general endpoint that is used to list or manage queues, there is also a\nqueue-specific endpoint.  This endpoint can be retrieved by invoking `get-queue` or\n`list-queues` and must be used for most API calls that involve a single queue, like\nposting or retrieving messages.  For this, the `make-queue-context` function is needed.\n\n```clojure\n(def queue-id \"some-queue-ocid\")\n;; Retrieve information about the queue\n(def q @(qc/get-queue ctx {:queue-id queue-id}))\n;; Get the endpoint from the response\n(def ep (-\u003e q :body :messages-endpoint))\n;; Now create a new context\n(def qctx (qc/make-queue-context conf ep))\n\n;; Use the queue context for more calls\n@(qc/put-messages qctx {:queue-id queue-id\n                        :messages [{:content \"Test message\"}]})\n```\n\n### Available Endpoints\n\nThe endpoints are auto-generated from the routes declared in the [core namespace](src/monkey/oci/queue/core.clj)\nand they reflect those declared in the [Queue Api documentation](https://docs.oracle.com/en-us/iaas/api/#/en/queue/20210201/).\n\n### Async Channels\n\nThe `monkey.oci.queue.async` namespace contains functions for linking\n[core.async](https://github.com/clojure/core.async/) channels to queues.  For this\nthe `queue-\u003echan` and `chan-\u003equeue` functions can be used.  Example:\n\n```clojure\n(require '[monkey.oci.queue.async :as qa])\n(require '[clojure.core.async :refer [\u003c!! \u003e!!]])\n\n;; Let's assume we have a queue context `qctx` for queue with id `qid`\n\n;; To receive messages in a channel, do this:\n(def in (qa/queue-\u003echan qctx {:queue-id qid}))\n(\u003c!! in)\n;; =\u003e Should receive the next message available on the queue\n\n;; You can also do the other direction:\n(def out (qa/chan-\u003equeue (ca/chan) {:queue-id qid}))\n(\u003e!! out {:content \"This is a test message\"})\n```\n\nNote that when posting messages, you have to follow the expected format of the REST call.\nThis also allows you to specify the `channelId` and any custom properties in the metadata,\nas specified [in the Oracle docs](https://docs.oracle.com/en-us/iaas/api/#/en/queue/20210201/datatypes/PutMessagesDetailsEntry).\n\nIn similar fashion you can filter incoming messages by passing in the `:channel-filter`\noption to the `queue-\u003echan` function.\n\n## License\n\nMIT license, see [LICENSE](LICENSE).\nCopyright (c) 2023 by [Monkey Projects BV](https://www.monkeyprojects.be).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonkey-projects%2Foci-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonkey-projects%2Foci-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonkey-projects%2Foci-queue/lists"}