Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MINOR] Update java sdk docs #663

Merged
merged 1 commit into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions docs/cn/instructions/eventmesh-sdk-java-quickstart.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,60 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.eventmesh/eventmesh-sdk-java/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.eventmesh/eventmesh-sdk-java)

# 如何运行 eventmesh-sdk-java 演示

> Eventmesh-sdk-java作为客户端,与eventmesh-runtime通信,用于完成消息的发送和接收。
> EventMesh-sdk-java作为客户端,与eventmesh-runtime通信,用于完成消息的发送和接收。
>
> Eventmesh-sdk-java支持异步消息和广播消息。异步消息表示生产者只发送消息,不关心回复消息。广播消息表示生产者发送一次消息,所有订阅广播主题的消费者都将收到消息
> EventMesh-sdk-java支持异步消息和广播消息。异步消息表示生产者只发送消息,不关心回复消息。广播消息表示生产者发送一次消息,所有订阅广播主题的消费者都将收到消息
>
> Eventmesh-sdk-java支持HTTP和TCP协议。

TCP 和 Http 示例都在**eventmesh-test**模块下

**注意**:下载了源代码后,需要将`/conf/application.properties` 和 `/conf/log4j2.xml` 复制到 `resources` 目录下
> EventMesh-sdk-java支持HTTP和TCP协议。

![image-test-structure](../../images/eventmesh-test-structure.png)
TCP 和 HTTP 示例都在**eventmesh-example**模块下

### 1. TCP DEMO

<h4>异步消息</h4>

- 创建主题TEST-TOPIC-TCP-ASYNC,可以通过rocketmq-console或者rocketmq tools 命令
- 创建主题TEST-TOPIC-TCP-ASYNC可以通过rocketmq-console或者rocketmq tools 命令

- 启动消费者,订阅上一步骤已经创建的Topic

```
运行org.apache.eventmesh.tcp.demo.AsyncSubscribe的主要方法
运行org.apache.eventmesh.tcp.demo.sub.eventmeshmessage.AsyncSubscribe的主要方法
```

- 启动发送端,发送消息

```
运行org.apache.eventmesh.tcp.demo.AsyncPublish的主要方法
运行org.apache.eventmesh.tcp.demo.pub.eventmeshmessage.AsyncPublish的主要方法
```

<h4>广播消息</h4>

- 创建主题TEST-TOPIC-TCP-BROADCAST,可以通过rocketmq-console或者rocketmq tools 命令
- 创建主题TEST-TOPIC-TCP-BROADCAST可以通过rocketmq-console或者rocketmq tools 命令

- 启动消费端,订阅上一步骤已经创建的Topic

```
运行org.apache.eventmesh.tcp.demo.AsyncSubscribeBroadcast的主要方法
运行org.apache.eventmesh.tcp.demo.sub.eventmeshmessage.AsyncSubscribeBroadcast的主要方法
```

- 启动发送端,发送广播消息

```
运行org.apache.eventmesh.tcp.demo.AsyncPublishBroadcast的主要方法
运行org.apache.eventmesh.tcp.demo.pub.eventmeshmessage.AsyncPublishBroadcast的主要方法
```

### 2. HTTP演示

> 对于http,eventmesh-sdk-java对对于异步事件实现了发送与订阅
> 对于HTTP,eventmesh-sdk-java对对于异步事件实现了发送与订阅
>
>在演示中,Java类`LiteMessage`的`content`字段表示一个特殊的协议,因此,如果您要使用eventmesh-sdk-java的http-client,则只需设计协议的内容并在同一时间提供消费者的应用程序。

<h4>异步事件</h4>

> 生产者将事件发送给下游即可,无需等待响应

- 创建主题TEST-TOPIC-HTTP-ASYNC,可以通过rocketmq-console或者rocketmq tools 命令
- 创建主题TEST-TOPIC-HTTP-ASYNC可以通过rocketmq-console或者rocketmq tools 命令

- 启动消费端,订阅Topic

Expand All @@ -69,7 +67,7 @@ TCP 和 Http 示例都在**eventmesh-test**模块下
- 启动发送端,发送消息

```
运行org.apache.eventmesh.http.demo.AsyncPublishInstance的主要方法
运行org.apache.eventmesh.http.demo.pub.eventmeshmessage.AsyncPublishInstance的主要方法
```


