{"id":20231011,"url":"https://github.com/bewaremypower/kafkaclientdemo","last_synced_at":"2025-03-03T13:42:53.635Z","repository":{"id":109020290,"uuid":"293785866","full_name":"BewareMyPower/KafkaClientDemo","owner":"BewareMyPower","description":"Kafka client demos","archived":false,"fork":false,"pushed_at":"2020-09-23T15:53:51.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T00:22:38.461Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BewareMyPower.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-08T11:10:48.000Z","updated_at":"2020-09-23T15:53:53.000Z","dependencies_parsed_at":"2023-08-26T16:15:19.999Z","dependency_job_id":null,"html_url":"https://github.com/BewareMyPower/KafkaClientDemo","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/BewareMyPower%2FKafkaClientDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2FKafkaClientDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2FKafkaClientDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2FKafkaClientDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BewareMyPower","download_url":"https://codeload.github.com/BewareMyPower/KafkaClientDemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241677354,"owners_count":20001673,"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-11-14T07:44:51.251Z","updated_at":"2025-03-03T13:42:53.595Z","avatar_url":"https://github.com/BewareMyPower.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## KafkaClientDemo\n\nKafka client demos.\n\n## Usage\n\nBuild the jar with dependencies and run:\n\n```bash\n$ mvn clean package\n$ java -jar target/KafkaClientDemo-1.0-SNAPSHOT-jar-with-dependencies.jar\n```\n\nThe program will start a background consumer that consumes and print messages and a console producer that accepts input from standard input and send each line as a message.\n\ne.g. send `hello` and `world`:\n\n```\nhello\nSend line: hello\n2020-09-08 19:19:31:554 [kafka-producer-network-thread | producer-1] INFO org.apache.kafka.clients.Metadata - Cluster ID: ZtF869vnQHiChoclRBaBOw\n[0] ConsumerRecord(topic = test_xyz, partition = 2, offset = 2, CreateTime = 1599563971562, serialized key size = -1, serialized value size = 5, headers = RecordHeaders(headers = [], isReadOnly = false), key = null, value = hello)\nworld\nSend line: world\n[1] ConsumerRecord(topic = test_xyz, partition = 1, offset = 2, CreateTime = 1599563972996, serialized key size = -1, serialized value size = 5, headers = RecordHeaders(headers = [], isReadOnly = false), key = null, value = world)\n```\n\nIf you want to change the properties files and rerun, use Maven to execute the class instead of run the `*.jar`:\n\n```bash\n# Make sure that you have build the classes into target/classes/ before, use `mvn compile`\n$ mvn exec:java -Dexec.mainClass=io.github.bewaremypower.Starter\n```\n\n## Config\n\nHere're three properties files in [resources](src/main/resources/) directory.\n\nIn `kafka.properties` you can configure the topic name.\n\nThe `producer.properties` and `consumer.properties` are the properties to construct [`KafkaProducer`](https://kafka.apache.org/20/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html) and [`KafkaConsumer`](https://kafka.apache.org/20/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html).\n\nIn addition, the `consumer.properties` has extra properties:\n\n| Key                | Value                                                        |\n| ------------------ | ------------------------------------------------------------ |\n| `poll.timeout.ms`  | The poll timeout in milliseconds each time the consumer call `poll` |\n| `max.num.messages` | The maximum number of messages that the consumer could receive |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbewaremypower%2Fkafkaclientdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbewaremypower%2Fkafkaclientdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbewaremypower%2Fkafkaclientdemo/lists"}