You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/06/17 08:42:30 UTC
[incubator-eventmesh] branch master updated: [Docs] Add http request doc instruction (#922)
This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new d7b318e3 [Docs] Add http request doc instruction (#922)
d7b318e3 is described below
commit d7b318e3227a816959fe46794dcececdc6117e63
Author: mike_xwm <mi...@126.com>
AuthorDate: Fri Jun 17 16:42:25 2022 +0800
[Docs] Add http request doc instruction (#922)
* add http request doc instruction
* update http request doc instruction
* update http request doc instruction
---
docs/en/sdk-java/02-http.md | 21 +++++++++++++++++++++
docs/zh/sdk-java/02-http.md | 22 +++++++++++++++++++++-
2 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/docs/en/sdk-java/02-http.md b/docs/en/sdk-java/02-http.md
index eb71cb5f..bf2e5c6e 100644
--- a/docs/en/sdk-java/02-http.md
+++ b/docs/en/sdk-java/02-http.md
@@ -92,3 +92,24 @@ public class HTTP {
}
}
```
+
+## Using Curl Command
+
+You can also publish/subscribe event without eventmesh SDK.
+
+### Publish
+
+```shell
+curl -H "Content-Type:application/json" -X POST -d '{"name": "admin", "pass":"12345678"}' http://127.0.0.1:10105/eventmesh/publish/TEST-TOPIC-HTTP-ASYNC
+```
+
+After you start the eventmesh runtime server, you can use the curl command publish the event to the specific topic with the HTTP POST method and the package body must be in JSON format. The publish url like (http://127.0.0.1:10105/eventmesh/publish/TEST-TOPIC-HTTP-ASYNC), and you will get the publish successful result.
+
+### Subscribe
+
+```shell
+curl -H "Content-Type:application/json" -X POST -d '{"url": "http://127.0.0.1:8088/sub/test", "consumerGroup":"TEST-GROUP", "topic":[{"mode":"CLUSTERING","topic":"TEST-TOPIC-HTTP-ASYNC","type":"ASYNC"}]}' http://127.0.0.1:10105/eventmesh/subscribe/local
+```
+
+After you start the eventmesh runtime server, you can use the curl command to subscribe the specific topic list with the HTTP POST method, and the package body must be in JSON format. The subscribe url like (http://127.0.0.1:10105/eventmesh/subscribe/local), and you will get the subscribe successful result. You should pay attention to the `url` field in the package body, which means you need to set up an HTTP service at the specified URL, you can see the example in the `eventmesh-example [...]
+
diff --git a/docs/zh/sdk-java/02-http.md b/docs/zh/sdk-java/02-http.md
index 32182fea..45a6698d 100644
--- a/docs/zh/sdk-java/02-http.md
+++ b/docs/zh/sdk-java/02-http.md
@@ -91,4 +91,24 @@ public class HTTP {
eventMeshHttpProducer.publish(event);
}
}
-```
\ No newline at end of file
+```
+
+## 使用Curl 命令
+
+也可以不通过Event Mesh SDK来体验事件的收发功能
+
+### 事件发送
+
+```shell
+curl -H "Content-Type:application/json" -X POST -d '{"name": "admin", "pass":"12345678"}' http://127.0.0.1:10105/eventmesh/publish/TEST-TOPIC-HTTP-ASYNC
+```
+
+启动eventmesh运行时服务后,可以使用curl命令将事件用HTTP post方法发布到指定的主题,并且Body必须是JSON格式。发布事件的url类似于(http://127.0.0.1:10105/eventmesh/publish/TEST-TOPIC-HTTP-ASYNC),您将获得成功发布的结果。
+
+### 事件订阅
+
+```shell
+curl -H "Content-Type:application/json" -X POST -d '{"url": "http://127.0.0.1:8088/sub/test", "consumerGroup":"TEST-GROUP", "topic":[{"mode":"CLUSTERING","topic":"TEST-TOPIC-HTTP-ASYNC","type":"ASYNC"}]}' http://127.0.0.1:10105/eventmesh/subscribe/local
+```
+
+启动eventmesh运行时服务器后,可以使用curl命令用HTTP post方法订阅指定的主题列表,并且Body必须是JSON格式。订阅url类似于(http://127.0.0.1:10105/eventmesh/subscribe/local),您将获得订阅成功的结果。你应该注意Body中的`url`字段,这意味着你需要在指定的url上启动HTTP服务实现监听,你可以在`eventmesh-examples`模块中看到这个例子。
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org