{"id":20812559,"url":"https://github.com/superstreamlabs/memphis.java","last_synced_at":"2025-09-18T08:54:24.659Z","repository":{"id":103056257,"uuid":"572948660","full_name":"superstreamlabs/memphis.java","owner":"superstreamlabs","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-20T11:46:42.000Z","size":139,"stargazers_count":8,"open_issues_count":41,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T04:32:33.710Z","etag":null,"topics":[],"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/superstreamlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-01T11:28:58.000Z","updated_at":"2025-02-27T10:14:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"69d13d53-7a1a-48b5-a9ac-20b9eba9ebaf","html_url":"https://github.com/superstreamlabs/memphis.java","commit_stats":null,"previous_names":["superstreamlabs/memphis.java","memphisdev/memphis.java"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/superstreamlabs/memphis.java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstreamlabs%2Fmemphis.java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstreamlabs%2Fmemphis.java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstreamlabs%2Fmemphis.java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstreamlabs%2Fmemphis.java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superstreamlabs","download_url":"https://codeload.github.com/superstreamlabs/memphis.java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstreamlabs%2Fmemphis.java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275739260,"owners_count":25519601,"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","status":"online","status_checked_at":"2025-09-18T02:00:09.552Z","response_time":77,"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":"2024-11-17T20:55:29.798Z","updated_at":"2025-09-18T08:54:24.626Z","avatar_url":"https://github.com/superstreamlabs.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n  ![Memphis light logo](https://github.com/memphisdev/memphis-broker/blob/master/logo-white.png?raw=true#gh-dark-mode-only)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  ![Memphis light logo](https://github.com/memphisdev/memphis-broker/blob/master/logo-black.png?raw=true#gh-light-mode-only)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003ch4\u003eSimple as RabbitMQ, Robust as Apache Kafka, and Perfect for microservices.\u003c/h4\u003e\n\n\u003cimg width=\"750\" alt=\"Memphis UI\" src=\"https://user-images.githubusercontent.com/70286779/204081372-186aae7b-a387-4253-83d1-b07dff69b3d0.png\"\u003e\u003cbr\u003e\n\n\n  \u003ca href=\"https://landscape.cncf.io/?selected=memphis\"\u003e\u003cimg width=\"200\" alt=\"CNCF Silver Member\" src=\"https://github.com/cncf/artwork/raw/master/other/cncf-member/silver/white/cncf-member-silver-white.svg#gh-dark-mode-only\"\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  \u003cimg width=\"200\" alt=\"CNCF Silver Member\" src=\"https://github.com/cncf/artwork/raw/master/other/cncf-member/silver/color/cncf-member-silver-color.svg#gh-light-mode-only\"\u003e\n\n\u003c/div\u003e\n\n \u003cp align=\"center\"\u003e\n  \u003ca href=\"https://sandbox.memphis.dev/\" target=\"_blank\"\u003eSandbox\u003c/a\u003e - \u003ca href=\"https://memphis.dev/docs/\"\u003eDocs\u003c/a\u003e - \u003ca href=\"https://twitter.com/Memphis_Dev\"\u003eTwitter\u003c/a\u003e - \u003ca href=\"https://www.youtube.com/channel/UCVdMDLCSxXOqtgrBaRUHKKg\"\u003eYouTube\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://discord.gg/WZpysvAeTf\"\u003e\u003cimg src=\"https://img.shields.io/discord/963333392844328961?color=6557ff\u0026label=discord\" alt=\"Discord\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/memphisdev/memphis-broker/issues?q=is%3Aissue+is%3Aclosed\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-closed/memphisdev/memphis-broker?color=6557ff\"\u003e\u003c/a\u003e \n\u003ca href=\"https://github.com/memphisdev/memphis-broker/blob/master/CODE_OF_CONDUCT.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/Code%20of%20Conduct-v1.0-ff69b4.svg?color=ffc633\" alt=\"Code Of Conduct\"\u003e\u003c/a\u003e \n\u003ca href=\"https://docs.memphis.dev/memphis/release-notes/releases/v0.4.2-beta\"\u003e\u003cimg alt=\"GitHub release (latest by date)\" src=\"https://img.shields.io/github/v/release/memphisdev/memphis-broker?color=61dfc6\"\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/github/last-commit/memphisdev/memphis-broker?color=61dfc6\u0026label=last%20commit\"\u003e\n\u003c/p\u003e\n\n**[Memphis](https://memphis.dev)** is a next-generation alternative to traditional message brokers.\u003cbr\u003e\u003cbr\u003e\nA simple, robust, and durable cloud-native message broker wrapped with\u003cbr\u003e\nan entire ecosystem that enables cost-effective, fast, and reliable development of modern queue-based use cases.\u003cbr\u003e\u003cbr\u003e\nMemphis enables the building of modern queue-based applications that require\u003cbr\u003e\nlarge volumes of streamed and enriched data, modern protocols, zero ops, rapid development,\u003cbr\u003e\nextreme cost reduction, and a significantly lower amount of dev time for data-oriented developers and data engineers.\n\n## Installation\n\n```sh\n$ gradle install memphis-dev\n```\n\n## Importing\n\n```java\nimport com.memphis.Memphis;\n```\n\n### Connecting to Memphis\n\nFirst, we need to create a connection to the broker using `MemphisConnection`.\n\n```java\nClientOptions opts = new ClientOptions.Builder()\n    .host(\"\u003cmemphis-host\u003e\")\n    .username(\"\u003capplication-username\u003e\")\n    .token(\"\u003cbroker-token\u003e\")\n    .port(\"\u003cport\u003e\")\t\t// defaults to 6666\n    .reconnect(true)\t// defaults to true\n    .maxReconnect(3)\t// defaults to 3\n    .reconnectInterval(1500)\t// defaults to 1500 ms\n    .timeOut(1500)\t\t// defaults to 1500 ms\n    .keyFile(\"\u003ckey-client.pem\u003e\")\t// key_file, for TLS connection\n    .certFile(\"\u003ccert-client.pem\u003e\")\t// cert_file, for TLS connection\n    .caFile(\"\u003crootCA.pem\u003e\")\t\t// ca_file, for TLS connection\n    .build();\n\nMemphisConnection memphisConnection = MemphisConnection(opts);\n```\n\nOnce connected, the entire functionalities offered by Memphis are available.\n\n### Disconnecting from Memphis\n\nTo disconnect from Memphis, call `close()` on the memphis object.\n\n```java\nmemphisConnection.close();\n```\n\n### Creating a Station\n\n_If a station already exists nothing happens, the new configuration will not be applied_\n\n```java\nStation station = memphisConnection.createStation(\n    \"\u003cstation-name\u003e\",\n    \"\u003cschema-name\u003e\",\n    Retention.MAX_MESSAGE_AGE_SECONDS, // MAX_MESSAGE_AGE_SECONDS/MESSAGES/BYTES. Defaults to MAX_MESSAGE_AGE_SECONDS\n    604800, // defaults to 604800\n    Storage.DISK, // Storage.DISK/Storage.MEMORY. Defaults to DISK\n    1, // defaults to 1\n    120000, // defaults to 2 minutes\n    true, // defaults to true\n    true, // defaults to true\n    false // defaults to false\n).get();\n```\n\n### Retention types\n\nMemphis currently supports the following types of retention:\n\n```java\nRetentionTypes.MAX_MESSAGE_AGE_SECONDS\n```\n\nMeans that every message persists for the value set in retention value field (in seconds)\n\n```java\nRetentionTypes.MESSAGES\n```\n\nMeans that after max amount of saved messages (set in retention value), the oldest messages will be deleted\n\n```java\nRetentionTypes.BYTES\n```\n\nMeans that after max amount of saved bytes (set in retention value), the oldest messages will be deleted\n\n\n### Retention Values\n\nThe `retention values` are directly related to the `retention types` mentioned above, where the values vary according to the type of retention chosen.\n\nAll retention values are of type `Integer` but with different representations as follows:\n\n`RetentionTypes.MAX_MESSAGE_AGE_SECONDS` is represented **in seconds**, `RetentionTypes.MESSAGES` in a **number of messages** and finally `RetentionTypes.BYTES` in a **number of bytes**.\n\nAfter these limits are reached oldest messages will be deleted.\n\n### Storage types\n\nMemphis currently supports the following types of messages storage:\n\n```java\nStorageTypes.DISK\n```\n\nMeans that messages persist on disk\n\n```java\nStorageTypes.MEMORY\n```\n\nMeans that messages persist on the main memory\n\n### Destroying a Station\n\nDestroying a station will remove all its resources (producers/consumers)\n\n```java\nstation.destroy().get()\n```\n\n### Attaching a Schema to an Existing Station\n\n```java\nmemphisConnection.attachSchema(\"\u003cschema-name\u003e\", \"\u003cstation-name\u003e\").get();\n```\n\n### Detaching a Schema from Station\n\n```java\nmemphisConnection.detachSchema(\"\u003cstation-name\u003e\").get();\n```\n\n\n### Produce and Consume messages\n\nThe most common client operations are `produce` to send messages and `consume` to\nreceive messages.\n\nMessages are published to a station and consumed from it by creating a consumer.\nConsumers are pull based and consume all the messages in a station unless you are using a consumers group, in this case messages are spread across all members in this group.\n\nMemphis messages are payload agnostic. Payloads are `byte[]`.\n\nIn order to stop getting messages, you have to call `consumer.destroy()`. Destroy will terminate regardless\nof whether there are messages in flight for the client.\n\n### Creating a Producer\n\n```java\nProducerOptions pOpts = new ProducerOptions.Builder()\n        .stationName(\"\u003cstation-name\u003e\")\n        .producerName(\"\u003cproducer-name\u003e\")\n        .build();\nMemphisProducer producer = memphisConnection.createProducer(pOpts);\n```\n\n### Producing a message and blocking until acknowledgment\n```java\nproducer.produce(byte[] message);\n```\n\n### Producing a message without blocking\nThis method will add the message to an internal queue and return.\nIf the queue is full, this method will block until the queue has been\ndrained some.\n```java\nproducer.produceNonblocking(byte[] message);\n```\n\n### Stopping a Producer\n\n```java\nproducer.stop();\n```\n\n### Creating an Asynchronous Consumer\nThe asynchronous consumer executes a provided function on each batch of messages received in a background thread.\n\n```java\nConsumerOptions opts = new ConsumerOptions.Builder()\n        .consumerName(\"test-runner\")\n        .stationName(\"example-station\")\n        .build();\n\nMemphisAsyncConsumer consumer = memphisConnection.createAsyncConsumer(\n        opts,\n        messages -\u003e {\n            for(MemphisMessage msg : messages) {\n                System.out.println(new String(msg.getData(), StandardCharsets.UTF_8));\n                msg.ack();\n            }\n        });\n        \n);\n```\n\n### Processing messages\n\n```java\nconsumer.start();\n```\n\n### Stopping the consumer\n\n```java\nconsumer.stop();\n```\n\n### Creating a Synchronous Consumer\nThe synchronous consumer checks for messages when its `fetch()` method is called.\nThe call blocks until messages are available or the wait timeout has been exceeded.\n\n```java \nConsumerOptions opts = new ConsumerOptions.Builder()\n        .consumerName(\"test-runner\")\n        .stationName(\"example-station\")\n        .build();\nMemphisSyncConsumer consumer = connection.createSyncConsumer(opts);\n```\n\n### Processing messages\n\n```java\nvar messages = consumer.fetch();\n\nfor(var msg : messages) {\n    msg.ack();\n}\n```\n\n### Check connection status\n\n```java\nmemphisConnection.isConnected();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperstreamlabs%2Fmemphis.java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperstreamlabs%2Fmemphis.java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperstreamlabs%2Fmemphis.java/lists"}