diff --git a/blog/2019-05-28-first-blog-post.md b/blog/2019-05-28-first-blog-post.md deleted file mode 100644 index 02f3f81..0000000 --- a/blog/2019-05-28-first-blog-post.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -slug: first-blog-post -title: First Blog Post -authors: - name: Gao Wei - title: Docusaurus Core Team - url: https://github.com/wgao19 - image_url: https://github.com/wgao19.png -tags: [hola, docusaurus] ---- - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet diff --git a/blog/2019-05-29-long-blog-post.md b/blog/2019-05-29-long-blog-post.md deleted file mode 100644 index 26ffb1b..0000000 --- a/blog/2019-05-29-long-blog-post.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -slug: long-blog-post -title: Long Blog Post -authors: endi -tags: [hello, docusaurus] ---- - -This is the summary of a very long blog post, - -Use a `` comment to limit blog post size in the list view. - - - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet diff --git a/blog/2021-08-01-mdx-blog-post.mdx b/blog/2021-08-01-mdx-blog-post.mdx deleted file mode 100644 index c04ebe3..0000000 --- a/blog/2021-08-01-mdx-blog-post.mdx +++ /dev/null @@ -1,20 +0,0 @@ ---- -slug: mdx-blog-post -title: MDX Blog Post -authors: [slorber] -tags: [docusaurus] ---- - -Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/markdown-features), such as [MDX](https://mdxjs.com/). - -:::tip - -Use the power of React to create interactive blog posts. - -```js - -``` - - - -::: diff --git a/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg b/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg deleted file mode 100644 index 11bda09..0000000 Binary files a/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg and /dev/null differ diff --git a/blog/2021-08-26-welcome/index.md b/blog/2021-08-26-welcome/index.md deleted file mode 100644 index 9455168..0000000 --- a/blog/2021-08-26-welcome/index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -slug: welcome -title: Welcome -authors: [slorber, yangshun] -tags: [facebook, hello, docusaurus] ---- - -[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog). - -Simply add Markdown files (or folders) to the `blog` directory. - -Regular blog authors can be added to `authors.yml`. - -The blog post date can be extracted from filenames, such as: - -- `2019-05-30-welcome.md` -- `2019-05-30-welcome/index.md` - -A blog post folder can be convenient to co-locate blog post images: - -![Docusaurus Plushie](./docusaurus-plushie-banner.jpeg) - -The blog supports tags as well! - -**And if you don't want a blog**: just delete this directory, and use `blog: false` in your Docusaurus config. diff --git a/blog/authors.yml b/blog/authors.yml index bcb2991..51cd6a8 100644 --- a/blog/authors.yml +++ b/blog/authors.yml @@ -15,3 +15,9 @@ slorber: title: Docusaurus maintainer url: https://sebastienlorber.com image_url: https://github.com/slorber.png + +lxy: + name: 绝尘 + title: 软件工程师 + url: https://gitee.com/tc608 + image_url: https://img.1216.top/art/u93.png diff --git a/blog/system-keep-live.md b/blog/system-keep-live.md new file mode 100644 index 0000000..0fbf04f --- /dev/null +++ b/blog/system-keep-live.md @@ -0,0 +1,51 @@ +--- +slug: using-systemd-to-keep-a-program-running +title: "使用 Systemd 保持 Linux 系统中的程序长时间保活" +authors: lxy +tags: [ Linux, Systemd ] +--- + +假设我们有一个可执行程序 `app.sh`(类比 Windows 下的 `app.exe`),我们想用 systemd 进行管理,并保证其在任何情况下都能够保活。下面是具体步骤: + +1. 编写 systemd 服务管理配置文件 `/opt/app/app.service`。 + 在 `[Unit]` 段落中编写一个描述性语句,让人们了解你正在管理什么。在 `[Service]` 段落中定义服务的各个参数: + + - `Type=forking` 表示当该服务启动时,systemd 假定它会再派生出一个子进程(即父子进程)。这是最常见的 service 类型。 + - `ExecStart=` 定义将要启动的可执行程序路径。 + - `ExecReload=` 定义重新加载服务时要运行的命令或脚本。 + - `Restart=` 当服务失败时自动重启,`always` 是指总是重启,其他选项为 `on-failure` 和 `never`。 + - `WantedBy=multi-user.target` 将这个服务加入启动所需的目标之一。在多用户系统中,`multi-user.target` + 是把计算机带到用户登录界面的主要目标。 + + 示例配置如下: + ```shell + [Unit] + Description=app daemon + + [Service] + Type=forking + ExecStart=/opt/app/app.sh + ExecReload=/opt/app/app.sh + Restart=always + + [Install] + WantedBy=multi-user.target + ``` + +2. 将服务管理配置文件做软链接到 `/usr/lib/systemd/system/` 目录下。 + 通过软链接可以方便地维护服务管理配置文件。示例命令如下: + ```shell + ln -s /opt/app/app.service /usr/lib/systemd/system/app.service + ``` + +3. 将 `app.service` 加入系统开机自启动。 + ```shell + systemctl enable app.service + ``` + +4. 启动程序。 + ```shell + systemctl start app + ``` + +到此为止,原本的可执行程序 `app.sh` 就已经被 systemd 管理,并保证其在任何情况下都能够保活。 \ No newline at end of file diff --git a/docs/intro.md b/docs/intro.md index 8a2e69d..e92f5b5 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -2,46 +2,69 @@ sidebar_position: 1 --- -# Tutorial Intro +# 快速开始 -Let's discover **Docusaurus in less than 5 minutes**. +让我们在 **5分钟内完成 zhub 组件安装**. -## Getting Started +## 开始 -Get started by **creating a new site**. +从零开始 **搭建 zhub 服务**. -Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**. +### 下载软件包 -### What you'll need - -- [Node.js](https://nodejs.org/en/download/) version 16.14 or above: - - When installing Node.js, you are recommended to check all checkboxes related to dependencies. - -## Generate a new site - -Generate a new Docusaurus site using the **classic template**. - -The classic template will automatically be added to your project after you run the command: +- [zhub.zip](https://baidu.com) 包含以下内容: + - 绿色版本 Window 和 Linux 运行包 + - 配置文件: app.ini + - java连接驱动:zhub-clien.jar +![zhub-zip.png](https://img.1216.top/docs/zhub-zip.png) +### 配置 app.ini ```bash -npm init docusaurus@latest my-website classic +# app.ini +[log] +handlers=console # console|file +level=debug # info|debug|error +file=zhub.log + +[service] +watch=0.0.0.0:711 +addr=0.0.0.0:1216 +auth=1 # 是否开启连接授权 + +[data] +dir=D:/data # 数据目录 + +[ztimer] # timer 使用的数据库配置 +db.addr=47.111.150.118:6063 +db.user=root +db.password=*Zhong@0510! +db.database=zhub + +[auth] +admin=123456 # 授权连接账号 admin@123456 +lxy=123456 ``` -You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor. - -The command also installs all necessary dependencies you need to run Docusaurus. - -## Start your site - -Run the development server: +### 启动服务 ```bash -cd my-website -npm run start +# window +./zhub.exe +# linux +./zhub.sh ``` -The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there. +## 使用 + +### Java 客户端连接 + +```java + ZhubClient zhub = new ZhubClient("", ""); + zhub.subscribe("topic-x", x -> { + // do something. + }); +``` + +### Java 客户端连接 -The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/. -Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes. diff --git a/docs/oth/_category_.json b/docs/oth/_category_.json new file mode 100644 index 0000000..3211d2a --- /dev/null +++ b/docs/oth/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "其他常用", + "position": 5, + "link": { + "type": "generated-index" + } +} diff --git a/docs/oth/a.md b/docs/oth/a.md new file mode 100644 index 0000000..7cb7edb --- /dev/null +++ b/docs/oth/a.md @@ -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 # 启动(服务模式) + +``` diff --git a/docs/redkale/_category_.json b/docs/redkale/_category_.json new file mode 100644 index 0000000..0063661 --- /dev/null +++ b/docs/redkale/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Redkale", + "position": 4, + "link": { + "type": "generated-index" + } +} diff --git a/docs/redkale/advanced-features.md b/docs/redkale/advanced-features.md new file mode 100644 index 0000000..3799b5a --- /dev/null +++ b/docs/redkale/advanced-features.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 3 +--- + +# 进阶功能 \ No newline at end of file diff --git a/docs/redkale/advanced-features/_category_.json b/docs/redkale/advanced-features/_category_.json new file mode 100644 index 0000000..6847e01 --- /dev/null +++ b/docs/redkale/advanced-features/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "进阶功能", + "position": 3, + "link": { + "type": "generated-index" + } +} diff --git a/docs/redkale/core-features.md b/docs/redkale/core-features.md new file mode 100644 index 0000000..6179d97 --- /dev/null +++ b/docs/redkale/core-features.md @@ -0,0 +1,6 @@ +--- +sidebar_position: 2 +--- + +# 核心功能 + diff --git a/docs/redkale/core-features/_category_.json b/docs/redkale/core-features/_category_.json new file mode 100644 index 0000000..0bf0b83 --- /dev/null +++ b/docs/redkale/core-features/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "核心功能", + "position": 2, + "link": { + "type": "generated-index" + } +} diff --git a/docs/redkale/getting-started.md b/docs/redkale/getting-started.md new file mode 100644 index 0000000..2ee07ee --- /dev/null +++ b/docs/redkale/getting-started.md @@ -0,0 +1,77 @@ +--- +sidebar_position: 1 +--- + +# 快速开始 + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + + This is an apple 🍎 + + + This is an orange 🍊 + + + This is a banana 🍌 + + + +好的,以下是对应的文件名和目录结构: + +- 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 进行整理编写。另外,如有需要,您还可以进一步细分和拓展目录结构,以适应实际需求。 \ No newline at end of file diff --git a/docs/redkale/getting-started/_category_.json b/docs/redkale/getting-started/_category_.json new file mode 100644 index 0000000..3538283 --- /dev/null +++ b/docs/redkale/getting-started/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "快速开始", + "position": 1, + "link": { + "type": "generated-index" + } +} diff --git a/docs/redkale/getting-started/architecture-overview.md b/docs/redkale/getting-started/architecture-overview.md new file mode 100644 index 0000000..4789776 --- /dev/null +++ b/docs/redkale/getting-started/architecture-overview.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 3 +--- + +# 架构概述 \ No newline at end of file diff --git a/docs/redkale/getting-started/hello-world.md b/docs/redkale/getting-started/hello-world.md new file mode 100644 index 0000000..7952f8e --- /dev/null +++ b/docs/redkale/getting-started/hello-world.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 2 +--- + +# 第一个程序 \ No newline at end of file diff --git a/docs/redkale/getting-started/installation-and-configuration.md b/docs/redkale/getting-started/installation-and-configuration.md new file mode 100644 index 0000000..c3911d6 --- /dev/null +++ b/docs/redkale/getting-started/installation-and-configuration.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 1 +--- + +# 安装配置 \ No newline at end of file diff --git a/docs/redkale/tool-support.md b/docs/redkale/tool-support.md new file mode 100644 index 0000000..74562c7 --- /dev/null +++ b/docs/redkale/tool-support.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 4 +--- + +# 工具支持 diff --git a/docs/redkale/tool-support/_category_.json b/docs/redkale/tool-support/_category_.json new file mode 100644 index 0000000..a702648 --- /dev/null +++ b/docs/redkale/tool-support/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "工具支持", + "position": 4, + "link": { + "type": "generated-index" + } +} diff --git a/docs/tutorial-basics/_category_.json b/docs/tutorial-basics/_category_.json index 2e6db55..02b463e 100644 --- a/docs/tutorial-basics/_category_.json +++ b/docs/tutorial-basics/_category_.json @@ -1,8 +1,8 @@ { - "label": "Tutorial - Basics", + "label": "基础使用", "position": 2, "link": { "type": "generated-index", - "description": "5 minutes to learn the most important Docusaurus concepts." + "description": "完成 ZHub 服务安装后,来看看一遍就会的基础使用文档~" } } diff --git a/docs/tutorial-basics/broadcast.md b/docs/tutorial-basics/broadcast.md new file mode 100644 index 0000000..0ced911 --- /dev/null +++ b/docs/tutorial-basics/broadcast.md @@ -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!"; + } +``` \ No newline at end of file diff --git a/docs/tutorial-basics/congratulations.md b/docs/tutorial-basics/congratulations.md deleted file mode 100644 index 04771a0..0000000 --- a/docs/tutorial-basics/congratulations.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -sidebar_position: 6 ---- - -# Congratulations! - -You have just learned the **basics of Docusaurus** and made some changes to the **initial template**. - -Docusaurus has **much more to offer**! - -Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.md)** and **[i18n](../tutorial-extras/translate-your-site.md)**. - -Anything **unclear** or **buggy** in this tutorial? [Please report it!](https://github.com/facebook/docusaurus/discussions/4610) - -## What's next? - -- Read the [official documentation](https://docusaurus.io/) -- Modify your site configuration with [`docusaurus.config.js`](https://docusaurus.io/docs/api/docusaurus-config) -- Add navbar and footer items with [`themeConfig`](https://docusaurus.io/docs/api/themes/configuration) -- Add a custom [Design and Layout](https://docusaurus.io/docs/styling-layout) -- Add a [search bar](https://docusaurus.io/docs/search) -- Find inspirations in the [Docusaurus showcase](https://docusaurus.io/showcase) -- Get involved in the [Docusaurus Community](https://docusaurus.io/community/support) diff --git a/docs/tutorial-basics/create-a-blog-post.md b/docs/tutorial-basics/create-a-blog-post.md deleted file mode 100644 index ea472bb..0000000 --- a/docs/tutorial-basics/create-a-blog-post.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -sidebar_position: 3 ---- - -# Create a Blog Post - -Docusaurus creates a **page for each blog post**, but also a **blog index page**, a **tag system**, an **RSS** feed... - -## Create your first Post - -Create a file at `blog/2021-02-28-greetings.md`: - -```md title="blog/2021-02-28-greetings.md" ---- -slug: greetings -title: Greetings! -authors: - - name: Joel Marcey - title: Co-creator of Docusaurus 1 - url: https://github.com/JoelMarcey - image_url: https://github.com/JoelMarcey.png - - name: Sébastien Lorber - title: Docusaurus maintainer - url: https://sebastienlorber.com - image_url: https://github.com/slorber.png -tags: [greetings] ---- - -Congratulations, you have made your first post! - -Feel free to play around and edit this post as much you like. -``` - -A new blog post is now available at [http://localhost:3000/blog/greetings](http://localhost:3000/blog/greetings). diff --git a/docs/tutorial-basics/create-a-document.md b/docs/tutorial-basics/create-a-document.md deleted file mode 100644 index ffddfa8..0000000 --- a/docs/tutorial-basics/create-a-document.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Create a Document - -Documents are **groups of pages** connected through: - -- a **sidebar** -- **previous/next navigation** -- **versioning** - -## Create your first Doc - -Create a Markdown file at `docs/hello.md`: - -```md title="docs/hello.md" -# Hello - -This is my **first Docusaurus document**! -``` - -A new document is now available at [http://localhost:3000/docs/hello](http://localhost:3000/docs/hello). - -## Configure the Sidebar - -Docusaurus automatically **creates a sidebar** from the `docs` folder. - -Add metadata to customize the sidebar label and position: - -```md title="docs/hello.md" {1-4} ---- -sidebar_label: 'Hi!' -sidebar_position: 3 ---- - -# Hello - -This is my **first Docusaurus document**! -``` - -It is also possible to create your sidebar explicitly in `sidebars.js`: - -```js title="sidebars.js" -module.exports = { - tutorialSidebar: [ - 'intro', - // highlight-next-line - 'hello', - { - type: 'category', - label: 'Tutorial', - items: ['tutorial-basics/create-a-document'], - }, - ], -}; -``` diff --git a/docs/tutorial-basics/create-a-page.md b/docs/tutorial-basics/create-a-page.md deleted file mode 100644 index 20e2ac3..0000000 --- a/docs/tutorial-basics/create-a-page.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Create a Page - -Add **Markdown or React** files to `src/pages` to create a **standalone page**: - -- `src/pages/index.js` → `localhost:3000/` -- `src/pages/foo.md` → `localhost:3000/foo` -- `src/pages/foo/bar.js` → `localhost:3000/foo/bar` - -## Create your first React Page - -Create a file at `src/pages/my-react-page.js`: - -```jsx title="src/pages/my-react-page.js" -import React from 'react'; -import Layout from '@theme/Layout'; - -export default function MyReactPage() { - return ( - -

