Skip to content

Commit

Permalink
update docs version to 3.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongyuan17 committed Jun 27, 2024
1 parent 386b102 commit 76437c9
Show file tree
Hide file tree
Showing 574 changed files with 10,411 additions and 55 deletions.
4 changes: 0 additions & 4 deletions website/docs/01_get_started/3_faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ The Java version requirements for BifroMQ can be divided into two aspects:
- **BifroMQ runtime environment**: BifroMQ itself requires JDK 17 or higher for operation.
- **BifroMQ plugin development**: For developing BifroMQ plugins, there's no enforced requirement for a specific Java language version or JDK version. However, plugin developers need to ensure their plugins function properly in higher Java environments. To prevent compatibility issues, we suggest keeping the plugin's runtime environment consistent with BifroMQ's.

## What is your version support policy?

We only support the latest major version and do not handle bugs or issues from previous major versions. Within the current major version, we ensure that the latest minor version is compatible with earlier minor versions. If you encounter issues in an old version, please upgrade to the latest version first and try again.

## Does BifroMQ include a built-in rule engine?

Unlike other products or projects providing MQTT protocol capabilities, BifroMQ's primary aim is to serve as a high-performance, multi-tenant, distributed middleware implementing the standard MQTT protocol. "Rule engines" are not part of the MQTT protocol specification and hence are not included in BifroMQ.
Expand Down
8 changes: 7 additions & 1 deletion website/docs/06_plugin/5_plugin_practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: "Plugin Practice and Notice"

This article outlines some practices and considerations when developing BifroMQ plugins.

## Quickly Start a BifroMQ Plugin Project
## Start a BifroMQ Plugin Project Quickly

To jump start your BifroMQ plugin development, execute the following Maven command:

Expand All @@ -30,6 +30,12 @@ project structured for BifroMQ plugin development.
**Important Note**: The archetype version should be 3.2.0 or higher as the archetype is compatible starting from version
3.2.0. Ensure that `<BIFROMQ_VERSION>` is set accordingly.

In addition to the foundational code framework for plugin development, the generated BifroMQ plugin project also includes the following features:

* PluginContext: Defines the plugin context to facilitate the transfer of necessary runtime information.
* Configuration File: Uses a standalone config.yaml file for plugin configuration.
* Logging Configuration: Uses a standalone logback.xml file for plugin logging configuration.

## Remote Debugging with BifroMQ

