完善:zhub快速上手页面

This commit is contained in:
2023-11-28 20:24:54 +08:00
parent 5fbc3082c7
commit 4c55967ce2
30 changed files with 245 additions and 11771 deletions

7
back/oth/_category_.json Normal file
View File

@@ -0,0 +1,7 @@
{
"label": "其他常用",
"position": 5,
"link": {
"type": "generated-index"
}
}

18
back/oth/a.md Normal file
View File

@@ -0,0 +1,18 @@
---
sidebar_position: 1
---
# 一些命令
```shell title='在 Windows 环境下,项目打包成 zip 文件:'
# rem 请将“my-site”替换为您想要命名的 zip 文件名称,这将创建一个名为 "my-site.zip" 的 zip 文件。
powershell Compress-Archive -Path build -DestinationPath my-site.zip
```
```shell title='docusaurus 常用命令'
pnpm run build # 构建
pnpm run start # 启动
pnpm run serve # 启动(服务模式)
```

View File

@@ -0,0 +1,7 @@
{
"label": "Redkale",
"position": 4,
"link": {
"type": "generated-index"
}
}

View File

@@ -0,0 +1,5 @@
---
sidebar_position: 3
---
# 进阶功能

View File

@@ -0,0 +1,7 @@
{
"label": "进阶功能",
"position": 3,
"link": {
"type": "generated-index"
}
}

View File

@@ -0,0 +1,6 @@
---
sidebar_position: 2
---
# 核心功能

View File

@@ -0,0 +1,7 @@
{
"label": "核心功能",
"position": 2,
"link": {
"type": "generated-index"
}
}

View File

@@ -0,0 +1,77 @@
---
sidebar_position: 1
---
# 快速开始
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs>
<TabItem value="apple" label="Apple" default>
This is an apple 🍎
</TabItem>
<TabItem value="orange" label="Orange">
This is an orange 🍊
</TabItem>
<TabItem value="banana" label="Banana">
This is a banana 🍌
</TabItem>
</Tabs>
好的,以下是对应的文件名和目录结构:
- 1.md : 入门指南
- 1.1 安装和配置.md
- 1.2 Hello World.md
- 1.3 架构概述.md
- 2.md : 核心功能
- 2.1 控制器.md
- 2.2 过滤器.md
- 2.3 模板引擎.md
- 2.4 数据库访问.md
- 2.5 缓存.md
- 2.6 安全.md
- 2.7 日志.md
- 2.8 监控.md
- 3.md : 进阶功能
- 3.1 异步处理.md
- 3.2 高并发支持.md
- 3.3 集群部署.md
- 3.4 扩展机制.md
- 4.md : 工具支持
- 4.1 IDEA 插件.md
- 4.2 Maven 插件.md
- 4.3 工具集成.md
----
好的,以下是使用英文文件名的 Redkale 文档目录结构:
- getting-started: Getting Started
- 1-installation-and-configuration.md: Installation and Configuration
- 2-hello-world.md: Hello World
- 3-architecture-overview.md: Architecture Overview
- core-features: Core Features
- 1-controller.md: Controller
- 2-filter.md: Filter
- 3-template-engine.md: Template Engine
- 4-database-access.md: Database Access
- 5-cache.md: Cache
- 6-security.md: Security
- 7-logging.md: Logging
- 8-monitoring.md: Monitoring
- advanced-features.md: Advanced Features
- 1-asynchronous-processing.md: Asynchronous Processing
- 2-high-concurrency-support.md: High Concurrency Support
- 3-clustering-deployment.md: Clustering Deployment
- 4-extension-mechanism.md: Extension Mechanism
- tool-support.md: Tool Support
- 1-idea-plugin.md: IDEA Plugin
- 2-maven-plugin.md: Maven Plugin
- 3-tool-integration.md: Tool Integration
请注意,文件名以及目录结构只是一种规范,您可以根据实际需求进行修改和扩展。同时编写文档时要尽可能地清晰简洁、易于阅读和理解,并且遵循文档写作的标准规范和最佳实践。
请注意,本程序只能进行文档基础目录结构的整理,具体内容需要您自己针对 Redkale 进行整理编写。另外,如有需要,您还可以进一步细分和拓展目录结构,以适应实际需求。

View File

@@ -0,0 +1,7 @@
{
"label": "快速开始",
"position": 1,
"link": {
"type": "generated-index"
}
}

View File

@@ -0,0 +1,5 @@
---
sidebar_position: 3
---
# 架构概述

View File

@@ -0,0 +1,5 @@
---
sidebar_position: 2
---
# 第一个程序

View File

@@ -0,0 +1,5 @@
---
sidebar_position: 1
---
# 安装配置

View File

@@ -0,0 +1,5 @@
---
sidebar_position: 4
---
# 工具支持

View File

@@ -0,0 +1,7 @@
{
"label": "工具支持",
"position": 4,
"link": {
"type": "generated-index"
}
}

View File

