From 3e4f967a510d6bac2dda25113975411eeda7d434 Mon Sep 17 00:00:00 2001 From: Shikong <919411476@qq.com> Date: Sat, 30 Mar 2024 17:09:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/jpa-buddy.xml | 6 ++++++ .idea/misc.xml | 3 +++ .idea/modules.xml | 8 +++++++ .idea/vcs.xml | 2 +- .../src/main/resources/application.yml | 4 ++-- .../src/main/resources/application-test.yml | 4 ++-- .../src/main/resources/application.yml | 4 ++-- .../src/test/python/productor.py | 21 +++++++++++++++++++ .../src/test/python/python.iml | 9 ++++++++ 9 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 .idea/jpa-buddy.xml create mode 100644 .idea/modules.xml create mode 100644 kafka-01/kafka-01-producer/src/test/python/productor.py create mode 100644 kafka-01/kafka-01-producer/src/test/python/python.iml diff --git a/.idea/jpa-buddy.xml b/.idea/jpa-buddy.xml new file mode 100644 index 0000000..966d5f5 --- /dev/null +++ b/.idea/jpa-buddy.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index eea3247..9647ecc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,4 +12,7 @@ + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7f58fc6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/kafka-01/kafka-01-consumer/src/main/resources/application.yml b/kafka-01/kafka-01-consumer/src/main/resources/application.yml index d4ae8c3..2f6fc1b 100644 --- a/kafka-01/kafka-01-consumer/src/main/resources/application.yml +++ b/kafka-01/kafka-01-consumer/src/main/resources/application.yml @@ -1,8 +1,8 @@ spring: kafka: - bootstrap-servers: 10.10.10.200:9092 - #bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392 +# bootstrap-servers: 10.10.10.200:9092 + bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392 consumer: # 自动提交的时间间隔 在spring boot 2.X 版本是值的类型为Duration 需要符合特定的格式,如1S,1M,2H,5D diff --git a/kafka-01/kafka-01-producer/src/main/resources/application-test.yml b/kafka-01/kafka-01-producer/src/main/resources/application-test.yml index 0c3ab3a..45f6653 100644 --- a/kafka-01/kafka-01-producer/src/main/resources/application-test.yml +++ b/kafka-01/kafka-01-producer/src/main/resources/application-test.yml @@ -1,7 +1,7 @@ spring: kafka: - bootstrap-servers: 10.10.10.200:9092 -# bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392 +# bootstrap-servers: 10.10.10.200:9092 + bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392 producer: retries: 1 diff --git a/kafka-01/kafka-01-producer/src/main/resources/application.yml b/kafka-01/kafka-01-producer/src/main/resources/application.yml index 7dae101..3bf71c8 100644 --- a/kafka-01/kafka-01-producer/src/main/resources/application.yml +++ b/kafka-01/kafka-01-producer/src/main/resources/application.yml @@ -1,7 +1,7 @@ spring: kafka: - bootstrap-servers: 10.10.10.200:9092 -# bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392 +# bootstrap-servers: 10.10.10.200:9092 + bootstrap-servers: 10.10.10.200:9192,10.10.10.200:9292,10.10.10.200:9392 producer: retries: 1 diff --git a/kafka-01/kafka-01-producer/src/test/python/productor.py b/kafka-01/kafka-01-producer/src/test/python/productor.py new file mode 100644 index 0000000..4e3f1b1 --- /dev/null +++ b/kafka-01/kafka-01-producer/src/test/python/productor.py @@ -0,0 +1,21 @@ +import os +from concurrent.futures import ThreadPoolExecutor + +import requests + +server = "http://127.0.0.1:8081/api/v2/" + +workers = os.cpu_count() + +max_message = 100000 + + +def send(num: int): + print("发送第 %s 条消息" % num) + requests.get(server + str(num)) + + +if __name__ == '__main__': + with ThreadPoolExecutor(max_workers=workers) as worker: + for i in range(max_message): + worker.submit(send, i) diff --git a/kafka-01/kafka-01-producer/src/test/python/python.iml b/kafka-01/kafka-01-producer/src/test/python/python.iml new file mode 100644 index 0000000..9561fd8 --- /dev/null +++ b/kafka-01/kafka-01-producer/src/test/python/python.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file