BifroMQ supports remote debugging, which can be activated through the `JVM_DEBUG` environment variable. Additionally, the remote debugging port can be specified through the `JAVA_DEBUG_PORT` environment variable. If not specified, the
Expand Down
5 changes: 3 additions & 2 deletions website/docs/06_plugin/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ The plugin mechanism is a primary way for BifroMQ to deeply integrate with busin
* Project Organization: A pf4j project can contain multiple plugin implementations.
* Singleton Plugins: Extensions of AuthProvider, Resource Throttler, and Setting Provider types are singletons at runtime. The specific type to be loaded needs to be specified through a configuration file.
* Multiple Instance Plugins: EventCollector allows for multiple different types of instances to exist, with interface methods of these EventCollector instances being called back simultaneously.
* Quick Start:We provide a plugin project scaffolding tool, allowing you to start plugin development quickly. See [Start a BifroMQ Plugin Project Quickly](../plugin_practice/#start-a-bifromq-plugin-project-quickly)

## Plugin Deployment

* Plugin Directory: BifroMQ loads plugin implementations (JAR files or directories) from the plugins subdirectory within its installation directory.
* Classloader Isolation: Each plugin uses an independent ClassLoader to isolate its code from BifroMQ and other plugins.
* BifroMQ provides class loading for the following commonly used packages:
* `com.baidu.bifromq.*`
* `com.baidu.bifromq.type.*`
* `com.baidu.bifromq.plugin.*`
* `io.micrometer.core.*`
* `com.google.protobuf.*`
* `org.slf4j.*`

**Note**: Some 3rd party dependencies used in a plugin may use the `Thread.currentThread().getContextClassLoader()` to load classes, which can result in a `ClassNotFoundException`. To prevent this, you can include the logic for loading dependency classes within the following try-finally structure:

Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const config = {
lastVersion: 'current',
versions: {
current: {
label: '3.1.x',
label: '3.2.x',
path: '',
},
},
Expand Down
12 changes: 0 additions & 12 deletions website/i18n/zh-Hans/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,6 @@
"Our track record": {
"message": "我们的成绩"
},
"Trusted by thousands of developers worldwide": {
"message": "受到全球数千名开发人员的信赖"
},
"Thanks to the operation of Baidu Intelligent Cloud (IoT Core), we have served thousands customers and a large number of device connections in the public cloud based on BifroMQ.": {
"message": "得益于百度智能云物联网核心套件(IoT Core)的运营,我们已经基于 BifroMQ 在公有云中服务了数千名客户,并经过亿级设备的接入验证。"
},
Expand All @@ -345,15 +342,6 @@
"Go to GitHub": {
"message": "前往 GitHub"
},
"Connected Clients": {
"message": "连接设备数"
},
"180 Million+": {
"message": "1.8 亿 +"
},
"Customers": {
"message": "服务用户数"
},
"MQTT Broker": {
"message": "MQTT Broker"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version.label": {
"message": "3.1.x",
"message": "3.2.x",
"description": "The label for version current"
},
"sidebar.tutorialSidebar.category.Get Started": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ BifroMQ的Java版本要求可以分为两个方面:
- **BifroMQ运行环境**: BifroMQ本身需要JDK 17或更高版本才能运行。
- **BifroMQ插件开发**: 对于开发BifroMQ插件,没有强制要求特定的Java语言版本或JDK版本。然而,插件开发者需要确保他们的插件在更高的Java环境中能够正常工作。为了防止兼容性问题,我们建议将插件的运行环境与BifroMQ的保持一致。

## 你们的版本支持策略是怎样的?

我们只支持当前最新大版本,不再处理之前大版本的bug或疑问。在同一大版本中,保证最新小版本向前兼容。如果在旧版本中遇到问题,请先升级至最新版本后再进行尝试。

## BifroMQ包含内置规则引擎吗?

与提供MQTT协议能力的其他产品或项目不同,BifroMQ的主要目标是作为一个高性能、多租户、分布式中间件,实现标准MQTT协议。"规则引擎"不是MQTT协议规范的一部分,因此不包含在BifroMQ中。BifroMQ更多地关注与上游和下游系统的以标准的方式集成。从这个角度看,"规则引擎"只是与BifroMQ集成的一种功能形式(甚至在不同的规则引擎项目中,还存在功能差异)。我们希望这种需求可以在BifroMQ开发者社区中以开放的方式得到满足。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ mvn archetype:generate \

**重要提示**:原型的版本应为 3.2.0 或更高版本,因为该原型从 3.2.0 版本开始兼容。确保 `<BIFROMQ_VERSION>` 设置正确。

除了插件开发的基础代码框架外,生成的 BifroMQ 插件项目还为您提供以下机制:

* PluginContext:定义插件上下文,方便传递插件运行所需信息。
* 配置文件:使用独立的 config.yaml 文件来配置插件。
* 日志配置:使用独立的 logback.xml 文件来配置插件日志。

## BifroMQ的远程调试

Java远程调试允许开发人员从IDE远程调试定制化插件。BifroMQ支持远程调试,可以通过环境变量JVM_DEBUG来启用。同时,还可以通过环境变量JAVA_DEBUG_PORT指定远程调试端口。如果没有指定,那么默认端口为8008。Linux Shell示例:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ title: "插件能力概述"
* 项目组织:一个pf4j项目可以包含多个插件实现。
* 单例插件:AuthProvider、Resource Throttler和Setting Provider类型的扩展在运行时是单例的。需要通过配置文件指定要加载的具体类型。
* 多例插件:EventCollector允许多个不同类型的实例存在,这些EventCollector实例的接口方法将同时被回调。
* 快速开发:提供了插件项目搭建工具,可以快速开始进行插件开发。参见[快速开始插件开发](../plugin_practice/#快速开始插件开发)

## 插件部署

* 插件目录:BifroMQ从其安装目录内的plugins子目录加载插件实现(JAR文件或目录)。
* 类加载器隔离:每个插件使用独立的ClassLoader来隔离其代码与BifroMQ及其他插件。
* BifroMQ为以下常用包提供类加载:
* `com.baidu.bifromq.*`
* `com.baidu.bifromq.type.*`
* `com.baidu.bifromq.plugin.*`
* `io.micrometer.core.*`
* `com.google.protobuf.*`
* `org.slf4j.*`

**注意**:某些插件的依赖可能会使用`Thread.currentThread().getContextClassLoader()`加载class,从而导致`ClassNotFoundException`,为避免这种情况的发生,可以将加载依赖class的逻辑包含在如下try-finally结构中:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
sidebar_position: 1
title: "快速安装"
---

推荐使用Docker,快速开启BifroMQ。
```
docker run -d --name bifromq -p 1883:1883 bifromq/bifromq:latest
```

## 其他安装选项

有关更多安装替代方案,请参阅:[安装](../02_installation/intro.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
sidebar_position: 2
title: "快速验证"
---

以下是使用客户端工具MQTTX 快速验证 BifroMQ 基本 MQTT 功能的步骤。

1. 访问 https://mqttx.app/ 下载并安装 MQTTX。
2. 打开 MQTTX 并点击左侧边栏的“新建连接”或“+”号以创建新的连接配置。

![newconn](./images/newconn.jpg)

3. 填写所需字段:
* Name:此配置的名称。您可以选择任意名称。
* Client ID:客户端 ID,您可以手动设置或使用右侧的按钮随机生成。它必须包含字符“a-z”、“0-9”、“_”、“-”,并且不能超过 128 字节。使用 UTF8 编码且必须是唯一的。
* Host: 连接地址。以协议前缀开始(对于 TCP 使用 mqtt://,对于 TLS/SSL 使用 mqtts://,或对于 WSS 使用 wss://),后跟可以访问 BifroMQ 服务器的域名。
* Port: 连接端口。根据协议前缀选择适当的端口。默认端口是 TCP:1883,TLS/SSL:1884,WSS:443。
* Username & Password: 输入您拥有的用户名和密码,或者如果您的BifroMQ安装仅用于测试,则留空。
* MQTT Version: 选择 3.1、3.1.1、5.0

4. 正确输入连接配置后,点击右上角的'连接'以连接到服务器。
5. 订阅一个主题:点击左上角的“新建订阅”按钮,并在弹出的对话框中输入主题。

![subscribe](./images/subscribe.jpg)

6. 发布消息:在消息发送/接收界面,输入您在右下角订阅的相同主题。选择默认 QoS 0,输入消息内容,并点击发送按钮发布。

![publish](./images/publish.jpg)

7. 消息成功发送后,您应该能在界面的右侧看到发送的消息。
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
sidebar_position: 3
title: "常见问题"
---

## BifroMQ支持哪些版本的MQTT协议?
BifroMQ全面支持以下MQTT协议版本:v3.1、v3.1.1 和 v5.0。这种多样性确保了BifroMQ能够适应广泛的IoT设备和应用程序,遵循不同的协议标准。此外,BifroMQ允许在运行时动态控制租户级别的协议能力,提供定制的连接选项以满足特定租户的需求。

## BifroMQ的Java版本要求是什么?

BifroMQ的Java版本要求可以分为两个方面:
- **BifroMQ运行环境**: BifroMQ本身需要JDK 17或更高版本才能运行。
- **BifroMQ插件开发**: 对于开发BifroMQ插件,没有强制要求特定的Java语言版本或JDK版本。然而,插件开发者需要确保他们的插件在更高的Java环境中能够正常工作。为了防止兼容性问题,我们建议将插件的运行环境与BifroMQ的保持一致。

## BifroMQ包含内置规则引擎吗?

与提供MQTT协议能力的其他产品或项目不同,BifroMQ的主要目标是作为一个高性能、多租户、分布式中间件,实现标准MQTT协议。"规则引擎"不是MQTT协议规范的一部分,因此不包含在BifroMQ中。BifroMQ更多地关注与上游和下游系统的以标准的方式集成。从这个角度看,"规则引擎"只是与BifroMQ集成的一种功能形式(甚至在不同的规则引擎项目中,还存在功能差异)。我们希望这种需求可以在BifroMQ开发者社区中以开放的方式得到满足。

## 如何使用BifroMQ进行数据集成?

使用BifroMQ进行数据集成的方法在很大程度上取决于您的业务场景:

- **单租户系统**: 对于逻辑上的单租户系统,其他系统可以直接使用MQTT协议与BifroMQ[集成](../05_user_guide/2_integration/intro.md)。例如,可以利用共享订阅并行订阅消息,或MQTT客户端可以直接向BifroMQ发布消息。这种方法完全解耦了上游和下游系统,便于比较不同的MQTT中间件。大多数专有企业应用属于此类。

- **多租户系统**: 对于共享资源架构的多租户业务场景,BifroMQ作为该类系统内的一个子系统,与其他多租户子系统共享同一个租户管理控制面。在这种情况下,系统集成需要采用BifroMQ的插件机制(目前还未开放)。下游系统将在插件级别与BifroMQ有一定程度的耦合,使得实现变得有些复杂。这通常用于构建Serverless云服务的业务场景。

## BifroMQ内置存储引擎主要用于哪些数据持久化?

BifroMQ的内置存储引擎主要用于持久化MQTT协议要求的SessionState(参见: [MQTT v3.1.1 3.1.2.4](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718028))和Retain消息。这有助于防止Broker重启或崩溃时丢失会话状态。需要注意的是,持久化引擎大多数情况下与消息的QoS没有直接关系。例如,当一个MQTT连接开始一个持久会话时,离线QoS0订阅消息仍将被持久化,直到会话恢复并完成推送。

## 为什么BifroMQ没有管理控制台/UI界面?

BifroMQ强调在各种类型的业务系统中的集成,因此它不在中间件级别定义更高级别的管理模式和概念。然而,BifroMQ确实提供了以下能力用于运行时控制集成和监控:
- **[API](../05_user_guide/3_api/intro.md)**: 代理端控制逻辑,如强制断开连接。
- **[Metrics](../07_admin_guide/03_observability/metrics/intro.md)**: BifroMQ的运行时指标,可以与现有监控系统集成。
- **[EventCollector Plugin](../06_plugin/2_event_collector.md)**: BifroMQ操作过程中产生的各种事件,启用不同的事件溯源业务逻辑,如连接计数、在线/离线事件等。
- **[ResourceThrottler Plugin](../06_plugin/3_resource_throttler.md)**: 用于控制租户级资源使用。
- **[SettingProvider Plugin](../06_plugin/4_setting_provider/intro.md)**: 用于调整租户级运行时设置。

我们也鼓励社区开发者参与满足这些需求,并构建多样化的UI管理界面。

## BifroMQ和IoT Core之间的关系是什么?

IoT Core是百度智能云提供的一套物联网核心套件,支持预付费和按量付费计费模式的公有云服务。BifroMQ和IoT Core有着密切的关系,因为BifroMQ是IoT Core的底层技术。BifroMQ的多租户、高性能和分布式能力为构建大规模的IoT Core设备连接和消息系统提供了强大支持。
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "快速开始",
"position": 1,
"link": {
"type": "doc",
"id": "get_started/intro"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
id: intro
sidebar_position: 0
title: "介绍"
---

BifroMQ是一个Java实现的高性能、分布式MQTT Broker,无缝集成了原生的多租户支持。它旨在促进大规模 IoT 设备连接和消息系统的构建。目前,BifroMQ 作为基础技术,服务于百度公有云服务[IoTCore](https://cloud.baidu.com/product/iot.html)

## 名称由来

BifroMQ 的名字来源于北欧神话中的 `Bifröst`——一座连接 Midgard(人类的世界)和 Asgard(神的领域)的彩虹桥。如同 Bifröst,BifroMQ 作为一个灵活而坚固的桥梁,连接不同的系统或应用程序,以实现通过消息交换进行通信。这与 MQTT 中间件的核心功能相符,即管理和加速分布式系统中的消息传递。

Bifröst 的坚固象征着 BifroMQ 的稳定性和可靠性,其灵活性则标志着 BifroMQ 的可扩展性和适应性。简而言之,“BifroMQ”体现了一个连接各种系统或应用程序的、坚韧、可适应的 MQTT 中间件。

## 功能列表

* 完全支持 MQTT 3.1、3.1.1 和 5.0 版本的特性,覆盖 TCP、TLS、WS、WSS。
* 原生支持多租户、资源共享和工作负载隔离。
* 内置的分布式存储引擎,为 MQTT 工作负载优化,无需第三方中间件依赖。
* 扩展机制支持:
* 认证/授权。
* 租户级运行时设置。
* 租户级资源限制。
* 事件。
* 系统/租户级监控。

## 社区

#### **问题跟踪**

我们使用 GitHub [Issues](https://github.com/bifromqio/bifromq/issues) 来跟踪请求和错误。如果您有任何问题或遇到问题,随时开启一个 issue。

#### **Discord**

<a href="https://discord.gg/Pfs3QRadRB"><img src="https://img.shields.io/discord/1115542029531885599?logo=discord&logoColor=white" alt="BifroMQ Discord 服务器" /></a>

#### **微信群组**

[通过电子邮件](mailto:[email protected]) 向我们发送您的微信 ID,以及为什么您对 BifroMQ 感兴趣的更多信息(我们很乐意听到),我们将尽快邀请您加入我们的群组。

## 专业服务

欢迎 [通过电子邮件](mailto:[email protected]) 联系我们。
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
sidebar_position: 1
title: "Docker"
---

## 安装前提

* 已安装 [Docker](https://www.docker.com/)
* 使用1883端口的权限,并且该端口可用。如果您没有权限,请更改为相应的端口。

## Docker命令

运行以下命令,在容器中以Linux用户 `bifromq` 的身份运行BifroMQ。

```
docker run -d --name bifromq -p 1883:1883 bifromq/bifromq:latest
```

## 内存限制

默认情况下,BifroMQ进程启动时,会根据服务器的物理内存动态计算相关的JVM参数。然而,在容器化环境中启动时,它会内省主机机器的物理内存,可能会与Docker或容器施加的内存限制产生冲突,从而导致容器过早终止。

为了规避此类挑战,建议主动限制容器的内存消耗,并通过环境变量将这些限制传达给容器运行时。在BifroMQ启动时,会优先根据 `MEM_LIMIT` 环境变量计算JVM参数。下面提供了一个具体示例:

```
docker run -d -m 10G -e MEM_LIMIT='10737418240' --name bifromq -p 1883:1883 bifromq/bifromq:latest
```

***注意:MEM_LIMIT的单位是字节。***

进一步地,可以主动配置JVM堆内存,并直接将其传递给容器运行时,供BifroMQ使用。下面提供了一个具体示例:

```
docker run -d -m 10G -e JVM_HEAP_OPTS='-Xms2G -Xmx4G -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=500m -XX:MaxDirectMemorySize=1G' --name bifromq -p 1883:1883 bifromq/bifromq:latest
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
sidebar_position: 2
title: "Linux"
---

## 安装前提

* 运行环境已安装Java17或更高版本
* 获取BifroMQ最新[发布版](https://github.com/bifromqio/bifromq/releases)

## 执行命令

```
tar -zxvf bifromq-*-standalone.tar.gz --strip-components 1 -C /usr/share/bifromq/
cd /usr/share/bifromq && ./bin/standalone.sh start
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
sidebar_position: 3
title: "Windows"
---

## 安装前提

* 运行环境已安装Java17或更高版本
* 获取BifroMQ最新[发布版](https://github.com/bifromqio/bifromq/releases)

## 执行命令

```
unzip -zxvf bifromq-*-standalone-windows.zip
cd bifromq\bin
standalone.bat start
```
Loading

0 comments on commit 76437c9

Please sign in to comment.