Expand Down
48 changes: 22 additions & 26 deletions docs/en/instructions/eventmesh-sdk-java-quickstart.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,61 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.eventmesh/eventmesh-sdk-java/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.eventmesh/eventmesh-sdk-java)
# How to run eventmesh-sdk-java demo

> Eventmesh-sdk-java , as the client, communicated with eventmesh-runtime, used to complete the sending and receiving of message.
> EventMesh-sdk-java, as the client, communicated with eventmesh-runtime, used to complete the sending and receiving of message.
>
> Eventmesh-sdk-java supports async msg and broadcast msg. Async msg means the producer just sends msg and does not care reply msg.Broadcast msg means the producer send msg once and all the consumer subscribed the broadcast topic will receive the msg.
> Supports async msg and broadcast msg. Async msg means the producer just sends msg and does not care reply msg. Broadcast msg means the producer send msg once and all the consumer subscribed the broadcast topic will receive the msg.
>
> Eventmesh-sdk-java supports the protocol of HTTP and TCP.
> EventMesh-sdk-java supports the protocol of HTTP and TCP.

TCP demos and Http demos are both under the **eventmesh-test** module.

**prerequisite**:after download the source code you should copy `/conf/application.properties` and `/conf/log4j2.xml` to
the `resources` directory

![image-test-structure](../../images/eventmesh-test-structure.png)
TCP demos and HTTP demos are both under the **eventmesh-example** module.

### 1. TCP DEMO

#### Async msg

- create topic TEST-TOPIC-TCP-ASYNC on rocketmq-console

- start consumer ,subscribe topic in previous step.
- Create topic TEST-TOPIC-TCP-ASYNC on rocketmq-console
- Start consumer, subscribe topic in previous step.

```
Run the main method of org.apache.eventmesh.tcp.demo.AsyncSubscribe
Run the main method of org.apache.eventmesh.tcp.demo.sub.eventmeshmessage.AsyncSubscribe
```

- start producer, send message
- Start producer, send message

```
Run the main method of org.apache.eventmesh.tcp.demo.AsyncPublish
Run the main method of org.apache.eventmesh.tcp.demo.pub.eventmeshmessage.AsyncPublish
```

#### Broadcast msg

- create topic TEST-TOPIC-TCP-BROADCAST on rocketmq-console
- Create topic TEST-TOPIC-TCP-BROADCAST on rocketmq-console

- start consumer ,subscribe topic in previous step.
- Start consumer, subscribe topic in previous step.

```
Run the main method of org.apache.eventmesh.tcp.demo.AsyncSubscribeBroadcast
Run the main method of org.apache.eventmesh.tcp.demo.sub.eventmeshmessage.AsyncSubscribeBroadcast
```

* start producer, send broadcast message
* Start producer, send broadcast message

```
Run the main method of org.apache.eventmesh.tcp.demo.AsyncPublishBroadcast
Run the main method of org.apache.eventmesh.tcp.demo.pub.eventmeshmessage.AsyncPublishBroadcast
```

### 2. HTTP DEMO

> As to http, eventmesh-sdk-java implements the pub and sub for async event .
> As to HTTP, eventmesh-sdk-java implements the pub and sub for async event .
>
> In the demo ,the field of `content` of the java class `LiteMessage` represents a special protocal, so if you want to use http-client of eventmesh-sdk-java, you just need to design the content of protocal and supply the consumer appliacation at the same time.
> In the demo, the field of `content` of the java class `LiteMessage` represents a special protocal, so if you want to use http-client of eventmesh-sdk-java, you just need to design the content of protocal and supply the consumer application at the same time.

#### Async event

> producer send the event to consumer and don't need waiting response msg from consumer

- create topic TEST-TOPIC-HTTP-ASYNC on rocketmq-console
- Create topic TEST-TOPIC-HTTP-ASYNC on rocketmq-console

- start consumer, subscribe topic
- Start consumer, subscribe topic

Async consumer demo is a spring boot application demo, you can easily run this demo to start service and subscribe the
topic.
Expand All @@ -68,9 +64,9 @@ Run the main method of org.apache.eventmesh.tcp.demo.AsyncPublishBroadcast
Run the main method of org.apache.eventmesh.http.demo.sub.SpringBootDemoApplication
```

- start producer, produce msg
- Start producer, produce msg

```
Run the main method of org.apache.eventmesh.http.demo.AsyncPublishInstance
Run the main method of org.apache.eventmesh.http.demo.pub.eventmeshmessage.AsyncPublishInstance
```

Binary file removed docs/images/eventmesh-test-structure.png
Binary file not shown.