My React page

-

This is a React page

-
- ); -} -``` - -A new page is now available at [http://localhost:3000/my-react-page](http://localhost:3000/my-react-page). - -## Create your first Markdown Page - -Create a file at `src/pages/my-markdown-page.md`: - -```mdx title="src/pages/my-markdown-page.md" -# My Markdown page - -This is a Markdown page -``` - -A new page is now available at [http://localhost:3000/my-markdown-page](http://localhost:3000/my-markdown-page). diff --git a/docs/tutorial-basics/create-connection.md b/docs/tutorial-basics/create-connection.md new file mode 100644 index 0000000..7d10403 --- /dev/null +++ b/docs/tutorial-basics/create-connection.md @@ -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 项目中使用 + +> 待补充 + +--- diff --git a/docs/tutorial-basics/delay.md b/docs/tutorial-basics/delay.md new file mode 100644 index 0000000..0ecb918 --- /dev/null +++ b/docs/tutorial-basics/delay.md @@ -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!"; + } +``` \ No newline at end of file diff --git a/docs/tutorial-basics/deploy-your-site.md b/docs/tutorial-basics/deploy-your-site.md deleted file mode 100644 index 1c50ee0..0000000 --- a/docs/tutorial-basics/deploy-your-site.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -sidebar_position: 5 ---- - -# Deploy your site - -Docusaurus is a **static-site-generator** (also called **[Jamstack](https://jamstack.org/)**). - -It builds your site as simple **static HTML, JavaScript and CSS files**. - -## Build your site - -Build your site **for production**: - -```bash -npm run build -``` - -The static files are generated in the `build` folder. - -## Deploy your site - -Test your production build locally: - -```bash -npm run serve -``` - -The `build` folder is now served at [http://localhost:3000/](http://localhost:3000/). - -You can now deploy the `build` folder **almost anywhere** easily, **for free** or very small cost (read the **[Deployment Guide](https://docusaurus.io/docs/deployment)**). diff --git a/docs/tutorial-basics/markdown-features.mdx b/docs/tutorial-basics/markdown-features.mdx deleted file mode 100644 index 0337f34..0000000 --- a/docs/tutorial-basics/markdown-features.mdx +++ /dev/null @@ -1,150 +0,0 @@ ---- -sidebar_position: 4 ---- - -# Markdown Features - -Docusaurus supports **[Markdown](https://daringfireball.net/projects/markdown/syntax)** and a few **additional features**. - -## Front Matter - -Markdown documents have metadata at the top called [Front Matter](https://jekyllrb.com/docs/front-matter/): - -```text title="my-doc.md" -// highlight-start ---- -id: my-doc-id -title: My document title -description: My document description -slug: /my-custom-url ---- -// highlight-end - -## Markdown heading - -Markdown text with [links](./hello.md) -``` - -## Links - -Regular Markdown links are supported, using url paths or relative file paths. - -```md -Let's see how to [Create a page](/create-a-page). -``` - -```md -Let's see how to [Create a page](./create-a-page.md). -``` - -**Result:** Let's see how to [Create a page](./create-a-page.md). - -## Images - -Regular Markdown images are supported. - -You can use absolute paths to reference images in the static directory (`static/img/docusaurus.png`): - -```md -![Docusaurus logo](/img/docusaurus.png) -``` - -![Docusaurus logo](/img/docusaurus.png) - -You can reference images relative to the current file as well. This is particularly useful to colocate images close to the Markdown files using them: - -```md -![Docusaurus logo](./img/docusaurus.png) -``` - -## Code Blocks - -Markdown code blocks are supported with Syntax highlighting. - - ```jsx title="src/components/HelloDocusaurus.js" - function HelloDocusaurus() { - return ( -