@@ -0,0 +1,8 @@
{
"label": "基础使用",
"position": 2,
"link": {
"type": "generated-index",
"description": "完成 ZHub 服务安装后,来看看一遍就会的基础使用文档~"
}
}

View File

@@ -0,0 +1,32 @@
---
sidebar_position: 3
title: 广播消息
description: 发送、接收广播消息
---
:::tip
消息接收
广播消息的消息接收,与主题消息、延时消息 api一致且使用了相同 topic 命名空间
- 消息接收
- 广播消息发送
:::
## 消息接收
> [广播消息接收](publish-subscribe.md#订阅主题消息)
## 广播消息发送
> 和发布订阅消息基本差不多
```java
private ZHubClient zhub;
@RestMapping(name = "publish_test", auth = false, comment = "发送广播消息测试")
public String publishTest(String value) {
zhub.broadcast("topic-a", value);
return "send ok!";
}
```

View File

@@ -0,0 +1,60 @@
---
sidebar_position: 0
title: 创建连接
description: 初始化客户端连接对象
---
:::tip
目前已提供三种客户端连接使用
- Java 项目
- [普通 Java 项目](#java通用)
- [使用 Redkale 的 Java 项目](#redkale框架-项目里面使用)
- [Golang 项目](#golang-项目中使用)
:::
---
## Java通用
> 在Java 项目中引入 zhub-client.jar
```java
private ZHubClient zhub;
@Before
public void init() {
// 参数说明:① ip:端⼝, ②消费者组名称, ③项⽬实例名(名称需全局唯⼀)④授权码
zhub = new ZHubClient("127.0.0.1:6066", "test-hub", "DEV-LOCAL", "user@pwd123");
}
```
---
## Redkale框架 项目里面使用
> 在Java的redkale 项目中引入 zhub-rekale.jar
> 在配置文件中配置zhub组件
```
# source.properties 中配置
############ ClusterSource @Resource(name="hub") ############
redkale.cluster.zhub[hub].addr = 127.0.0.1:6066
redkale.cluster.zhub[hub].auth = user@pwd123
redkale.cluster.zhub[hub].groupid = test-hub
```
> 在 service 中注入组件
>
```java
@Resource(name = "hub")
protected ZHubClient zhub;
```
## Golang 项目中使用
> 待补充
---

View File

@@ -0,0 +1,35 @@
---
sidebar_position: 2
title: 延时消息
description: zhub 的延时消息使用
---
:::tip
首先完成 **[连接创建](create-connection.md)** ,便可进行**延时消息**的发送和接收,
- [订阅主题消息](#订阅主题消息)
- [发送延时消息](#发送延时消息)
:::
## 订阅主题消息
> 见 [主题的订阅](publish-subscribe.md#订阅主题消息)
## 发送延时消息
> 参数说明:①主题名称 ②消息内容 ③延时多久单位ms
> zhub.delay("topic-delay-a", "delay-value", 1000);
>
示例代码:
```java
private ZHubClient zhub;
@RestMapping(name = "delay_test", auth = false, comment = "发送延时主题消息测试")
public String delayTest(String value) {
zhub.delay("topic-delay-a", "delay-value", 1000);
return "send ok!";
}
```

View File

@@ -0,0 +1,41 @@
---
sidebar_position: 1
title: 订阅&发布
description: zhub 创建客户端连接、订阅主题、发送主题消息
---
:::tip
发布-订阅Publish-Subscribe消息中间件可以用于实现发布-订阅模式。发布者将消息发布到一个或多个主题Topic而订阅者订阅感兴趣的主题。当有新的消息发布到主题时所有订阅了该主题的订阅者都会接收到消息。这样可以实现一对多的消息传递降低发送方和接收方之间的耦合性。
首先完成 **[连接创建](create-connection.md)** ,便可进行消息的发送和接收,
- [订阅主题消息](#订阅主题消息)
- [发送主题消息](#发送主题消息)
:::
## 订阅主题消息
```java
// 事件订阅
zhub.subscribe("topic-a", x -> {
System.out.println("接收到主题 topic-a 事件,消息内容:" + x);
});
```
## 发送主题消息
测试发送主题消息
```java
private ZHubClient zhub;
@RestMapping(name = "publish_test", auth = false, comment = "发送主题消息测试")
public String publishTest(String value) {
zhub.publish("topic-a", value);
return "send ok!";
}
```
这个时候,将会在订阅端收到主题订阅消息,并在控制台输出: `接收到主题 topic-a 事件消息内容xx` 的消息内容

View File

@@ -0,0 +1,7 @@
{
"label": "其他组件",
"position": 3,
"link": {
"type": "generated-index"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -0,0 +1,5 @@
---
sidebar_position: 2
---
# 分布式锁

View File

@@ -0,0 +1,7 @@
---
sidebar_position: 1
---
# RPC远程调用
#

View File

@@ -0,0 +1,5 @@
---
sidebar_position: 2
---
# 定时调度