Hello, Docusaurus!

- ) - } - ``` - -```jsx title="src/components/HelloDocusaurus.js" -function HelloDocusaurus() { - return

Hello, Docusaurus!

; -} -``` - -## Admonitions - -Docusaurus has a special syntax to create admonitions and callouts: - - :::tip My tip - - Use this awesome feature option - - ::: - - :::danger Take care - - This action is dangerous - - ::: - -:::tip My tip - -Use this awesome feature option - -::: - -:::danger Take care - -This action is dangerous - -::: - -## MDX and React Components - -[MDX](https://mdxjs.com/) can make your documentation more **interactive** and allows using any **React components inside Markdown**: - -```jsx -export const Highlight = ({children, color}) => ( - { - alert(`You clicked the color ${color} with label ${children}`) - }}> - {children} - -); - -This is Docusaurus green ! - -This is Facebook blue ! -``` - -export const Highlight = ({children, color}) => ( - { - alert(`You clicked the color ${color} with label ${children}`); - }}> - {children} - -); - -This is Docusaurus green ! - -This is Facebook blue ! diff --git a/docs/tutorial-basics/publish-subscribe.md b/docs/tutorial-basics/publish-subscribe.md new file mode 100644 index 0000000..7787bff --- /dev/null +++ b/docs/tutorial-basics/publish-subscribe.md @@ -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` 的消息内容 diff --git a/docs/tutorial-extras/_category_.json b/docs/tutorial-extras/_category_.json index a8ffcc1..022405a 100644 --- a/docs/tutorial-extras/_category_.json +++ b/docs/tutorial-extras/_category_.json @@ -1,5 +1,5 @@ { - "label": "Tutorial - Extras", + "label": "其他组件", "position": 3, "link": { "type": "generated-index" diff --git a/docs/tutorial-extras/lock.md b/docs/tutorial-extras/lock.md new file mode 100644 index 0000000..918b0e3 --- /dev/null +++ b/docs/tutorial-extras/lock.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 2 +--- + +# 分布式锁 diff --git a/docs/tutorial-extras/manage-docs-versions.md b/docs/tutorial-extras/manage-docs-versions.md deleted file mode 100644 index e12c3f3..0000000 --- a/docs/tutorial-extras/manage-docs-versions.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Manage Docs Versions - -Docusaurus can manage multiple versions of your docs. - -## Create a docs version - -Release a version 1.0 of your project: - -```bash -npm run docusaurus docs:version 1.0 -``` - -The `docs` folder is copied into `versioned_docs/version-1.0` and `versions.json` is created. - -Your docs now have 2 versions: - -- `1.0` at `http://localhost:3000/docs/` for the version 1.0 docs -- `current` at `http://localhost:3000/docs/next/` for the **upcoming, unreleased docs** - -## Add a Version Dropdown - -To navigate seamlessly across versions, add a version dropdown. - -Modify the `docusaurus.config.js` file: - -```js title="docusaurus.config.js" -module.exports = { - themeConfig: { - navbar: { - items: [ - // highlight-start - { - type: 'docsVersionDropdown', - }, - // highlight-end - ], - }, - }, -}; -``` - -The docs version dropdown appears in your navbar: - -![Docs Version Dropdown](./img/docsVersionDropdown.png) - -## Update an existing version - -It is possible to edit versioned docs in their respective folder: - -- `versioned_docs/version-1.0/hello.md` updates `http://localhost:3000/docs/hello` -- `docs/hello.md` updates `http://localhost:3000/docs/next/hello` diff --git a/docs/tutorial-extras/rpc.md b/docs/tutorial-extras/rpc.md new file mode 100644 index 0000000..733de13 --- /dev/null +++ b/docs/tutorial-extras/rpc.md @@ -0,0 +1,7 @@ +--- +sidebar_position: 1 +--- + +# RPC远程调用 + +# \ No newline at end of file diff --git a/docs/tutorial-extras/timer.md b/docs/tutorial-extras/timer.md new file mode 100644 index 0000000..9361ada --- /dev/null +++ b/docs/tutorial-extras/timer.md @@ -0,0 +1,5 @@ +--- +sidebar_position: 2 +--- + +# 定时调度 \ No newline at end of file diff --git a/docs/tutorial-extras/translate-your-site.md b/docs/tutorial-extras/translate-your-site.md deleted file mode 100644 index caeaffb..0000000 --- a/docs/tutorial-extras/translate-your-site.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Translate your site - -Let's translate `docs/intro.md` to French. - -## Configure i18n - -Modify `docusaurus.config.js` to add support for the `fr` locale: - -```js title="docusaurus.config.js" -module.exports = { - i18n: { - defaultLocale: 'en', - locales: ['en', 'fr'], - }, -}; -``` - -## Translate a doc - -Copy the `docs/intro.md` file to the `i18n/fr` folder: - -```bash -mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/ - -cp docs/intro.md i18n/fr/docusaurus-plugin-content-docs/current/intro.md -``` - -Translate `i18n/fr/docusaurus-plugin-content-docs/current/intro.md` in French. - -## Start your localized site - -Start your site on the French locale: - -```bash -npm run start -- --locale fr -``` - -Your localized site is accessible at [http://localhost:3000/fr/](http://localhost:3000/fr/) and the `Getting Started` page is translated. - -:::caution - -In development, you can only use one locale at a same time. - -::: - -## Add a Locale Dropdown - -To navigate seamlessly across languages, add a locale dropdown. - -Modify the `docusaurus.config.js` file: - -```js title="docusaurus.config.js" -module.exports = { - themeConfig: { - navbar: { - items: [ - // highlight-start - { - type: 'localeDropdown', - }, - // highlight-end - ], - }, - }, -}; -``` - -The locale dropdown now appears in your navbar: - -![Locale Dropdown](./img/localeDropdown.png) - -## Build your localized site - -Build your site for a specific locale: - -```bash -npm run build -- --locale fr -``` - -Or build your site to include all the locales at once: - -```bash -npm run build -``` diff --git a/docusaurus.config.js b/docusaurus.config.js index a8561d1..64d5404 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,20 +1,24 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion -const lightCodeTheme = require('prism-react-renderer/themes/github'); -const darkCodeTheme = require('prism-react-renderer/themes/dracula'); +const lightCodeTheme = require('prism-react-renderer/themes/github') +const darkCodeTheme = require('prism-react-renderer/themes/dracula') /** @type {import('@docusaurus/types').Config} */ const config = { - title: 'My Site', - tagline: 'Dinosaurs are cool', + title: 'ZHub', + tagline: '轻量级消息中间件', favicon: 'img/favicon.ico', // Set the production url of your site here - url: 'https://your-docusaurus-test-site.com', + url: 'https://zhub.1216.top', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' baseUrl: '/', + customFields: { + // 添加自定义输出目录 + outDir: 'dist', + }, // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. @@ -41,16 +45,16 @@ const config = { sidebarPath: require.resolve('./sidebars.js'), // Please change this to your repo. // Remove this to remove the "edit this page" links. - editUrl: - 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', + // editUrl: 'https://gitee.com/tc608/doc-zhub/main', }, + blog: { showReadingTime: true, // Please change this to your repo. // Remove this to remove the "edit this page" links. - editUrl: - 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', + // editUrl: 'https://gitee.com/tc608/doc-zhub/main', }, + theme: { customCss: require.resolve('./src/css/custom.css'), }, @@ -59,12 +63,12 @@ const config = { ], themeConfig: - /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ + /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ // Replace with your project's social card image: 'img/docusaurus-social-card.jpg', navbar: { - title: 'My Site', + title: 'ZHub', logo: { alt: 'My Site Logo', src: 'img/logo.svg', @@ -74,50 +78,47 @@ const config = { type: 'docSidebar', sidebarId: 'tutorialSidebar', position: 'left', - label: 'Tutorial', + label: '文档', }, - {to: '/blog', label: 'Blog', position: 'left'}, + { to: '/blog', label: 'Blog', position: 'left' }, { - href: 'https://github.com/facebook/docusaurus', - label: 'GitHub', + href: 'https://gitee.com/tc608/zhub', + label: 'Gitee', position: 'right', }, ], }, + footer: { style: 'dark', links: [ { - title: 'Docs', + title: '文档', items: [ { - label: 'Tutorial', + label: '快速开始', to: '/docs/intro', }, - ], - }, - { - title: 'Community', - items: [ { - label: 'Stack Overflow', - href: 'https://stackoverflow.com/questions/tagged/docusaurus', - }, - { - label: 'Discord', - href: 'https://discordapp.com/invite/docusaurus', - }, - { - label: 'Twitter', - href: 'https://twitter.com/docusaurus', + label: '基础使用', + to: '/docs/category/基础使用', }, ], }, { - title: 'More', + title: '社区', items: [ { - label: 'Blog', + label: 'Gitee', + href: 'https://gitee.com/tc608', + }, + ], + }, + { + title: '更多', + items: [ + { + label: '博客', to: '/blog', }, { @@ -127,13 +128,14 @@ const config = { ], }, ], - copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`, + copyright: `Copyright © ${new Date().getFullYear()} ZHub, Inc. Built with Docusaurus.`, }, prism: { theme: lightCodeTheme, darkTheme: darkCodeTheme, + additionalLanguages: ['java'], }, }), -}; +} -module.exports = config; +module.exports = config diff --git a/package.json b/package.json index e7051b5..94e19c2 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ "@mdx-js/react": "^1.6.22", "clsx": "^1.2.1", "prism-react-renderer": "^1.3.5", - "react": "^17.0.2", - "react-dom": "^17.0.2" + "react": "^18.0.0", + "react-dom": "^18.0.0" }, "devDependencies": { "@docusaurus/module-type-aliases": "2.4.1" diff --git a/src/components/HomepageFeatures/index.js b/src/components/HomepageFeatures/index.js index 78f410b..df099c6 100644 --- a/src/components/HomepageFeatures/index.js +++ b/src/components/HomepageFeatures/index.js @@ -4,32 +4,29 @@ import styles from './styles.module.css'; const FeatureList = [ { - title: 'Easy to Use', + title: '易于使用', Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, description: ( <> - Docusaurus was designed from the ground up to be easily installed and - used to get your website up and running quickly. + ZHub 从新设计,易于安装和用于快速启动运行您的项目。 ), }, { - title: 'Focus on What Matters', + title: '专注于重要的事情', Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default, description: ( <> - Docusaurus lets you focus on your docs, and we'll do the chores. Go - ahead and move your docs into the docs directory. + ZHub 让你专注于你的业务,我们专注于消息收发、数据传递,让你多个工程进行之间通讯变得如此的简单。 ), }, { - title: 'Powered by React', + title: 'Powered by ZHUB', Svg: require('@site/static/img/undraw_docusaurus_react.svg').default, description: ( <> - Extend or customize your website layout by reusing React. Docusaurus can - be extended while reusing the same header and footer. + 通过 Golang 编写通讯组件,自定义消息协议,专注提升服务性能。 ), }, diff --git a/src/css/custom.css b/src/css/custom.css index 2bc6a4c..3672aad 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -6,7 +6,7 @@ /* You can override the default Infima variables here. */ :root { - --ifm-color-primary: #2e8555; + --ifm-color-primary: #852e79; --ifm-color-primary-dark: #29784c; --ifm-color-primary-darker: #277148; --ifm-color-primary-darkest: #205d3b; @@ -19,7 +19,7 @@ /* For readability concerns, you should choose a lighter palette in dark mode. */ [data-theme='dark'] { - --ifm-color-primary: #25c2a0; + --ifm-color-primary: #852e79; --ifm-color-primary-dark: #21af90; --ifm-color-primary-darker: #1fa588; --ifm-color-primary-darkest: #1a8870; diff --git a/src/pages/index.js b/src/pages/index.js index affcd90..7d6bc6a 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -18,7 +18,7 @@ function HomepageHeader() { - Docusaurus Tutorial - 5min ⏱️ + 快速上手(安装、使用) ⏱️ @@ -30,7 +30,7 @@ export default function Home() { const {siteConfig} = useDocusaurusContext(); return (
diff --git a/static/img/undraw_docusaurus_mountain.svg b/static/img/undraw_docusaurus_mountain.svg index af961c4..5616bda 100644 --- a/static/img/undraw_docusaurus_mountain.svg +++ b/static/img/undraw_docusaurus_mountain.svg @@ -1,5 +1,5 @@ - Easy to Use + 易于使用