├── .config └── nextest.toml ├── .dockerignore ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ ├── enhancement.yml │ ├── feature_request.yml │ ├── subtask.yml │ └── umbrella.yml ├── actions │ ├── build-images │ │ └── action.yml │ ├── build-linux-artifacts │ │ └── action.yml │ ├── build-macos-artifacts │ │ └── action.yml │ ├── build-robustmq-binary │ │ └── action.yml │ ├── build-robustmq-images │ │ └── action.yml │ ├── build-windows-artifacts │ │ └── action.yml │ ├── publish-github-release │ │ └── action.yml │ ├── release-cn-artifacts │ │ └── action.yaml │ ├── setup-builder │ │ └── action.yaml │ ├── setup-rust-runtime │ │ └── action.yml │ └── upload-artifacts │ │ └── action.yml ├── close-issues-on-merge.yml ├── doc-label-config.yml ├── labeler-config.yml ├── pr-title-breaking-change-label-config.json ├── pr-title-checker-config.json ├── pull_request_template.md ├── scripts │ ├── copy-image.sh │ ├── create-version.sh │ └── upload-artifacts-to-s3.sh └── workflows │ ├── apidoc.yml │ ├── code-style.yml │ ├── deployment-vite.yml │ ├── free-disk-space.yml │ ├── ig-all-test.yml │ ├── license.yaml │ ├── pr-issue-labeler.yml │ ├── pr-title-checker.yml │ ├── size-label.yml │ └── unit-test.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .requirements-precommit.txt ├── Cargo.lock ├── Cargo.toml ├── Dockerfile ├── LICENSE ├── README.md ├── _typos.toml ├── benches └── test.rs ├── bin ├── robust-bench ├── robust-ctl └── robust-server ├── cliff.toml ├── codecheck.sh ├── config ├── example │ ├── certs │ │ ├── ca.pem │ │ ├── cert.pem │ │ └── key.pem │ ├── log4rs.yaml.example │ └── mqtt-server.toml.example ├── journal-server.toml ├── log-config │ ├── journal-log4rs.yaml │ ├── journal-tracing.toml │ ├── mqtt-log4rs.yaml │ ├── mqtt-tracing.toml │ ├── place-log4rs.yaml │ └── place-tracing.toml ├── mqtt-server.toml └── placement-center.toml ├── deny.toml ├── docker └── Dockerfile ├── docs ├── .DS_Store ├── .design │ ├── logic │ │ ├── Integrate the metrics module.md │ │ ├── flapping-detect.md │ │ └── pub-sub-cli.md │ ├── module │ │ └── mqtt broker │ │ │ └── GRPC.md │ ├── observability │ │ ├── metrics.md │ │ └── telemetry.md │ ├── plan │ │ ├── mqtt-all-feature.md │ │ └── mqtt-stable-to-do.md │ ├── storage-adapter │ │ ├── minio.md │ │ ├── mysql.md │ │ └── rocksdb.md │ └── user-draft │ │ ├── flapping-detect.md │ │ └── pub-sub-cli.md ├── .vitepress │ ├── config.mts │ └── src │ │ ├── configs │ │ ├── en.mts │ │ └── zh.mts │ │ ├── docs.mts │ │ ├── head.mts │ │ ├── nav │ │ ├── en.mts │ │ └── zh.mts │ │ ├── sidebars │ │ ├── en.mts │ │ └── zh.mts │ │ └── theme.mts ├── CNAME ├── en │ ├── Architect │ │ ├── Broker-Server.md │ │ ├── Configuration │ │ │ ├── Mqtt-Server.md │ │ │ └── Placement-Center.md │ │ ├── Design-Documentation.md │ │ ├── Journal-Server.md │ │ ├── Overview.md │ │ ├── Placement-Center.md │ │ ├── Storage-Adapter.md │ │ ├── Terminology.md │ │ └── Test-Case.md │ ├── ContributionGuide │ │ ├── ContributingCode │ │ │ ├── Build-Develop-Env.md │ │ │ ├── Cargo-Running.md │ │ │ ├── Code-Structure.md │ │ │ ├── Troubleshooting.md │ │ │ └── VsCode-Running.md │ │ ├── ContributingDoc │ │ │ ├── Build-Doc-Env.md │ │ │ └── Doc-Contribution-Guide.md │ │ ├── GitHub-Contribution-Guide.md │ │ └── Pull-Request-Example.md │ ├── Getting-Started │ │ └── Overview.md │ ├── OverView │ │ ├── Good-First-Issue.md │ │ ├── MQTT-Release.md │ │ ├── RoadMap-2025.md │ │ ├── What-is-RobustMQ.md │ │ └── Why-RobustMQ.md │ ├── QuickGuide │ │ ├── Overview.md │ │ └── mqtt │ │ │ ├── Build.md │ │ │ ├── First-Task.md │ │ │ ├── MQTT-test.md │ │ │ ├── Run-Cluster-Mode.md │ │ │ ├── Run-Docker-Mode.md │ │ │ ├── Run-K8S-Mode.md │ │ │ └── Run-Standalone-Mode.md │ ├── RobustMQ-Command │ │ ├── Journal Server.md │ │ ├── Mqtt-Broker.md │ │ ├── Overview.md │ │ └── Placement-Center.md │ ├── RobustMQ-Kafka │ │ └── Overview.md │ ├── RobustMQ-MQTT │ │ ├── Dashboard.md │ │ ├── DelayMessage.md │ │ ├── Overview.md │ │ ├── PublicMqttServer.md │ │ ├── RetainMessage.md │ │ ├── SharedSubscription.md │ │ ├── SystemArchitecture.md │ │ └── TopicRewrite.md │ ├── VersionRecord │ │ ├── 0.1.0-beta.md │ │ └── Summary-2024.md │ └── index.md ├── images │ ├── Build-Doc-Env-1.png │ ├── Cargo-Running-1.png │ ├── Cargo-Running-run-journal-server-3.png │ ├── Cargo-Running-run-mqtt-server-2.png │ ├── DocContributionGuide-1.png │ ├── DocContributionGuide-2.png │ ├── DocContributionGuide-3.png │ ├── GithubContributionGuide-1.png │ ├── GithubContributionGuide-2.png │ ├── GithubContributionGuide-3.png │ ├── GithubContributionGuide-4.png │ ├── GithubContributionGuide-5.png │ ├── VSCode-Running-1.png │ ├── WechatGroup.jpg │ ├── dashboard.png │ ├── doc-image.png │ ├── doc-image1.png │ ├── doc-image11.png │ ├── doc-image12.png │ ├── doc-image13.png │ ├── doc-image2.png │ ├── doc-image3.png │ ├── doc-image4.png │ ├── doc-image5.png │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ ├── mqttx-2.png │ ├── mqttx01.png │ ├── robustmq-architecture-journal-server.png │ ├── robustmq-architecture.png │ ├── robustmq-logo.png │ ├── share-sub-1.png │ ├── share-sub-2.png │ ├── storage-adapter.png │ └── wechat.jpg ├── license_header.file ├── public │ ├── favicon.ico │ ├── logo-large.jpg │ └── logo.png └── zh │ ├── Architect │ ├── Broker-Server.md │ ├── Configuration │ │ ├── Mqtt-Server.md │ │ └── Placement-Center.md │ ├── Design-Documentation.md │ ├── Journal-Server.md │ ├── Overview.md │ ├── Placement-Center.md │ ├── Storage-Adapter.md │ ├── Terminology.md │ └── Test-Case.md │ ├── ContributionGuide │ ├── ContributingCode │ │ ├── Build-Develop-Env.md │ │ ├── Cargo-Running.md │ │ ├── Code-Structure.md │ │ ├── Troubleshooting.md │ │ └── VsCode-Running.md │ ├── ContributingDoc │ │ ├── Build-Doc-Env.md │ │ └── Doc-Contribution-Guide.md │ ├── GitHub-Contribution-Guide.md │ └── Pull-Request-Example.md │ ├── OverView │ ├── Good-First-Issue.md │ ├── MQTT-Release.md │ ├── RoadMap-2025.md │ ├── What-is-RobustMQ.md │ └── Why-RobustMQ.md │ ├── QuickGuide │ ├── Overview.md │ └── mqtt │ │ ├── Build.md │ │ ├── First-Task.md │ │ ├── MQTT-test.md │ │ ├── Run-Cluster-Mode.md │ │ ├── Run-Docker-Mode.md │ │ ├── Run-K8S-Mode.md │ │ └── Run-Standalone-Mode.md │ ├── RobustMQ-Command │ ├── Journal Server.md │ ├── Mqtt-Broker.md │ ├── Overview.md │ └── Placement-Center.md │ ├── RobustMQ-Kafka │ └── Overview.md │ ├── RobustMQ-MQTT │ ├── Dashboard.md │ ├── DelayMessage.md │ ├── Overview.md │ ├── PublicMqttServer.md │ ├── RetainMessage.md │ ├── SystemAlarm.md │ ├── SystemArchitecture.md │ └── WillMessage.md │ ├── VersionRecord │ ├── 0.1.0-beta.md │ └── Summary-2024.md │ └── index.md ├── example ├── mqtt-cluster │ ├── journal-server │ │ └── node-1.toml │ ├── mqtt-server │ │ ├── node-1.toml │ │ ├── node-2.toml │ │ └── node-3.toml │ ├── placement-center │ │ ├── node-1.toml │ │ ├── node-2.toml │ │ └── node-3.toml │ ├── start.sh │ └── stop.sh ├── single-mqtt-cluster │ ├── README.md │ ├── certs │ │ ├── ca.pem │ │ ├── cert.pem │ │ └── key.pem │ ├── journal-server │ │ ├── journal-server.toml │ │ └── journal-tracing.toml │ ├── mqtt-server │ │ ├── mqtt-server.toml │ │ └── mqtt-tracing.toml │ ├── placement-center │ │ ├── place-tracing.toml │ │ └── placement-center.toml │ ├── start.sh │ └── stop.sh ├── test-network-docker │ ├── compose │ │ ├── compose-test-net.yaml │ │ └── config │ │ │ └── cluster │ │ │ ├── mqtt-server │ │ │ ├── node-1.toml │ │ │ ├── node-2.toml │ │ │ └── node-3.toml │ │ │ └── placement-center │ │ │ ├── node-1.toml │ │ │ ├── node-2.toml │ │ │ └── node-3.toml │ └── start.sh ├── test-network-k8s │ ├── kube │ │ ├── cert-manager.yaml │ │ ├── cfg-mqtt-server.yaml │ │ ├── cfg-placement-center.yaml │ │ ├── cli-command.yaml │ │ ├── ingress-nginx-robustmq-kind.yaml │ │ ├── mqtt-server-ingress.yaml │ │ ├── mqtt-server.yaml │ │ └── placement-center.yaml │ ├── network.sh │ └── scripts │ │ ├── cluster.sh │ │ ├── config.sh │ │ ├── docker.sh │ │ ├── kind.sh │ │ ├── robustmq.sh │ │ └── util.sh └── ws-mqtt.html ├── licenserc.toml ├── makefile ├── mirror ├── package-lock.json ├── package.json ├── rust-toolchain.toml ├── rustfmt.toml ├── scripts ├── bin-ig-test.sh ├── build-release.sh ├── check-place-status.sh ├── install.sh ├── journal-ig-test.sh ├── mqtt-ig-test.sh ├── place-ig-test.sh └── unit-test.sh ├── src ├── amqp-broker │ ├── Cargo.toml │ ├── src │ │ └── lib.rs │ └── tests │ │ └── mod.rs ├── cli-bench │ ├── Cargo.toml │ └── src │ │ ├── error.rs │ │ ├── kafka │ │ └── mod.rs │ │ ├── kv │ │ ├── get.rs │ │ ├── mixed.rs │ │ ├── mod.rs │ │ └── set.rs │ │ ├── lib.rs │ │ ├── mqtt │ │ ├── mod.rs │ │ ├── publish.rs │ │ └── subscribe.rs │ │ ├── raft │ │ └── mod.rs │ │ └── rocksdb │ │ └── mod.rs ├── cli-command │ ├── Cargo.toml │ ├── src │ │ ├── lib.rs │ │ ├── mqtt.rs │ │ ├── placement.rs │ │ └── template.rs │ └── tests │ │ └── mod.rs ├── cmd │ ├── Cargo.toml │ ├── src │ │ ├── cli-bench │ │ │ └── bench.rs │ │ ├── cli-command │ │ │ ├── command.rs │ │ │ └── mqtt │ │ │ │ ├── admin.rs │ │ │ │ ├── mod.rs │ │ │ │ └── publish.rs │ │ ├── journal-server │ │ │ └── server.rs │ │ ├── mqtt-server │ │ │ └── server.rs │ │ └── placement-center │ │ │ └── server.rs │ └── tests │ │ └── mod.rs ├── common │ ├── base │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── config │ │ │ │ ├── broker_mqtt.rs │ │ │ │ ├── common.rs │ │ │ │ ├── default_journal_server.rs │ │ │ │ ├── default_mqtt.rs │ │ │ │ ├── default_placement_center.rs │ │ │ │ ├── journal_server.rs │ │ │ │ ├── mod.rs │ │ │ │ └── placement_center.rs │ │ │ ├── enum_type │ │ │ │ ├── feature_type.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── sort_type.rs │ │ │ │ ├── time_unit_enum.rs │ │ │ │ └── topic_rewrite_action_enum.rs │ │ │ ├── error │ │ │ │ ├── common.rs │ │ │ │ ├── log_config.rs │ │ │ │ └── mod.rs │ │ │ ├── http_error.rs │ │ │ ├── http_response.rs │ │ │ ├── lib.rs │ │ │ ├── logging │ │ │ │ ├── config.rs │ │ │ │ ├── console.rs │ │ │ │ ├── fmt.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── rolling_file.rs │ │ │ │ └── tokio_console.rs │ │ │ ├── metrics │ │ │ │ ├── broker.rs │ │ │ │ ├── counter.rs │ │ │ │ ├── gauge.rs │ │ │ │ ├── histogram.rs │ │ │ │ └── mod.rs │ │ │ ├── runtime.rs │ │ │ ├── telemetry │ │ │ │ ├── mod.rs │ │ │ │ └── trace.rs │ │ │ ├── tools.rs │ │ │ ├── utils │ │ │ │ ├── crc.rs │ │ │ │ ├── file_utils.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── topic_util.rs │ │ │ │ └── vec_util.rs │ │ │ └── version │ │ │ │ ├── logo.rs │ │ │ │ └── mod.rs │ │ └── tests │ │ │ └── mod.rs │ ├── metadata-struct │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── acl │ │ │ │ ├── mod.rs │ │ │ │ ├── mqtt_acl.rs │ │ │ │ └── mqtt_blacklist.rs │ │ │ ├── adapter │ │ │ │ ├── mod.rs │ │ │ │ ├── read_config.rs │ │ │ │ └── record.rs │ │ │ ├── delay_info.rs │ │ │ ├── journal │ │ │ │ ├── group.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── namespace.rs │ │ │ │ ├── node_extend.rs │ │ │ │ ├── segment.rs │ │ │ │ ├── segment_meta.rs │ │ │ │ └── shard.rs │ │ │ ├── lib.rs │ │ │ ├── mqtt │ │ │ │ ├── auto_subscribe_rule.rs │ │ │ │ ├── bridge │ │ │ │ │ ├── config_kafka.rs │ │ │ │ │ ├── config_local_file.rs │ │ │ │ │ ├── connector.rs │ │ │ │ │ ├── connector_type.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── status.rs │ │ │ │ ├── cluster.rs │ │ │ │ ├── connection.rs │ │ │ │ ├── lastwill.rs │ │ │ │ ├── message.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── node_extend.rs │ │ │ │ ├── session.rs │ │ │ │ ├── subscribe_data.rs │ │ │ │ ├── topic.rs │ │ │ │ ├── topic_rewrite_rule.rs │ │ │ │ └── user.rs │ │ │ ├── placement │ │ │ │ ├── cluster.rs │ │ │ │ ├── mod.rs │ │ │ │ └── node.rs │ │ │ └── schema.rs │ │ └── tests │ │ │ └── test.rs │ ├── pprof-monitor │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── pprof_monitor.rs │ ├── rocksdb-engine │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── engine.rs │ │ │ ├── lib.rs │ │ │ └── warp.rs │ │ └── tests │ │ │ └── test.rs │ └── third-driver │ │ ├── Cargo.toml │ │ ├── src │ │ ├── lib.rs │ │ └── mysql.rs │ │ └── tests │ │ └── test.rs ├── delay-message │ ├── Cargo.toml │ ├── src │ │ ├── delay.rs │ │ ├── lib.rs │ │ ├── persist.rs │ │ ├── pop.rs │ │ └── storage │ └── tests │ │ ├── delay.rs │ │ └── mod.rs ├── grpc-clients │ ├── Cargo.toml │ ├── src │ │ ├── journal │ │ │ ├── admin │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ │ ├── inner │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── macros.rs │ │ ├── mqtt │ │ │ ├── admin │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ │ ├── inner │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ │ └── mod.rs │ │ ├── placement │ │ │ ├── inner │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ │ ├── journal │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ │ ├── kv │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── mqtt │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ │ └── openraft │ │ │ │ ├── call.rs │ │ │ │ └── mod.rs │ │ ├── pool.rs │ │ └── utils.rs │ └── tests │ │ ├── common.rs │ │ ├── journal │ │ ├── mod.rs │ │ └── update_cache.rs │ │ ├── mod.rs │ │ ├── mqtt │ │ ├── mod.rs │ │ ├── mqtt_admin_test.rs │ │ └── mqtt_connect_test.rs │ │ └── placement │ │ ├── journal │ │ ├── mod.rs │ │ ├── segment.rs │ │ └── shard.rs │ │ ├── mod.rs │ │ └── mqtt │ │ ├── cluster_test.rs │ │ ├── kv_test.rs │ │ ├── mod.rs │ │ ├── mqtt_acl_test.rs │ │ ├── mqtt_blacklist_test.rs │ │ ├── mqtt_connector_test.rs │ │ ├── mqtt_last_will_test.rs │ │ ├── mqtt_schema_test.rs │ │ ├── mqtt_session_test.rs │ │ ├── mqtt_share_sub_test.rs │ │ ├── mqtt_topic_test.rs │ │ ├── mqtt_user_test.rs │ │ └── openraft_test.rs ├── idempotent-message │ ├── Cargo.toml │ ├── src │ │ └── lib.rs │ └── tests │ │ └── mod.rs ├── journal-client │ ├── Cargo.toml │ └── src │ │ ├── async_reader.rs │ │ ├── async_writer.rs │ │ ├── cache.rs │ │ ├── client.rs │ │ ├── connection.rs │ │ ├── consts.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── option.rs │ │ ├── service.rs │ │ └── tool.rs ├── journal-server │ ├── Cargo.toml │ ├── src │ │ ├── core │ │ │ ├── cache.rs │ │ │ ├── cluster.rs │ │ │ ├── cluster_config.rs │ │ │ ├── consts.rs │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── notification.rs │ │ │ ├── segment.rs │ │ │ ├── segment_meta.rs │ │ │ ├── segment_status.rs │ │ │ ├── shard.rs │ │ │ └── test.rs │ │ ├── handler │ │ │ ├── cluster.rs │ │ │ ├── command.rs │ │ │ ├── data.rs │ │ │ ├── mod.rs │ │ │ └── shard.rs │ │ ├── index │ │ │ ├── build.rs │ │ │ ├── engine.rs │ │ │ ├── keys.rs │ │ │ ├── mod.rs │ │ │ ├── offset.rs │ │ │ ├── tag.rs │ │ │ └── time.rs │ │ ├── isr │ │ │ ├── fetch.rs │ │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── segment │ │ │ ├── file.rs │ │ │ ├── manager.rs │ │ │ ├── mod.rs │ │ │ ├── read.rs │ │ │ ├── scroll.rs │ │ │ └── write.rs │ │ └── server │ │ │ ├── connection.rs │ │ │ ├── connection_manager.rs │ │ │ ├── grpc │ │ │ ├── admin.rs │ │ │ ├── inner.rs │ │ │ ├── mod.rs │ │ │ └── server.rs │ │ │ ├── mod.rs │ │ │ ├── packet.rs │ │ │ ├── quic │ │ │ └── mod.rs │ │ │ └── tcp │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ ├── response.rs │ │ │ ├── server.rs │ │ │ ├── tcp_server.rs │ │ │ └── tls_server.rs │ └── tests │ │ ├── common.rs │ │ └── mod.rs ├── kafka-broker │ ├── Cargo.toml │ ├── src │ │ └── lib.rs │ └── tests │ │ └── mod.rs ├── message-expire │ ├── Cargo.toml │ ├── src │ │ └── lib.rs │ └── tests │ │ └── mod.rs ├── mqtt-broker │ ├── Cargo.toml │ ├── src │ │ ├── admin │ │ │ ├── acl.rs │ │ │ ├── blacklist.rs │ │ │ ├── client.rs │ │ │ ├── cluster.rs │ │ │ ├── connector.rs │ │ │ ├── mod.rs │ │ │ ├── observability.rs │ │ │ ├── query.rs │ │ │ ├── schema.rs │ │ │ ├── session.rs │ │ │ ├── subscribe.rs │ │ │ ├── topic.rs │ │ │ └── user.rs │ │ ├── bridge │ │ │ ├── core.rs │ │ │ ├── file │ │ │ │ └── mod.rs │ │ │ ├── heartbeat.rs │ │ │ ├── kafka │ │ │ │ └── mod.rs │ │ │ ├── manager.rs │ │ │ └── mod.rs │ │ ├── handler │ │ │ ├── acl.rs │ │ │ ├── cache.rs │ │ │ ├── cache_update.rs │ │ │ ├── cluster_config.rs │ │ │ ├── command.rs │ │ │ ├── connection.rs │ │ │ ├── constant.rs │ │ │ ├── content_type.rs │ │ │ ├── delay_message.rs │ │ │ ├── error.rs │ │ │ ├── flapping_detect.rs │ │ │ ├── flow_control.rs │ │ │ ├── heartbreat.rs │ │ │ ├── keep_alive.rs │ │ │ ├── lastwill.rs │ │ │ ├── message.rs │ │ │ ├── mod.rs │ │ │ ├── mqtt.rs │ │ │ ├── offline_message.rs │ │ │ ├── pkid.rs │ │ │ ├── response.rs │ │ │ ├── retain.rs │ │ │ ├── session.rs │ │ │ ├── sub_auto.rs │ │ │ ├── sub_exclusive.rs │ │ │ ├── sub_option.rs │ │ │ ├── sub_parse_topic.rs │ │ │ ├── subscribe.rs │ │ │ ├── topic.rs │ │ │ ├── topic_rewrite.rs │ │ │ ├── unsubscribe.rs │ │ │ ├── user.rs │ │ │ └── validator.rs │ │ ├── lib.rs │ │ ├── observability │ │ │ ├── metrics │ │ │ │ ├── auth.rs │ │ │ │ ├── event_metrics.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── packets.rs │ │ │ │ ├── publish.rs │ │ │ │ ├── server.rs │ │ │ │ ├── session.rs │ │ │ │ └── time.rs │ │ │ ├── mod.rs │ │ │ ├── slow │ │ │ │ ├── mod.rs │ │ │ │ ├── request.rs │ │ │ │ └── sub.rs │ │ │ ├── system_topic │ │ │ │ ├── broker.rs │ │ │ │ ├── event.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── packet │ │ │ │ │ ├── bytes.rs │ │ │ │ │ ├── messages.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── packets.rs │ │ │ │ ├── stats │ │ │ │ │ ├── client.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── route.rs │ │ │ │ │ ├── subscription.rs │ │ │ │ │ └── topics.rs │ │ │ │ ├── sysmon.rs │ │ │ │ └── warn.rs │ │ │ └── warn │ │ │ │ └── mod.rs │ │ ├── security │ │ │ ├── acl │ │ │ │ ├── auth.rs │ │ │ │ ├── metadata.rs │ │ │ │ └── mod.rs │ │ │ ├── login │ │ │ │ ├── http.rs │ │ │ │ ├── jwt.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── plaintext.rs │ │ │ │ ├── psk.rs │ │ │ │ └── x509.rs │ │ │ ├── mod.rs │ │ │ └── storage │ │ │ │ ├── mod.rs │ │ │ │ ├── mysql │ │ │ │ ├── mod.rs │ │ │ │ ├── schema.rs │ │ │ │ └── sql.sql │ │ │ │ ├── placement │ │ │ │ └── mod.rs │ │ │ │ └── redis │ │ │ │ └── mod.rs │ │ ├── server │ │ │ ├── connection.rs │ │ │ ├── connection_manager.rs │ │ │ ├── grpc │ │ │ │ ├── admin.rs │ │ │ │ ├── inner.rs │ │ │ │ ├── mod.rs │ │ │ │ └── server.rs │ │ │ ├── mod.rs │ │ │ ├── packet.rs │ │ │ ├── quic │ │ │ │ ├── client.rs │ │ │ │ ├── handler.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── quic_server_handler.rs │ │ │ │ ├── quic_stream_wrapper.rs │ │ │ │ ├── response.rs │ │ │ │ ├── server.rs │ │ │ │ └── skip_server_verification.rs │ │ │ ├── tcp │ │ │ │ ├── handler.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── response.rs │ │ │ │ ├── server.rs │ │ │ │ ├── tcp_server.rs │ │ │ │ └── tls_server.rs │ │ │ └── websocket │ │ │ │ ├── mod.rs │ │ │ │ └── server.rs │ │ ├── storage │ │ │ ├── acl.rs │ │ │ ├── auto_subscribe.rs │ │ │ ├── blacklist.rs │ │ │ ├── cluster.rs │ │ │ ├── connector.rs │ │ │ ├── message.rs │ │ │ ├── mod.rs │ │ │ ├── session.rs │ │ │ ├── topic.rs │ │ │ └── user.rs │ │ └── subscribe │ │ │ ├── common.rs │ │ │ ├── exclusive │ │ │ └── mod.rs │ │ │ ├── manager.rs │ │ │ ├── mod.rs │ │ │ ├── push.rs │ │ │ └── share │ │ │ ├── follower.rs │ │ │ ├── leader.rs │ │ │ ├── mod.rs │ │ │ └── write.rs │ └── tests │ │ ├── mod.rs │ │ └── server │ │ ├── mod.rs │ │ └── quic │ │ ├── mod.rs │ │ ├── packet_handler.rs │ │ ├── quic_common.rs │ │ └── quic_connect_test.rs ├── placement-center │ ├── Cargo.toml │ ├── src │ │ ├── core │ │ │ ├── cache.rs │ │ │ ├── cluster.rs │ │ │ ├── controller.rs │ │ │ ├── error.rs │ │ │ ├── heartbeat.rs │ │ │ ├── metrics.rs │ │ │ ├── mod.rs │ │ │ └── schema.rs │ │ ├── inner │ │ │ ├── mod.rs │ │ │ └── services.rs │ │ ├── journal │ │ │ ├── cache.rs │ │ │ ├── controller │ │ │ │ ├── call_node.rs │ │ │ │ ├── gc.rs │ │ │ │ ├── mod.rs │ │ │ │ └── preferred_election.rs │ │ │ ├── mod.rs │ │ │ └── services │ │ │ │ ├── mod.rs │ │ │ │ ├── segment.rs │ │ │ │ └── shard.rs │ │ ├── kv │ │ │ ├── mod.rs │ │ │ └── services.rs │ │ ├── lib.rs │ │ ├── mqtt │ │ │ ├── cache.rs │ │ │ ├── connector │ │ │ │ ├── mod.rs │ │ │ │ ├── scheduler.rs │ │ │ │ └── status.rs │ │ │ ├── controller │ │ │ │ ├── call_broker.rs │ │ │ │ ├── message_expire.rs │ │ │ │ ├── mod.rs │ │ │ │ └── session_expire.rs │ │ │ ├── mod.rs │ │ │ └── services │ │ │ │ ├── acl.rs │ │ │ │ ├── connector.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── session.rs │ │ │ │ ├── share_sub.rs │ │ │ │ ├── subscribe.rs │ │ │ │ ├── topic.rs │ │ │ │ └── user.rs │ │ ├── raft │ │ │ ├── error.rs │ │ │ ├── leadership.rs │ │ │ ├── mod.rs │ │ │ ├── network │ │ │ │ ├── connection.rs │ │ │ │ ├── mod.rs │ │ │ │ └── network.rs │ │ │ ├── raft_node.rs │ │ │ ├── route │ │ │ │ └── mod.rs │ │ │ ├── services.rs │ │ │ ├── store │ │ │ │ ├── log_store.rs │ │ │ │ ├── mod.rs │ │ │ │ └── state_machine_store.rs │ │ │ └── typeconfig.rs │ │ ├── route │ │ │ ├── apply.rs │ │ │ ├── common.rs │ │ │ ├── data.rs │ │ │ ├── journal.rs │ │ │ ├── kv.rs │ │ │ ├── mod.rs │ │ │ └── mqtt.rs │ │ ├── server │ │ │ ├── grpc │ │ │ │ ├── mod.rs │ │ │ │ ├── server.rs │ │ │ │ ├── service_inner.rs │ │ │ │ ├── service_journal.rs │ │ │ │ ├── service_kv.rs │ │ │ │ ├── service_mqtt.rs │ │ │ │ └── service_openraft.rs │ │ │ └── mod.rs │ │ └── storage │ │ │ ├── engine.rs │ │ │ ├── journal │ │ │ ├── mod.rs │ │ │ ├── segment.rs │ │ │ ├── segment_meta.rs │ │ │ └── shard.rs │ │ │ ├── keys.rs │ │ │ ├── mod.rs │ │ │ ├── mqtt │ │ │ ├── acl.rs │ │ │ ├── blacklist.rs │ │ │ ├── connector.rs │ │ │ ├── lastwill.rs │ │ │ ├── mod.rs │ │ │ ├── session.rs │ │ │ ├── subscribe.rs │ │ │ ├── topic.rs │ │ │ └── user.rs │ │ │ ├── placement │ │ │ ├── cluster.rs │ │ │ ├── config.rs │ │ │ ├── idempotent.rs │ │ │ ├── kv.rs │ │ │ ├── mod.rs │ │ │ ├── node.rs │ │ │ ├── offset.rs │ │ │ └── schema.rs │ │ │ └── rocksdb.rs │ └── tests │ │ └── mod.rs ├── protocol │ ├── Cargo.toml │ ├── build.rs │ ├── src │ │ ├── amqp │ │ │ ├── codec.rs │ │ │ └── mod.rs │ │ ├── broker_mqtt │ │ │ └── mod.rs │ │ ├── journal_server │ │ │ ├── codec.rs │ │ │ └── mod.rs │ │ ├── kafka │ │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── mqtt │ │ │ ├── codec.rs │ │ │ ├── common.rs │ │ │ ├── mod.rs │ │ │ ├── mqttv4 │ │ │ │ ├── codec.rs │ │ │ │ ├── connack.rs │ │ │ │ ├── connect.rs │ │ │ │ ├── disconnect.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── ping.rs │ │ │ │ ├── puback.rs │ │ │ │ ├── pubcomp.rs │ │ │ │ ├── publish.rs │ │ │ │ ├── pubrec.rs │ │ │ │ ├── pubrel.rs │ │ │ │ ├── suback.rs │ │ │ │ ├── subscribe.rs │ │ │ │ ├── unsuback.rs │ │ │ │ └── unsubscribe.rs │ │ │ └── mqttv5 │ │ │ │ ├── auth.rs │ │ │ │ ├── codec.rs │ │ │ │ ├── connack.rs │ │ │ │ ├── connect.rs │ │ │ │ ├── disconnect.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── ping.rs │ │ │ │ ├── puback.rs │ │ │ │ ├── pubcomp.rs │ │ │ │ ├── publish.rs │ │ │ │ ├── pubrec.rs │ │ │ │ ├── pubrel.rs │ │ │ │ ├── suback.rs │ │ │ │ ├── subscribe.rs │ │ │ │ ├── unsuback.rs │ │ │ │ └── unsubscribe.rs │ │ └── placement_center │ │ │ └── mod.rs │ └── tests │ │ └── mqtt_frame.rs ├── robustmq-macro │ ├── Cargo.toml │ ├── src │ │ ├── lib.rs │ │ ├── parse.rs │ │ └── validate_req.rs │ └── tests │ │ ├── expand.rs │ │ └── validate_req │ │ └── expand │ │ ├── success.expanded.rs │ │ └── success.rs ├── schema-register │ ├── Cargo.toml │ ├── src │ │ ├── avro.rs │ │ ├── json.rs │ │ ├── lib.rs │ │ ├── protobuf.rs │ │ └── schema.rs │ └── tests │ │ └── mod.rs └── storage-adapter │ ├── Cargo.toml │ ├── src │ ├── journal │ │ ├── mod.rs │ │ └── offset.rs │ ├── lib.rs │ ├── memory │ │ └── mod.rs │ ├── minio │ │ └── mod.rs │ ├── mysql │ │ ├── mod.rs │ │ └── sql.sql │ ├── placement │ │ └── mod.rs │ ├── rocksdb │ │ └── mod.rs │ ├── s3 │ │ └── mod.rs │ └── storage.rs │ └── tests │ └── mod.rs └── tests ├── Cargo.toml ├── src ├── lib.rs └── mqtt_build_tool │ ├── build_connack.rs │ ├── build_connect.rs │ └── mod.rs └── tests ├── journal_client ├── client_test.rs ├── common.rs ├── mod.rs ├── segment_scroll_test.rs └── segment_status_test.rs ├── journal_server ├── base_test.rs ├── common.rs ├── data_test.rs ├── grpc_admin.rs └── mod.rs ├── mod.rs ├── mqtt_client ├── flapping_detect_test.rs ├── mod.rs ├── offline_message_test.rs ├── slow_sub_test.rs └── system_alarm_test.rs ├── mqtt_protocol ├── acl_test.rs ├── blacklist_test.rs ├── common.rs ├── connect5_test.rs ├── connect_packet_size_test.rs ├── connect_test.rs ├── content_type_test.rs ├── delay_publish_test.rs ├── flapping_detect_test.rs ├── keep_alive_test.rs ├── lastwill_message_test.rs ├── mod.rs ├── qos_test.rs ├── req_resp_test.rs ├── retain_message_test.rs ├── schema_test.rs ├── session_expire.rs ├── share_sub_test.rs ├── sub_auto.rs ├── sub_exclusive_test.rs ├── sub_identifier_test.rs ├── sub_options_test.rs ├── sub_wildcards_test.rs ├── topic_alias_test.rs ├── topic_rewrite_test.rs ├── user_properties_test.rs └── user_test.rs ├── mqtt_server ├── cluster_storage_test.rs ├── example │ └── slow_sub.log ├── mod.rs ├── observability │ ├── mod.rs │ └── slow_sub_test.rs ├── session_storage_test.rs ├── topic_rewrite_rule_test.rs ├── topic_storage_test.rs └── user_storage_test.rs └── place_server ├── broker_heartbeat_test.rs ├── cluster_node_test.rs ├── common.rs ├── grpc_clients_test.rs ├── kv_storage_test.rs ├── mod.rs ├── share_sub.rs └── topic_rewrite_rule.rs /.config/nextest.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [profile.default] 16 | slow-timeout="1m" 17 | 18 | [profile.ci] 19 | slow-timeout = { period = "60s", terminate-after = 3, grace-period = "10s" } 20 | 21 | [profile.ci.junit] 22 | path = 'junit.xml' 23 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | target/* 2 | logs/* 3 | build/* -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.rs text diff=rust eol=lf 3 | *.toml text diff=toml eol=lf 4 | 5 | # Force bash scripts to always use LF line endings so that if a repo is accessed 6 | # in Unix via a file share from Windows, the scripts will work. 7 | *.sh text eol=lf 8 | 9 | # Force batch scripts to always use CRLF line endings so that if a repo is accessed 10 | # in Windows via a file share from Linux, the scripts will work. 11 | *.{cmd,[cC][mM][dD]} text eol=crlf 12 | *.{bat,[bB][aA][tT]} text eol=crlf 13 | 14 | Cargo.lock text 15 | /bin/* text eol=lf 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | blank_issues_enabled: false 16 | contact_links: 17 | - name: Robust Community Slack 18 | url: https://app.slack.com/client/T07MFH344Q7/C07MPETNHAA 19 | about: Get free help from the Robust community 20 | -------------------------------------------------------------------------------- /.github/doc-label-config.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | Doc not needed: 16 | - '- \[x\] This PR does not require documentation updates.' 17 | Doc update required: 18 | - '- \[ \] This PR does not require documentation updates.' 19 | -------------------------------------------------------------------------------- /.github/pr-title-breaking-change-label-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "LABEL": { 3 | "name": "breaking change", 4 | "color": "D93F0B" 5 | }, 6 | "CHECKS": { 7 | "regexp": "^(?:(?!!:).)*$", 8 | "ignoreLabels": [ 9 | "ignore-title" 10 | ], 11 | "alwaysPassCI": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.github/pr-title-checker-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "LABEL": { 3 | "name": "Invalid PR Title", 4 | "color": "B60205" 5 | }, 6 | "CHECKS": { 7 | "regexp": "^(feat|fix|test|refactor|chore|style|docs|perf|build|ci|revert)(\\(.*\\))?\\!?:.*", 8 | "ignoreLabels": [ 9 | "ignore-title" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## What's changed and what's your intention? 2 | 3 | _PLEASE DO NOT LEAVE THIS EMPTY !!!_ 4 | 5 | Please explain IN DETAIL what the changes are in this PR and why they are needed: 6 | 7 | - Summarize your change (**mandatory**) 8 | - How does this PR work? Need a brief introduction for the changed logic (optional) 9 | - Describe clearly one logical change and avoid lazy messages (optional) 10 | - Describe any limitations of the current code (optional) 11 | 12 | ## Checklist 13 | 14 | - [ ] I have written the necessary rustdoc comments. 15 | - [ ] I have added the necessary unit tests and integration tests. 16 | - [ ] This PR does not require documentation updates. 17 | 18 | ## Refer to a related PR or issue link 19 | Please associate a related Issue, which can help reviewers better understand your intent. 20 | You can refer to the [GitHub Contribution Guide](https://robustmq.com/ContributionGuide/GitHub-Contribution-Guide.html) 21 | to submit the corresponding Issue.It also has an [PR Example](https://robustmq.com/ContributionGuide/Pull-Request-Example.html) to 22 | help you submit PR. 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | src/cmd/target 3 | build 4 | .vscode 5 | ./log 6 | .DS_Store 7 | log/* 8 | src/rlog/log/server.log 9 | logs 10 | nohup.out 11 | .idea 12 | /precommit_venv/ 13 | robust-data* 14 | process_logs 15 | /docs/.vitepress/dist/ 16 | /docs/.vitepress/cache/ 17 | /node_modules/ 18 | **/node_modules/ 19 | jn-1.log 20 | pc-1.log 21 | config/log-config/mqtt-tracing.toml 22 | config/log-config/place-tracing.toml 23 | -------------------------------------------------------------------------------- /.requirements-precommit.txt: -------------------------------------------------------------------------------- 1 | pre-commit==3.5.0 2 | -------------------------------------------------------------------------------- /_typos.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [default.extend-identifiers-re] 16 | 17 | 18 | [default.extend-words] 19 | # This words is a spelling error for paho-mqtt package. 20 | # we need to ignore it. 21 | Identifer = "Identifer" 22 | 23 | 24 | [files] 25 | extend-exclude = [] 26 | -------------------------------------------------------------------------------- /benches/test.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /bin/robust-bench: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2023 RobustMQ Team 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | workdir=$(cd $(dirname $0); pwd) 16 | ${workdir}/../libs/cli-bench $@ 17 | -------------------------------------------------------------------------------- /bin/robust-ctl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2023 RobustMQ Team 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | workdir=$(cd $(dirname $0); pwd) 16 | ${workdir}/../libs/cli-command $@ -------------------------------------------------------------------------------- /codecheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2023 RobustMQ Team 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | hawkeye format 17 | cargo fmt --all 18 | cargo fmt --all -- --check 19 | cargo clippy --all-targets --all-features --tests --benches -- -D warnings 20 | cargo-deny check licenses 21 | -------------------------------------------------------------------------------- /config/example/mqtt-server.toml.example: -------------------------------------------------------------------------------- 1 | cluster_name = "mqtt-broker" 2 | broker_id = 1 3 | grpc_port = 9981 4 | http_port = 9982 5 | placement_center = ["127.0.0.1:1228"] 6 | 7 | [network] 8 | tcp_port = 1883 9 | tcps_port = 8883 10 | websocket_port = 8083 11 | websockets_port = 8084 12 | quic_port = 9083 13 | tls_cert = "./config/certs/cert.pem" 14 | tls_key = "./config/certs/key.pem" 15 | 16 | [tcp_thread] 17 | accept_thread_num = 1 18 | handler_thread_num = 1 19 | response_thread_num = 1 20 | max_connection_num = 1000 21 | request_queue_size = 2000 22 | response_queue_size = 2000 23 | lock_max_try_mut_times = 30 24 | lock_try_mut_sleep_time_ms = 50 25 | 26 | [system] 27 | runtime_worker_threads = 128 28 | default_user = "admin" 29 | default_password = "pwd123" 30 | 31 | [storage] 32 | #type = 'journal' 33 | #journal_addr = [] 34 | storage_type = "memory" 35 | 36 | 37 | [log] 38 | log_path = "/tmp/logs" 39 | log_segment_size = 1073741824 40 | log_file_num = 50 41 | -------------------------------------------------------------------------------- /config/log-config/journal-tracing.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [stdout] 16 | kind = "Console" 17 | level = "Info" 18 | 19 | [server] 20 | kind = "RollingFile" 21 | level = "Info" 22 | rotation = "Minutely" 23 | directory = "./logs/tests" 24 | prefix = "journal-server-" 25 | suffix = "log" 26 | max_log_files = 10 27 | -------------------------------------------------------------------------------- /config/log-config/place-tracing.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [stdout] 16 | kind = "Console" 17 | level = "Info" 18 | 19 | [server] 20 | kind = "RollingFile" 21 | level = "Info" 22 | rotation = "Minutely" 23 | directory = "./logs/tests" 24 | prefix = "place-server-" 25 | suffix = "log" 26 | max_log_files = 10 27 | 28 | ## Uncomment the section below to enable troubleshooting with `tokio-console`. 29 | # [tokio_console] 30 | # kind = "TokioConsole" 31 | # bind = "127.0.0.1:5674" 32 | -------------------------------------------------------------------------------- /docs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/.DS_Store -------------------------------------------------------------------------------- /docs/.design/logic/flapping-detect.md: -------------------------------------------------------------------------------- 1 | # 不涉及删除结构体 2 | 构建一个结构体 3 | create a struct 4 | ```rust 5 | struct FlappingDetectCondition { 6 | client_id: u64, 7 | connect_times: u8, 8 | first_request_time: u64, 9 | } 10 | ``` 11 | 12 | 获取当前的时间作为最近请求时间`current_request_time` 13 | 获取当前的请求次数`current_counter` 14 | 15 | 从Map中获取对应`client-id`的结构信息`FlappingDetectCondition`,如果没有的情况下 16 | 我们需要自己构建`FlappingDetectCondition`, 并将`FlappingDetectCondition`放入map中 17 | 18 | 如果`current_request_time` - `request_time` < `windows_time` 并且 19 | `counter` - `connect_count` > `max_count`: 20 | 将对应的client_id放入到黑名单当中,并指定封禁时间 21 | > 这里的两个校验分别是:是否在窗口时间内以及是否超过窗口时间内的最大连接次数 22 | 23 | 24 | # 定时清理map 25 | ## 目的 26 | 设定一个线程定时对map进行清理,防止map过大 27 | 28 | ## 核心逻辑 29 | 30 | 线程会在窗口时间触发后执行,主要的执行逻辑如下: 31 | 清理时间和首次请求时间已经大于当前的时间窗口了,此时就可以进行清理操作 32 | -------------------------------------------------------------------------------- /docs/.design/logic/pub-sub-cli.md: -------------------------------------------------------------------------------- 1 | 1. publish 2 | 3 | 使用clap解析命令行参数 4 | 5 | ```rust 6 | #[derive(Clone, Debug, PartialEq)] 7 | pub struct PublishArgsRequest { 8 | pub topic: String, 9 | pub qos: i32, 10 | pub retained: bool, 11 | pub username: String, 12 | pub password: String, 13 | } 14 | 15 | ``` 16 | 实现发布命令 17 | 18 | ```bash 19 | cargo run --package cmd --bin cli-command -- mqtt --server=127.0.0.1:1883 publish --username=admin --password=pwd123 --topic=test/topic1 --qos=0 20 | ``` 21 | 启动异步运行时 `loop` + `select` 读取用户 `stdin` 键盘输出数据,循环发送到 broker,并且监听 `CTR+C` 退出程序主动关闭MQTT连接 22 | 23 | 24 | 25 | 26 | 2. 定义消息发布和订阅的逻辑 27 | 28 | ```bash 29 | cargo run --package cmd --bin cli-command -- mqtt --server=127.0.0.1:1883 subscribe --username=admin --password=pwd123 --topic=test/topic1 --qos=0 30 | ``` 31 | 核心逻辑同步循环接收message,异步监听`CTR+C` 退出程序,关闭MQTT连接,并且显示退出信息 32 | ```rust 33 | while let Some(msg) = rx.iter().next() { 34 | } 35 | ``` 36 | -------------------------------------------------------------------------------- /docs/.design/plan/mqtt-all-feature.md: -------------------------------------------------------------------------------- 1 | ## MQTT 功能 2 | 1. MQTT 3.1/3.1.1/5.0 全部功能 3 | 2. MQTT Over Quic 功能 4 | 3. 共享订阅 5 | 4. 排他订阅 6 | 5. 延迟发布 7 | 6. 自动订阅 8 | 7. 主题重写 9 | 8. 离线消息 10 | 9. Schema/消息编解码 11 | 10. 消息验证 12 | 11. 数据集成 13 | - Local File 14 | - Kafka 15 | - RocketMQ 16 | 12. 故障排查 17 | 1. 慢订阅统计 18 | 2. 日志追踪 19 | 13. 云原生部署 20 | 14. 集群架构。水平扩展性,可用性,可靠性,吞吐量,延迟,SLA 21 | 15. MQTT Over TCP/TLS/WebSocket/WebSockets/QUIC 22 | 16. 安全 23 | - 认证 24 | - 授权 25 | - 黑名单 26 | - 连接抖动 27 | 17. 可观测性 28 | - 指标 29 | - trace 30 | - 集成 promethrus 31 | 32 | ## MQTT 5 33 | 1. TCP、TCPS、WebSocket,WebSockets 34 | 2. 保留消息 35 | 3. 遗嘱消息 36 | 4. 请求相应 37 | 5. 用户属性 38 | 6. 主题别名 39 | 7. 载荷格式指示与内容类型 40 | 8. 共享订阅 41 | 9. 订阅选项 42 | 10. 订阅标识符 43 | 11. 保持连接 44 | 12. 消息过期间隔 45 | 13. 最大报文大小 46 | 14. 错误码 47 | 15. Auth 48 | 16. ACL -------------------------------------------------------------------------------- /docs/.design/user-draft/flapping-detect.md: -------------------------------------------------------------------------------- 1 | # 连接抖动功能用户文档 2 | ## 功能介绍 3 | RobustMQ支持自动封禁那些被检测到短时间内频繁登录的客户端, 4 | 并且在一段时间内拒绝这些客户端的登录, 5 | 以避免此类客户端过多占用服务器资源而影响其他客户端的正常使用。 6 | 7 | 对于连接抖动检测功能当前只会封禁客户端 ID, 8 | 并不封禁用户名和 IP 地址, 9 | 即该机器只要更换客户端的ID后依然能够继续登录。 10 | 11 | 抖动检测功能默认关闭,您可以通过命令行开启对应的抖动检测功能, 12 | 配置文件支持连接抖动检测暂未支持。 13 | 14 | ## 如何使用连接抖动检测 15 | ### 通过命令行开启连接抖动检测功能 16 | 我们通过如下命令启用连接抖动检测功能 17 | ```shell 18 | robust-cli mqtt flapping-detect --enable=true 19 | ``` 20 | 默认情况下拥有三个相关的参数内容: 21 | - 检测时间窗口: 您可以指定系统监视客户端抖动行为的持续时间。默认值为`1`分钟。 22 | - 最大断连次数: 您可以指定在检测窗口时间内允许的`MQTT`客户端的最大断开连接次数。 23 | 它允许您设定准确的标准来识别和响应表现出抖动行为的客户端。 24 | 默认值为`15`。 25 | - 封禁时长: 您可以指定客户端被封禁的时间长度。默认值为`5`分钟。 26 | 27 | 您可以通过如下的命令修改上述的几个命令配置: 28 | - 修改检测时间窗口(默认单位为分钟) 29 | ```shell 30 | roubst-cli mqtt flapping-detect --window-time=1 31 | ``` 32 | - 修改最大断连次数 33 | ```shell 34 | roubst-cli mqtt flapping-detect --max-client-connections=15 35 | ``` 36 | - 修改封禁时长 37 | ```shell 38 | roubst-cli mqtt flapping-detect --ban-time=5 39 | ``` 40 | - 修改设置单位(是否考虑) 41 | ```shell 42 | roubst-cli mqtt flapping-detect --time-unit=seconds/minutes/hours/days/months 43 | ``` 44 | ### TODO 配置文件支持连接抖动检测 45 | -------------------------------------------------------------------------------- /docs/.vitepress/config.mts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "vitepress"; 2 | 3 | 4 | import {docsConfig} from "./src/docs.mts"; 5 | 6 | import {themeConfig} from "./src/theme.mts"; 7 | 8 | import {head} from "./src/head.mts"; 9 | 10 | 11 | import {enConfig} from './src/configs/en.mts'; 12 | 13 | import {zhConfig} from './src/configs/zh.mts'; 14 | 15 | export default defineConfig({ 16 | 17 | rewrites: { 18 | 'en/:rest*': ':rest*' 19 | }, 20 | 21 | locales: { 22 | 23 | root: {label: 'English', lang: 'en', dir: 'en', ...enConfig}, 24 | 25 | zh: {label: '简体中文', lang: 'zh', dir: 'zh', ...zhConfig}, 26 | 27 | }, 28 | 29 | /* 文档配置 */ 30 | 31 | ...docsConfig, 32 | 33 | /* 标头配置 */ 34 | 35 | head, 36 | 37 | /* 主题配置 */ 38 | 39 | themeConfig, 40 | 41 | /* 语言配置 */ 42 | 43 | 44 | }); 45 | -------------------------------------------------------------------------------- /docs/.vitepress/src/configs/en.mts: -------------------------------------------------------------------------------- 1 | import type {DefaultTheme, LocaleSpecificConfig} from 'vitepress' 2 | 3 | //引入以上配置 是英文界面需要修改zh为en 4 | 5 | import getNavs from "../nav/en.mts"; 6 | 7 | import {sidebar} from '../sidebars/en.mts' 8 | 9 | export const enConfig: LocaleSpecificConfig = { 10 | 11 | themeConfig: { 12 | 13 | 14 | logo: "/logo.png", 15 | 16 | nav: getNavs(), 17 | 18 | sidebar, 19 | 20 | outline: { 21 | 22 | level: "deep", // 右侧大纲标题层级 23 | 24 | label: "content", // 右侧大纲标题文本配置 25 | 26 | }, 27 | 28 | socialLinks: [ 29 | {icon: 'github', link: 'https://github.com/robustmq/robustmq'} 30 | ] 31 | 32 | }, 33 | 34 | } 35 | -------------------------------------------------------------------------------- /docs/.vitepress/src/configs/zh.mts: -------------------------------------------------------------------------------- 1 | import type {DefaultTheme, LocaleSpecificConfig} from 'vitepress' 2 | 3 | //引入以上配置 是英文界面需要修改zh为en 4 | 5 | import getNavs from "../nav/zh.mts"; 6 | 7 | import {sidebar} from '../sidebars/zh.mjs' 8 | 9 | export const zhConfig: LocaleSpecificConfig = { 10 | 11 | themeConfig: { 12 | 13 | logo: "/logo.png", 14 | 15 | nav: getNavs(), 16 | 17 | sidebar, 18 | 19 | outline: { 20 | 21 | level: "deep", // 右侧大纲标题层级 22 | 23 | label: "目录", // 右侧大纲标题文本配置 24 | 25 | }, 26 | 27 | socialLinks: [ 28 | {icon: 'github', link: 'https://github.com/robustmq/robustmq'} 29 | ] 30 | 31 | }, 32 | 33 | } 34 | -------------------------------------------------------------------------------- /docs/.vitepress/src/docs.mts: -------------------------------------------------------------------------------- 1 | export const docsConfig = { 2 | 3 | title: "RobustMQ", 4 | 5 | description: "Next-generation high-performance cloud-native converged message queue。", 6 | 7 | }; 8 | -------------------------------------------------------------------------------- /docs/.vitepress/src/head.mts: -------------------------------------------------------------------------------- 1 | import type { HeadConfig } from "vitepress"; 2 | 3 | export const head: HeadConfig[] = [ 4 | ['link', { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], // 添加 favicon 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/.vitepress/src/nav/en.mts: -------------------------------------------------------------------------------- 1 | import type { DefaultTheme } from "vitepress"; 2 | 3 | export default function getNavs() { 4 | 5 | return [ 6 | 7 | { text: "Home", link: "/" }, 8 | 9 | ] 10 | 11 | }; 12 | -------------------------------------------------------------------------------- /docs/.vitepress/src/nav/zh.mts: -------------------------------------------------------------------------------- 1 | import type {DefaultTheme} from "vitepress"; 2 | 3 | export default function getNavs() { 4 | 5 | return [ 6 | 7 | {text: "主页", link: "/"}, 8 | 9 | ] 10 | 11 | }; 12 | -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | robustmq.com 2 | -------------------------------------------------------------------------------- /docs/en/Architect/Design-Documentation.md: -------------------------------------------------------------------------------- 1 | 2 | [Check out the RobustMQ for detailed design documentation](https://docs.google.com/document/d/1uU5mbyqi8hLiL1Ypve5mZWUMFBrr9A1THIYganbRo38/edit?tab=t.ilgcq12vz3ni) -------------------------------------------------------------------------------- /docs/en/Architect/Terminology.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/en/Architect/Terminology.md -------------------------------------------------------------------------------- /docs/en/ContributionGuide/ContributingCode/Cargo-Running.md: -------------------------------------------------------------------------------- 1 | # Running with Cargo 2 | 3 | 1. **Run standalone by placement-center** 4 | 5 | ``` 6 | cargo run --package cmd --bin placement-center -- --conf=config/placement-center.toml 7 | ``` 8 | 9 | If the following output is displayed, it indicates that the placement-center has started successfully: 10 | ![image](../../../images/Cargo-Running-1.png) 11 | 12 | 2. **Run standalone by mqtt-server** 13 | 14 | ``` 15 | cargo run --package cmd --bin mqtt-server -- --conf=config/mqtt-server.toml 16 | ``` 17 | 18 | If the following output is displayed, it indicates that the mqtt-server has started successfully:![Cargo-Running-run-mqtt-server-2.png](../../../images/Cargo-Running-run-mqtt-server-2.png) 19 | 20 | 21 | 3. **Run standalone by journal-server** 22 | 23 | ``` 24 | cargo run --package cmd --bin journal-server -- --conf=config/journal-server.toml 25 | ``` 26 | The following output indicates that the journal-server has started successfully: 27 | ![Cargo-Running-run-journal-server-3.png](../../../images/Cargo-Running-run-journal-server-3.png) 28 | -------------------------------------------------------------------------------- /docs/en/ContributionGuide/ContributingCode/VsCode-Running.md: -------------------------------------------------------------------------------- 1 | # Running in VSCode 2 | 3 | 1. **Download the Project Code** 4 | - Clone the project repository to your local machine. 5 | 6 | 2. **Initialize the Environment** 7 | - Ensure that all necessary dependencies and tools are installed and configured. 8 | 9 | 3. **Navigate to the `src/cmd/src` Directory** 10 | - You will see the following structure: 11 | ``` 12 | . 13 | ├── journal-server 14 | │ └── server.rs 15 | ├── mqtt-server 16 | │ └── server.rs 17 | └── placement-center 18 | └── server.rs 19 | ``` 20 | 21 | 4. **Open the Corresponding Component Directory** 22 | - Open the `server.rs` file in the directory of the component you want to run. You will see the `main` function as shown in the figure below: 23 | 24 | ![image](../../../images/VSCode-Running-1.png) 25 | 26 | - Start the service as needed. 27 | -------------------------------------------------------------------------------- /docs/en/ContributionGuide/ContributingDoc/Build-Doc-Env.md: -------------------------------------------------------------------------------- 1 | # How to Build the Documentation Environment 2 | 3 | RobustMQ uses [VitePress](https://vitepress.dev/) to build its documentation system. If you need to modify the 4 | configuration, you can refer to the [VitePress documentation](https://vitepress.dev/guide/getting-started) to help 5 | improve the documentation build for RobustMQ. 6 | 7 | ## Mac / Windows 8 | 9 | ### Prerequisites 10 | 11 | You need to have the `node` environment installed. 12 | 13 | - macOS users can install Node.js via `brew`: 14 | 15 | ```shell 16 | brew install node 17 | ``` 18 | 19 | - Windows users can install Node.js from the official [Node.js](https://nodejs.org/en/download/) website. 20 | 21 | ### Steps 22 | 23 | 1. Install the packages required by `VitePress` using the following command: 24 | 25 | ```shell 26 | npm install 27 | ``` 28 | 29 | 2. Start local development with the following command: 30 | 31 | ```shell 32 | npm run docs:dev 33 | ``` 34 | 35 | 3. Open the local link, and the final result should look like this: 36 | 37 | ![image](../../../images/Build-Doc-Env-1.png) 38 | -------------------------------------------------------------------------------- /docs/en/Getting-Started/Overview.md: -------------------------------------------------------------------------------- 1 | RobustMQ supports two modes: Standalone and Cluster. It requires the startup of two components: the Placement Center and the Broker Server. 2 | -------------------------------------------------------------------------------- /docs/en/OverView/Good-First-Issue.md: -------------------------------------------------------------------------------- 1 | [Check out the RobustMQ Good First Issue](https://docs.google.com/document/d/10DBQ1JWfPxGY_5vYfJO5reyF6USqgxIvygWA-FPDDfg/edit?tab=t.0#heading=h.99o3501f8vh2) 2 | -------------------------------------------------------------------------------- /docs/en/OverView/MQTT-Release.md: -------------------------------------------------------------------------------- 1 | 2 | https://docs.google.com/document/d/1-7vd2logTQsyhi1bDo-5vNThigVvM5fMdAoZAgWcGgs/edit?tab=t.0#heading=h.pbzy95ej8kib -------------------------------------------------------------------------------- /docs/en/QuickGuide/mqtt/MQTT-test.md: -------------------------------------------------------------------------------- 1 | ## User List 2 | 3 | ```console 4 | % bin/robust-ctl mqtt user list 5 | +----------+--------------+ 6 | | username | is_superuser | 7 | +----------+--------------+ 8 | | admin | true | 9 | +----------+--------------+ 10 | ``` 11 | 12 | ## Pub Message 13 | 14 | ```console 15 | % bin/robust-ctl mqtt --server=127.0.0.1:1883 publish --username=admin --password=pwd123 --topic=test/topic1 --qos=0 16 | able to connect: "127.0.0.1:1883" 17 | you can post a message on the terminal: 18 | 1 19 | > You typed: 1 20 | 2 21 | > You typed: 2 22 | 3 23 | > You typed: 3 24 | 4 25 | > You typed: 4 26 | 5 27 | > You typed: 5 28 | ^C> Ctrl+C detected, Please press ENTER to end the program. 29 | ``` 30 | 31 | ## Sub Message 32 | 33 | ```console 34 | % bin/robust-ctl mqtt --server=127.0.0.1:1883 subscribe --username=admin --password=pwd123 --topic=test/topic1 --qos=0 35 | able to connect: "127.0.0.1:1883" 36 | subscribe success 37 | payload: 1 38 | payload: 2 39 | payload: 3 40 | payload: 4 41 | payload: 5 42 | ^C Ctrl+C detected, Please press ENTER to end the program. 43 | End of input stream. 44 | ``` 45 | -------------------------------------------------------------------------------- /docs/en/RobustMQ-Command/Journal Server.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/en/RobustMQ-Command/Journal Server.md -------------------------------------------------------------------------------- /docs/en/RobustMQ-Kafka/Overview.md: -------------------------------------------------------------------------------- 1 | # 2 | RobustMQ is launching RobustMQ Kafka soon. Stay tuned 3 | -------------------------------------------------------------------------------- /docs/en/RobustMQ-MQTT/Dashboard.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/en/RobustMQ-MQTT/Dashboard.md -------------------------------------------------------------------------------- /docs/en/VersionRecord/0.1.0-beta.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/en/VersionRecord/0.1.0-beta.md -------------------------------------------------------------------------------- /docs/en/VersionRecord/Summary-2024.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/en/VersionRecord/Summary-2024.md -------------------------------------------------------------------------------- /docs/images/Build-Doc-Env-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/Build-Doc-Env-1.png -------------------------------------------------------------------------------- /docs/images/Cargo-Running-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/Cargo-Running-1.png -------------------------------------------------------------------------------- /docs/images/Cargo-Running-run-journal-server-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/Cargo-Running-run-journal-server-3.png -------------------------------------------------------------------------------- /docs/images/Cargo-Running-run-mqtt-server-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/Cargo-Running-run-mqtt-server-2.png -------------------------------------------------------------------------------- /docs/images/DocContributionGuide-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/DocContributionGuide-1.png -------------------------------------------------------------------------------- /docs/images/DocContributionGuide-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/DocContributionGuide-2.png -------------------------------------------------------------------------------- /docs/images/DocContributionGuide-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/DocContributionGuide-3.png -------------------------------------------------------------------------------- /docs/images/GithubContributionGuide-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/GithubContributionGuide-1.png -------------------------------------------------------------------------------- /docs/images/GithubContributionGuide-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/GithubContributionGuide-2.png -------------------------------------------------------------------------------- /docs/images/GithubContributionGuide-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/GithubContributionGuide-3.png -------------------------------------------------------------------------------- /docs/images/GithubContributionGuide-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/GithubContributionGuide-4.png -------------------------------------------------------------------------------- /docs/images/GithubContributionGuide-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/GithubContributionGuide-5.png -------------------------------------------------------------------------------- /docs/images/VSCode-Running-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/VSCode-Running-1.png -------------------------------------------------------------------------------- /docs/images/WechatGroup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/WechatGroup.jpg -------------------------------------------------------------------------------- /docs/images/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/dashboard.png -------------------------------------------------------------------------------- /docs/images/doc-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image.png -------------------------------------------------------------------------------- /docs/images/doc-image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image1.png -------------------------------------------------------------------------------- /docs/images/doc-image11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image11.png -------------------------------------------------------------------------------- /docs/images/doc-image12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image12.png -------------------------------------------------------------------------------- /docs/images/doc-image13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image13.png -------------------------------------------------------------------------------- /docs/images/doc-image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image2.png -------------------------------------------------------------------------------- /docs/images/doc-image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image3.png -------------------------------------------------------------------------------- /docs/images/doc-image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image4.png -------------------------------------------------------------------------------- /docs/images/doc-image5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/doc-image5.png -------------------------------------------------------------------------------- /docs/images/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/image-1.png -------------------------------------------------------------------------------- /docs/images/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/image-2.png -------------------------------------------------------------------------------- /docs/images/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/image-3.png -------------------------------------------------------------------------------- /docs/images/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/image-4.png -------------------------------------------------------------------------------- /docs/images/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/image-5.png -------------------------------------------------------------------------------- /docs/images/mqttx-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/mqttx-2.png -------------------------------------------------------------------------------- /docs/images/mqttx01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/mqttx01.png -------------------------------------------------------------------------------- /docs/images/robustmq-architecture-journal-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/robustmq-architecture-journal-server.png -------------------------------------------------------------------------------- /docs/images/robustmq-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/robustmq-architecture.png -------------------------------------------------------------------------------- /docs/images/robustmq-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/robustmq-logo.png -------------------------------------------------------------------------------- /docs/images/share-sub-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/share-sub-1.png -------------------------------------------------------------------------------- /docs/images/share-sub-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/share-sub-2.png -------------------------------------------------------------------------------- /docs/images/storage-adapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/storage-adapter.png -------------------------------------------------------------------------------- /docs/images/wechat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/images/wechat.jpg -------------------------------------------------------------------------------- /docs/license_header.file: -------------------------------------------------------------------------------- 1 | 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. -------------------------------------------------------------------------------- /docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/public/favicon.ico -------------------------------------------------------------------------------- /docs/public/logo-large.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/public/logo-large.jpg -------------------------------------------------------------------------------- /docs/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/public/logo.png -------------------------------------------------------------------------------- /docs/zh/Architect/Broker-Server.md: -------------------------------------------------------------------------------- 1 | # Broker Server 2 | ## 概览 3 | Broker Server是计算层组件,主要完成各种不同消息协议的数据接入及其相关功能的实现。从设计角度来看,它希望支持MQTT 3.1/3.1.1/5.0、AMQP、RocketMQ Remoting/GRPC、Kafka Protocol、OpenMessing、JNS、SQS等主流消息协议。架构如下: 4 | ![image](../../images/doc-image2.png) 5 | 6 | - Broker Server 依靠 Placement Center 完成集群组建,比如节点发现、集群元数据存储等等。 7 | - Broker Server 中的 Node 是无状态的,只负责和客户端 SDK 交互,完成数据的写入和读取。 8 | - Broker Node 会将自身的一些运行的元数据存储在 Placement Center(PC),在新的Broker节点启动时,会从 Placement Center读取、加载、缓存这部分信息。 9 | - Broker Node 启动时,会往 Placement Center集群的Leader节点注册本节点的信息。 10 | - Broker Node 会定时向Placement Center集群发送心跳信息,一旦心跳超时,PC将会移除该节点,并将该节点执行的任务迁移到其他可用节点。 11 | - Broker Server 支持TCP、GRPC两种协议,TCP协议用来处理各种标准消息协议(比如MQTT、AMQP等)的接入,GRPC协议用来完成集群内部的功能交互,比如Broker本身的管理、监控信息拉取等等。 12 | - 在协议相关逻辑处理部分(Logical Processing)会完成消息队列相关功能的开发,比如死信消息,延迟消息、顺序消息等等功能。通过代码块的形式提供给不同协议使用。 13 | - 在消息数据存储部分,是通过 Storage Adapter 来完成数据的读取和写入的。 14 | - Broker Node 会不断地定时向 Placement Center 上报自身的运行信息。 15 | - Placement Center 会根据Broker Node上报的运行信息以及多维度的信息来判断是否执行某些管理操作,然后调用 Broker 的GRPC接口完成对应操作。 16 | -------------------------------------------------------------------------------- /docs/zh/Architect/Design-Documentation.md: -------------------------------------------------------------------------------- 1 | 2 | [点击查看 RobustMQ 详细设计文档](https://docs.google.com/document/d/1uU5mbyqi8hLiL1Ypve5mZWUMFBrr9A1THIYganbRo38/edit?tab=t.ilgcq12vz3ni) -------------------------------------------------------------------------------- /docs/zh/Architect/Journal-Server.md: -------------------------------------------------------------------------------- 1 | # Journal Server 2 | ## 概览 3 | Storage Engine(后面简称SE)是独立的存储服务,它负责消息数据的持久存储,需要兼顾性能、可靠性和成本。它以GRPC 协议(GRPC协议可能会有性能瓶颈,待后续调整)的形式暴露服务。架构如下: 4 | ![image](../../images/doc-image3.png) 5 | 6 | - SE 是一个分布式可水平扩容的集群。可通过横向添加Storage Engine Node(SEN)节点来水平扩容集群。 7 | - SE 通过GRPC协议来提供数据面服务,以支持数据的写入和读取。 8 | - SE 通过在PC中注册节点信息来组件集群。会通过定时上报心跳的方式来保证节点的可用性。 9 | - SE 以分片(Shard)为单位组织数据,分片由多个数据段(Segment)组成。每个Segment的大小默认是1GB(暂定)。 10 | - 分片(Shard)的相关元数据信息存储在Placement Center(PC)中,比如有几个Segment,Segment的分布等等。 11 | - SE 存储层是 Local Raft Storage (LRS)模式。 分片(Shard)的不同的数据段(Segment)默认是3副本存储,不同的数据段会根据均衡算法分布在不同的节点(SEN)上。 12 | - 同时提供分层存储的实现,即允许将Shard数据存放到远程的低成本存储引擎,比如对象存储。 13 | - SE 的索引模块会负责构建数据的索引,如时间索引、key索引、offset索引等。 14 | -------------------------------------------------------------------------------- /docs/zh/Architect/Placement-Center.md: -------------------------------------------------------------------------------- 1 | # Placement Center 2 | ## 概览 3 | Placement Center(后面简称PC)是基于 Raft 和 RocksDB 实现一个元数据存储组件。从存储的角度看,它是一个高性能的分布式KV存储服务。从定义上看,它是 Robust Broker 和 Journal Engine 集群的元数据存储、控制和调度中心。架构如下: 4 | ![image](../../images/doc-image1.png) 5 | - PC 是一个通过 Raft 协议组成的集群,根据 Raft 协议的定义完成Leader选举,切换、数据一致性等等。 6 | - Placement Center Node (后面简称PCN) 是 PC 集群的运行节点,启动时会根据Raft协议选举出Leader和Follower,当Node 异常后,会自动进行Leader切换。 7 | - PCN 单机的存储层是基于RocksDB来实现的。结合Raft协议实现数据的分布式可靠存储。 8 | - PC 数据写入都是在Leader完成的,读取可以在 Leader 和 Follower 完成。 9 | - 数据写入到Leader节点后,会先写入到本地的RocksDB进行持久存储,然后根据Raft协议分发到多个Follower。 10 | - 数据读取可以从Leader或Follower节点读取,会直接从本地缓存和RocksDB读取相关数据。 11 | - Placement Center(PC)支持GRPC和HTTP两种协议,GRPC是默认的数据流协议,负责数据的写入和读取。HTTP协议主要用来完成集群管控、集群状态、监控信息的操作和获取等等。 12 | - Leader 节点会运行控制和调度相关的Controller Thread,用来监控Robust Broker和Robust Journal 集群,并执行必要的调度动作。 13 | - Placement Center(PC)支持单节点运行和集群运行两种模式。集群模式建议最少3节点,并且节点数是奇数。 14 | -------------------------------------------------------------------------------- /docs/zh/Architect/Terminology.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/zh/Architect/Terminology.md -------------------------------------------------------------------------------- /docs/zh/ContributionGuide/ContributingCode/Cargo-Running.md: -------------------------------------------------------------------------------- 1 | # Cargo运行 2 | 1. Run standalone by placement-center 3 | ``` 4 | cargo run --package cmd --bin placement-center -- --conf=config/placement-center.toml 5 | ``` 6 | 输出如下信息,表示 placement-center 启动成功: 7 | ![image](../../../images/Cargo-Running-1.png) 8 | 9 | 2. Run standalone by mqtt-server 10 | 11 | ``` 12 | cargo run --package cmd --bin mqtt-server -- --conf=config/mqtt-server.toml 13 | ``` 14 | 15 | 输出如下信息,表示 mqtt-server 启动成功: 16 | ![Cargo-Running-run-mqtt-server-2.png](../../../images/Cargo-Running-run-mqtt-server-2.png) 17 | 18 | 3. Run standalone by journal-server 19 | 20 | ``` 21 | cargo run --package cmd --bin journal-server -- --conf=config/journal-server.toml 22 | ``` 23 | 输出如下信息,表示 journal-server 启动成功: 24 | ![Cargo-Running-run-journal-server-3.png](../../../images/Cargo-Running-run-journal-server-3.png) 25 | -------------------------------------------------------------------------------- /docs/zh/ContributionGuide/ContributingCode/Troubleshooting.md: -------------------------------------------------------------------------------- 1 | # 故障排查 2 | 3 | ## `tokio-console` 的支持和配置 4 | 5 | `tokio-console` 常被用来调试使用`tokio`运行时构建的异步 Rust 应用程序。要启用对 `tokio-console` 的支持,可以像添加日志appender一样进行配置。以下 `config.toml` 文件中的条目将向日志配置中添加一个 `tokio-console` appender: 6 | 7 | ```toml 8 | [tokio_console] # 这是 appender 的名称,可以选择任何名称 9 | kind = "TokioConsole" # 注意这是区分大小写的 10 | bind = "127.0.0.1:5674“ # 非必须字段,用于指定 tokio-console 服务器的地址 11 | ``` 12 | 13 | 要从 tokio 运行时收集任务数据,还需要启用 `tokio_unstable` `cfg`。例如,可以使用以下命令结合上述配置启用 `tokio-console` 支持并运行 placement center : 14 | 15 | ```bash 16 | RUSTFLAGS="--cfg tokio_unstable" cargo run --package cmd --bin placement-center 17 | ``` 18 | 19 | 然后,可以使用以下命令启动 `tokio-console` 客户端,连接到监听自定义地址的服务器: 20 | 21 | ```bash 22 | tokio-console http://127.0.1:5674 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/zh/ContributionGuide/ContributingCode/VsCode-Running.md: -------------------------------------------------------------------------------- 1 | # VSCode运行 2 | 下载项目代码 3 | 初始化环境 4 | 进入src/cmd/src目录,可以看到 5 | ``` 6 | . 7 | ├── journal-server 8 | │ └── server.rs 9 | ├── mqtt-server 10 | │ └── server.rs 11 | └── placement-center 12 | └── server.rs 13 | ``` 14 | 15 | 进入对应组件的目录,打开server.rs,会看到main函数,如下图所示,启动服务即可: 16 | 17 | ![image](../../../images/VSCode-Running-1.png) 18 | -------------------------------------------------------------------------------- /docs/zh/ContributionGuide/ContributingDoc/Build-Doc-Env.md: -------------------------------------------------------------------------------- 1 | # 如何构建文档环境 2 | 3 | RobustMQ使用的是[VitePress](https://vitepress.dev/)来构建对应的文档系统, 4 | 如果需要修改配置,可以参考[VitPress文档](https://vitepress.dev/guide/getting-started) 5 | 来帮助RobustMQ的文档构建的更好。 6 | 7 | ## Mac / Windows 8 | 9 | ### 前置准备 10 | 11 | 你需要 `node` 环境来运行文档 12 | 13 | - MacOS 用户可以通过`brew`来安装node 14 | 15 | ```shell 16 | brew install node 17 | ``` 18 | 19 | - Windows 用户可以通过 [Node.js官网](https://nodejs.org/zh-cn/download/) 来安装 Node.js 20 | 21 | ### 具体步骤 22 | 23 | 1. 通过如下命令安装`VitePress`所需要的包 24 | 25 | ```shell 26 | npm install 27 | ``` 28 | 29 | 2. 通过如下命令开启本地调试 30 | 31 | ```shell 32 | npm run docs:dev 33 | ``` 34 | 35 | 3. 打开本地链接,最终效果如下 36 | 37 | ![image](../../../images/Build-Doc-Env-1.png) 38 | -------------------------------------------------------------------------------- /docs/zh/OverView/Good-First-Issue.md: -------------------------------------------------------------------------------- 1 | [点击查看 RobustMQ Good First Issue](https://docs.google.com/document/d/10DBQ1JWfPxGY_5vYfJO5reyF6USqgxIvygWA-FPDDfg/edit?tab=t.0#heading=h.99o3501f8vh2) 2 | -------------------------------------------------------------------------------- /docs/zh/OverView/MQTT-Release.md: -------------------------------------------------------------------------------- 1 | 2 | https://docs.google.com/document/d/1-7vd2logTQsyhi1bDo-5vNThigVvM5fMdAoZAgWcGgs/edit?tab=t.0#heading=h.pbzy95ej8kib -------------------------------------------------------------------------------- /docs/zh/QuickGuide/Overview.md: -------------------------------------------------------------------------------- 1 | ## 概述 2 | RobustMQ 长期预计支持多种消息队列协议。当前已支持 MQTT 协议,即:RobustMQ MQTT. 3 | 4 | ## RobustMQ MQTT 5 | 6 | ### 部署模式 7 | RobustMQ MQTT 单机和集群两种部署模式。 8 | - 单机模式:启动单机模式的 MQTT Server,其中 Placement Center 和 MQTT Server 都是单机运行。 9 | - 集群模式:启动集群模式的 MQTT Server,其中 Placement Center 和 MQTT Server 都是多节点集群模式运行。其中 Placement Center 默认三节点,MQTT Broker 节点数量不限制。 10 | 11 | ## 运行方式 12 | 1. Cargo 运行: 下载源代码,然后执行 cargo run 命令运行 MQTT Server。该方式适用于开发调试。 13 | 2. 二进制包运行:下载或编译二进制包,然后执行二进制包运行 MQTT Server。该方式适用于生产环境。 14 | 3. Docker 运行:即下载或编译 Docker 镜像,然后执行 Docker 镜像运行 MQTT Server。该方式适用于生产环境。 15 | 4. K8s 运行:即在 K8s 集群中运行 MQTT Server。该方式适用于生产环境。 16 | 17 | > 建议:在开发调试阶段,我们一般用 Cargo 运行。在生产环境我们一般推荐用 docker 或 K8s 方式运行,因为这样可以方便的进行扩容和缩容。同时我们也支持二进制包运行。 18 | 19 | ### 快速启动 20 | - [编译二进制安装包【可选】](mqtt/Build.md) 21 | - [二进制运行-单机模式](mqtt/Run-Standalone-Mode.md) 22 | - [二进制运行-集群模式](mqtt/Run-Cluster-Mode.md) 23 | - [Docker 运行](mqtt/Run-Docker-Mode.md) 24 | - [K8s 运行](mqtt/Run-K8S-Mode.md) -------------------------------------------------------------------------------- /docs/zh/QuickGuide/mqtt/MQTT-test.md: -------------------------------------------------------------------------------- 1 | ## 查看用户 2 | 3 | ```console 4 | % bin/robust-ctl mqtt user list 5 | +----------+--------------+ 6 | | username | is_superuser | 7 | +----------+--------------+ 8 | | admin | true | 9 | +----------+--------------+ 10 | ``` 11 | 12 | ## 发布消息 13 | 14 | ```console 15 | % bin/robust-ctl mqtt --server=127.0.0.1:1883 publish --username=admin --password=pwd123 --topic=test/topic1 --qos=0 16 | able to connect: "127.0.0.1:1883" 17 | you can post a message on the terminal: 18 | 1 19 | > You typed: 1 20 | 2 21 | > You typed: 2 22 | 3 23 | > You typed: 3 24 | 4 25 | > You typed: 4 26 | 5 27 | > You typed: 5 28 | ^C> Ctrl+C detected, Please press ENTER to end the program. 29 | ``` 30 | 31 | ## 订阅消息 32 | 33 | ```console 34 | % bin/robust-ctl mqtt --server=127.0.0.1:1883 subscribe --username=admin --password=pwd123 --topic=test/topic1 --qos=0 35 | able to connect: "127.0.0.1:1883" 36 | subscribe success 37 | payload: 1 38 | payload: 2 39 | payload: 3 40 | payload: 4 41 | payload: 5 42 | ^C Ctrl+C detected, Please press ENTER to end the program. 43 | End of input stream. 44 | ``` 45 | -------------------------------------------------------------------------------- /docs/zh/RobustMQ-Command/Journal Server.md: -------------------------------------------------------------------------------- 1 | # Journal Engine Command -------------------------------------------------------------------------------- /docs/zh/RobustMQ-Command/Placement-Center.md: -------------------------------------------------------------------------------- 1 | # Placement Center Command 2 | 3 | ## 1. Placement状态 4 | 5 | 查看Placement集群的运行信息。 6 | 7 | ``` 8 | $ bin/robust-ctl place status 9 | {"running_state":{"Ok":null},"id":1,"current_term":1,"vote":{"leader_id":{"term":1,"node_id":1},"committed":true},"last_log_index":28,"last_applied":{"leader_id":{"term":1,"node_id":1},"index":28},"snapshot":null,"purged":null,"state":"Leader","current_leader":1,"millis_since_quorum_ack":0,"last_quorum_acked":1742005289409447084,"membership_config":{"log_id":{"leader_id":{"term":0,"node_id":0},"index":0},"membership":{"configs":[[1]],"nodes":{"1":{"node_id":1,"rpc_addr":"127.0.0.1:1228"}}}},"heartbeat":{"1":1742005289032346459},"replication":{"1":{"leader_id":{"term":1,"node_id":1},"index":28}}} 10 | ``` 11 | 12 | ## 2. 添加学习者 13 | 14 | 为Placement集群扩展添加一个新节点作为学习者。 15 | 16 | ``` 17 | $ bin/robust-ctl place add-learner -n 2 -r 127.0.0.1:1229 18 | Placement center add leaner successfully 19 | ``` 20 | 21 | ## 3. 更改成员关系 22 | 23 | 更改Placement集群的成员关系。 24 | 25 | ``` 26 | $ bin/robust-ctl place change-membership -m 2 -r 27 | Placement center change membership successfully 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/zh/RobustMQ-Kafka/Overview.md: -------------------------------------------------------------------------------- 1 | # 概览 2 | RobustMQ 即将启动 RobustMQ Kafka 的开发,敬请期待~ 3 | -------------------------------------------------------------------------------- /docs/zh/RobustMQ-MQTT/Dashboard.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/zh/RobustMQ-MQTT/Dashboard.md -------------------------------------------------------------------------------- /docs/zh/RobustMQ-MQTT/DelayMessage.md: -------------------------------------------------------------------------------- 1 | ## 概述 2 | 3 | 延迟发布是 RobustMQ MQTT 支持的 MQTT 扩展功能。当客户端使用特殊主题前缀 $delayed/{DelayInterval} 发布消息时,将触发延迟发布功能,可以实现按照用户配置的时间间隔延迟发布消息。 4 | 5 | ## 功能描述 6 | 延迟发布主题的具体格式如下: 7 | ``` 8 | $delayed/{DelayInterval}/{TopicName} 9 | ``` 10 | - $delayed:使用 $delay 作为主题前缀的消息都将被视为需要延迟发布的消息。延迟间隔由下一主题层级中的内容决定。 11 | - {DelayInterval}:指定该 MQTT 消息延迟发布的时间间隔,单位是秒,允许的最大间隔是 4294967 秒。如果 {DelayInterval} 无法被解析为一个整型数字,EMQX 将丢弃该消息,客户端不会收到任何信息。 12 | - {TopicName}:MQTT 消息的主题名称。 13 | 14 | ## 示例 15 | - $delayed/15/x/y:15 秒后将 MQTT 消息发布到主题 x/y。 16 | - $delayed/60/a/b:1 分钟后将 MQTT 消息发布到 a/b。 17 | - $delayed/3600/$SYS/topic:1 小时后将 MQTT 消息发布到 $SYS/topic。 18 | -------------------------------------------------------------------------------- /docs/zh/RobustMQ-MQTT/RetainMessage.md: -------------------------------------------------------------------------------- 1 | ## 什么是 MQTT 保留消息? 2 | 3 | 发布者发布消息时,如果 Retained 标记被设置为 true,则该消息即是 MQTT 中的保留消息(Retained Message)。MQTT 服务器会为每个主题存储最新一条保留消息,以方便消息发布后才上线的客户端在订阅主题时仍可以接收到该消息。当客户端订阅主题时,如果服务端存在该主题匹配的保留消息,则该保留消息将被立即发送给该客户端。 4 | 5 | ## 何时使用 MQTT 保留消息? 6 | 发布订阅模式虽然能让消息的发布者与订阅者充分解耦,但也存在一个缺点,即订阅者无法主动向发布者请求消息。订阅者何时收到消息完全依赖于发布者何时发布消息,这在某些场景中就产生了不便。 7 | 8 | 借助保留消息,新的订阅者能够立即获取最近的状态,而不需要等待无法预期的时间,例如: 9 | - 智能家居设备的状态只有在变更时才会上报,但是控制端需要在上线后就能获取到设备的状态; 10 | - 传感器上报数据的间隔太长,但是订阅者需要在订阅后立即获取到最新的数据; 11 | - 传感器的版本号、序列号等不会经常变更的属性,可在上线后发布一条保留消息告知后续的所有订阅者。 -------------------------------------------------------------------------------- /docs/zh/RobustMQ-MQTT/SystemArchitecture.md: -------------------------------------------------------------------------------- 1 | # 系统架构 2 | 3 | ![image](../../images/doc-image5.png) 4 | 5 | 如上图所示: RobustMQ MQTT 由 MQTT Broker、Placement Center、Storage Engine 三部分组成。 6 | 7 | MQTT Broker 是完全无状态的节点,基于 Placement Center 完成节点发现、节点探活,从而完成集群构建。MQTT 客户端随机访问一台 Broker 完成消息数据的 Pub/Sub。MQTT Broker 支持基于 TCP 的 MQTT 3/4/5 协议的解析和基于 GRPC 协议的集群内部管控和调度。 8 | 9 | MQTT 集群的元数据存储在 Placement Center Cluster 中。Placement Center 是 RobustMQ MQTT 集群的元数据管理中心,负责 MQTT 集群的元数据管理、集群的节点管理、集群的故障恢复等等。Placement Center 会运行 MQTT Broker 集群对应的控制器线程。负责 MQTT 集群的调度,比如共享集群的 Leader。 10 | 11 | MQTT 集群通过 Storage Adapter layer 持久化存储消息数据到Storage Engine。 12 | -------------------------------------------------------------------------------- /docs/zh/RobustMQ-MQTT/WillMessage.md: -------------------------------------------------------------------------------- 1 | ## 什么是 MQTT 遗嘱消息? 2 | 在现实世界中,一个人可以制定一份遗嘱,声明在他去世后应该如何分配他的财产以及应该采取什么行动。在他去世后,遗嘱执行人会将这份遗嘱公开,并执行遗嘱中的指示。 3 | 4 | 在 MQTT 中,客户端可以在连接时在服务端中注册一个遗嘱消息,与普通消息类似,我们可以设置遗嘱消息的主题、有效载荷等等。当该客户端意外断开连接,服务端就会向其他订阅了相应主题的客户端发送此遗嘱消息。这些接收者也因此可以及时地采取行动,例如向用户发送通知、切换备用设备等等。 5 | 6 | 假设我们有一个传感器监控一个很少变化的值,普通的实现是定期发布最新数值,但更好的实现是仅在数值发生变化时以保留消息的形式发送它。这使得任何新的订阅者总能立即获得当前值,而不必等待传感器再一次发布。不过订阅者也因此没有办法根据是否及时收到消息来判断传感器是否离线。借助遗嘱消息,我们可以立即得知传感器保持活动超时,而且不必总是获取传感器发布的值。 7 | 8 | ## 遗嘱消息 9 | RobustMQ MQTT 实现了 MQTT 的遗嘱消息功能。如果为客户端设置了遗嘱消息,在客户端意外断开连接时,EMQX 将把遗嘱消息发送给相关的订阅者,以便订阅者可以得知并更新客户端状态。 10 | 11 | -------------------------------------------------------------------------------- /docs/zh/VersionRecord/0.1.0-beta.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/zh/VersionRecord/0.1.0-beta.md -------------------------------------------------------------------------------- /docs/zh/VersionRecord/Summary-2024.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/docs/zh/VersionRecord/Summary-2024.md -------------------------------------------------------------------------------- /example/single-mqtt-cluster/README.md: -------------------------------------------------------------------------------- 1 | # Single node dev mode robustmq start 2 | 3 | This example is used to quickly start a robustmq cluster with only one instance. This is suitable for starting in developer mode. 4 | 5 | ## Quick Start 6 | 7 | Executing the following command will start three required component instances: 8 | 9 | * placement-center 10 | * mqtt-broker 11 | * journal-server 12 | 13 | At the same time, three runtime directories will be generated in the execution directory: `logs` (generated by the component), `robust-data-test` (generated by the component), and `process_logs` (component process logs). 14 | 15 | ```shell 16 | $ ./start.sh 17 | ``` 18 | 19 | ## Cleaning 20 | 21 | Executing the cleanup script will clear the directories generated during runtime and exit the started component process. 22 | 23 | ```shell 24 | $ ./stop.sh 25 | ``` -------------------------------------------------------------------------------- /example/single-mqtt-cluster/journal-server/journal-tracing.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [stdout] 16 | kind = "Console" 17 | level = "Info" 18 | 19 | [server] 20 | kind = "RollingFile" 21 | level = "Info" 22 | rotation = "Minutely" 23 | directory = "./logs" 24 | prefix = "journal-server-" 25 | suffix = "log" 26 | max_log_files = 10 27 | -------------------------------------------------------------------------------- /example/single-mqtt-cluster/mqtt-server/mqtt-tracing.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [stdout] 16 | kind = "Console" 17 | level = "Info" 18 | 19 | [server] 20 | kind = "RollingFile" 21 | level = "Info" 22 | rotation = "Minutely" 23 | directory = "./logs" 24 | prefix = "mqtt-server-" 25 | suffix = "log" 26 | max_log_files = 10 27 | 28 | [slow_sub] 29 | kind = "RollingFile" 30 | level = "Info" 31 | rotation = "Minutely" 32 | directory = "./logs" 33 | prefix = "mqtt-slow_sub-" 34 | suffix = "log" 35 | max_log_files = 10 36 | -------------------------------------------------------------------------------- /example/single-mqtt-cluster/placement-center/place-tracing.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [stdout] 16 | kind = "Console" 17 | level = "Info" 18 | 19 | [server] 20 | kind = "RollingFile" 21 | level = "Info" 22 | rotation = "Minutely" 23 | directory = "./logs" 24 | prefix = "place-server-" 25 | suffix = "log" 26 | max_log_files = 10 27 | -------------------------------------------------------------------------------- /example/test-network-docker/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2023 RobustMQ Team 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | cd ../../ 17 | docker build --target builder -t builder-test:0.1 . 18 | docker build --target placement-center -t placement-center-test:0.1 . 19 | docker build --target mqtt-server -t mqtt-server-test:0.1 . 20 | docker build --target journal-server -t journal-server-test:0.1 . 21 | 22 | cd ./example/test-network-docker 23 | 24 | docker-compose -f compose/compose-test-net.yaml up 25 | -------------------------------------------------------------------------------- /example/test-network-k8s/scripts/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2023 RobustMQ Team 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | function init_namespace() { 17 | 18 | kubectl create namespace ${NAMESPACE} 19 | 20 | } 21 | 22 | function delete_namespace() { 23 | 24 | kubectl delete namespace ${NAMESPACE} 25 | 26 | } 27 | 28 | function load_config() { 29 | kubectl apply -f kube/cfg-placement-center.yaml 30 | } 31 | -------------------------------------------------------------------------------- /example/test-network-k8s/scripts/util.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2023 RobustMQ Team 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | 17 | function log() { 18 | echo -e "\033[32m$1\033[0m" 19 | } 20 | 21 | 22 | function apply_template() { 23 | 24 | echo "Applying template $1:" 25 | 26 | cat $1 | envsubst | kubectl -n $2 apply -f - 27 | } 28 | -------------------------------------------------------------------------------- /licenserc.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | headerPath = "Apache-2.0.txt" 16 | 17 | includes = [ 18 | "*.yml", 19 | "*.yaml", 20 | "*.toml", 21 | "*.sh", 22 | "*.rs", 23 | "*.py", 24 | ] 25 | 26 | excludes = [ 27 | # The following files are generated by marcotest after expanding the macros in the code. 28 | # Since macro parsing will discard comments after the HIR stage, we do not check their licenses. 29 | "**/*.expanded.rs" 30 | ] 31 | 32 | [properties] 33 | inceptionYear = 2023 34 | copyrightOwner = "RobustMQ Team" 35 | -------------------------------------------------------------------------------- /mirror: -------------------------------------------------------------------------------- 1 | [source.crates-io] 2 | replace-with = 'rsproxy-sparse' 3 | [source.rsproxy] 4 | registry = "https://rsproxy.cn/crates.io-index" 5 | [source.rsproxy-sparse] 6 | registry = "sparse+https://rsproxy.cn/index/" 7 | [registries.rsproxy] 8 | index = "https://rsproxy.cn/crates.io-index" 9 | [net] 10 | git-fetch-with-cli = true -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "robustmq", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "RobustMQ", 6 | "devDependencies": { 7 | "vitepress": "^2.0.0-alpha.4", 8 | "vitepress-i18n": "^1.3.0" 9 | }, 10 | "scripts": { 11 | "docs:dev": "vitepress dev docs", 12 | "docs:build": "vitepress build docs", 13 | "docs:preview": "vitepress preview docs" 14 | }, 15 | "keywords": [ 16 | "MQ", 17 | "RobustMQ" 18 | ], 19 | "author": "RobustMQ Team", 20 | "license": "Apache-2.0" 21 | } 22 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [toolchain] 16 | channel = "1.87.0" 17 | components = [ "rustfmt", "rust-src", "rust-analyzer"] 18 | # The component named miri is supported in the nightly version 19 | # so we will use it until the stable version can be supported. 20 | # components = [ "rustfmt", "rust-src", "miri", "rust-analyzer"] 21 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | edition = "2024" 16 | # These command are only supported in the nightly version 17 | # We use these command when they are supporting in the stable version 18 | # group_imports = "StdExternalCrate" 19 | # imports_granularity = "Module" 20 | -------------------------------------------------------------------------------- /scripts/unit-test.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | 17 | if [ "$1" = "dev" ]; then 18 | 19 | # Run Cargo Test (exclude integration test modules) 20 | cargo nextest run --workspace --exclude=robustmq-test --exclude=grpc-clients --filter-expr '!(test(placement) & package(storage-adapter))' 21 | 22 | else 23 | 24 | # Run Cargo Test (exclude integration test modules) 25 | cargo nextest run --profile=ci --workspace --exclude=robustmq-test --exclude=grpc-clients --filter-expr '!(test(placement) & package(storage-adapter))' 26 | 27 | fi 28 | -------------------------------------------------------------------------------- /src/amqp-broker/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "amqp-broker" 17 | version.workspace = true 18 | edition.workspace = true 19 | license.workspace = true 20 | 21 | 22 | [dependencies] 23 | bytes.workspace = true 24 | axum.workspace = true 25 | thiserror.workspace = true -------------------------------------------------------------------------------- /src/amqp-broker/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/amqp-broker/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/cli-bench/src/kafka/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use clap::Parser; 16 | 17 | #[derive(Debug, Parser)] 18 | pub struct KafkaBenchArgs {} 19 | -------------------------------------------------------------------------------- /src/cli-bench/src/kv/mixed.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use clap::Parser; 16 | 17 | #[derive(Debug, Clone, Parser)] 18 | pub struct KvMixedBenchArgs {} 19 | -------------------------------------------------------------------------------- /src/cli-bench/src/kv/set.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use clap::Parser; 16 | 17 | #[derive(Debug, Clone, Parser)] 18 | pub struct KvSetBenchArgs {} 19 | -------------------------------------------------------------------------------- /src/cli-bench/src/mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod publish; 16 | pub mod subscribe; 17 | 18 | use clap::Parser; 19 | 20 | #[derive(Debug, Parser)] 21 | pub struct MqttBenchArgs {} 22 | -------------------------------------------------------------------------------- /src/cli-bench/src/mqtt/publish.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/cli-bench/src/mqtt/subscribe.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/cli-bench/src/raft/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use clap::Parser; 16 | 17 | #[derive(Debug, Parser)] 18 | pub struct RaftBenchArgs {} 19 | -------------------------------------------------------------------------------- /src/cli-bench/src/rocksdb/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use clap::Parser; 16 | 17 | #[derive(Debug, Parser)] 18 | pub struct RocksdbBenchArgs {} 19 | -------------------------------------------------------------------------------- /src/cli-command/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "cli-command" 17 | version.workspace = true 18 | edition.workspace = true 19 | license.workspace = true 20 | 21 | 22 | [dependencies] 23 | bytes.workspace = true 24 | axum.workspace = true 25 | thiserror.workspace = true 26 | grpc-clients.workspace = true 27 | common-base.workspace = true 28 | metadata-struct.workspace = true 29 | protocol.workspace = true 30 | serde_json.workspace = true 31 | prettytable-rs.workspace = true 32 | tokio.workspace = true 33 | paho-mqtt.workspace = true 34 | -------------------------------------------------------------------------------- /src/cli-command/src/template.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Clone, Debug, PartialEq)] 16 | pub struct PublishArgsRequest { 17 | pub topic: String, 18 | pub qos: i32, 19 | pub retained: bool, 20 | pub username: String, 21 | pub password: String, 22 | } 23 | 24 | #[derive(Clone, Debug, PartialEq)] 25 | pub struct SubscribeArgsRequest { 26 | pub topic: String, 27 | pub qos: i32, 28 | pub username: String, 29 | pub password: String, 30 | } 31 | -------------------------------------------------------------------------------- /src/cli-command/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/cmd/src/cli-command/mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(crate) mod admin; 16 | pub(crate) mod publish; 17 | -------------------------------------------------------------------------------- /src/cmd/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/common/base/src/enum_type/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod feature_type; 16 | pub mod sort_type; 17 | pub mod time_unit_enum; 18 | pub mod topic_rewrite_action_enum; 19 | -------------------------------------------------------------------------------- /src/common/base/src/error/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod common; 16 | pub mod log_config; 17 | -------------------------------------------------------------------------------- /src/common/base/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![allow(clippy::result_large_err)] 16 | pub mod config; 17 | pub mod enum_type; 18 | pub mod error; 19 | pub mod http_error; 20 | pub mod http_response; 21 | pub mod logging; 22 | pub mod metrics; 23 | pub mod runtime; 24 | pub mod telemetry; 25 | pub mod tools; 26 | pub mod utils; 27 | pub mod version; 28 | -------------------------------------------------------------------------------- /src/common/base/src/telemetry/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod trace; 16 | -------------------------------------------------------------------------------- /src/common/base/src/utils/crc.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crc32fast::Hasher; 16 | 17 | pub fn calc_crc32(data: &[u8]) -> u32 { 18 | let mut hasher = Hasher::new(); 19 | hasher.update(data); 20 | hasher.finalize() 21 | } 22 | -------------------------------------------------------------------------------- /src/common/base/src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod crc; 16 | pub mod file_utils; 17 | pub mod topic_util; 18 | pub mod vec_util; 19 | -------------------------------------------------------------------------------- /src/common/base/src/utils/vec_util.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub fn bool_to_vec(b: bool) -> Vec { 16 | if b { 17 | vec![0x01] 18 | } else { 19 | vec![0x00] 20 | } 21 | } 22 | 23 | pub fn vec_to_bool(v: &Vec) -> bool { 24 | matches!(v.as_slice(), [0x01]) 25 | } 26 | -------------------------------------------------------------------------------- /src/common/base/src/version/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod logo; 16 | use logo::DEFAULT_PLACEMENT_CENTER_CONFIG; 17 | use tracing::error; 18 | 19 | use crate::tools::read_file; 20 | 21 | pub fn version() -> String { 22 | match read_file(DEFAULT_PLACEMENT_CENTER_CONFIG) { 23 | Ok(data) => data, 24 | Err(e) => { 25 | error!("{}", e.to_string()); 26 | "-".to_string() 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/common/base/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/common/metadata-struct/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "metadata-struct" 17 | version.workspace = true 18 | edition.workspace = true 19 | license.workspace = true 20 | 21 | [dependencies] 22 | thiserror.workspace = true 23 | serde.workspace = true 24 | common-base.workspace = true 25 | serde_json.workspace = true 26 | protocol.workspace = true 27 | bytes.workspace = true 28 | tracing.workspace = true 29 | dashmap.workspace = true 30 | crc32fast.workspace = true 31 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/acl/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod mqtt_acl; 16 | pub mod mqtt_blacklist; 17 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/adapter/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod read_config; 16 | pub mod record; 17 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/adapter/read_config.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Default, Clone)] 16 | pub struct ReadConfig { 17 | pub max_record_num: u64, 18 | pub max_size: u64, 19 | } 20 | 21 | impl ReadConfig { 22 | pub fn new() -> Self { 23 | ReadConfig { 24 | max_record_num: 10, 25 | max_size: 1024 * 1024 * 1024, 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/delay_info.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Clone, Debug, Serialize, Deserialize)] 18 | pub struct DelayMessageInfo { 19 | pub delay_shard_name: String, 20 | pub target_shard_name: String, 21 | pub offset: u64, 22 | pub delay_timestamp: u64, 23 | } 24 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/journal/group.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Serialize, Deserialize, Debug)] 18 | pub struct JournalGroup { 19 | namespace: String, 20 | group_name: String, 21 | shard_list: Vec, 22 | } 23 | 24 | #[derive(Serialize, Deserialize, Debug)] 25 | pub struct JournalGroupOffset { 26 | shard_name: String, 27 | commit_offset: String, 28 | } 29 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/journal/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod group; 16 | pub mod namespace; 17 | pub mod node_extend; 18 | pub mod segment; 19 | pub mod segment_meta; 20 | pub mod shard; 21 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/journal/namespace.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Serialize, Deserialize, Debug)] 18 | 19 | pub struct JournalNamespace { 20 | namespace_name: String, 21 | } 22 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/journal/node_extend.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Serialize, Deserialize, Clone, Default)] 18 | pub struct JournalNodeExtend { 19 | pub data_fold: Vec, 20 | pub tcp_addr: String, 21 | pub tcps_addr: String, 22 | } 23 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![allow(clippy::result_large_err)] 16 | pub mod acl; 17 | pub mod adapter; 18 | pub mod delay_info; 19 | pub mod journal; 20 | pub mod mqtt; 21 | pub mod placement; 22 | pub mod schema; 23 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/bridge/config_kafka.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Serialize, Deserialize, Default, Clone)] 18 | pub struct KafkaConnectorConfig { 19 | pub bootstrap_servers: String, 20 | pub topic: String, 21 | pub key: String, 22 | } 23 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/bridge/config_local_file.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Serialize, Deserialize, Default, Clone)] 18 | pub struct LocalFileConnectorConfig { 19 | pub local_file_path: String, 20 | } 21 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/bridge/connector_type.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use std::fmt::Display; 16 | 17 | use serde::{Deserialize, Serialize}; 18 | 19 | #[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq)] 20 | pub enum ConnectorType { 21 | #[default] 22 | Kafka, 23 | LocalFile, 24 | } 25 | 26 | impl Display for ConnectorType { 27 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 28 | write!(f, "{:?}", self) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/bridge/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod config_kafka; 16 | pub mod config_local_file; 17 | pub mod connector; 18 | pub mod connector_type; 19 | pub mod status; 20 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/bridge/status.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use std::fmt::Display; 16 | 17 | use serde::{Deserialize, Serialize}; 18 | 19 | #[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)] 20 | pub enum MQTTStatus { 21 | #[default] 22 | Idle, 23 | Running, 24 | } 25 | 26 | impl Display for MQTTStatus { 27 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 28 | write!(f, "{:?}", self) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/lastwill.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use protocol::mqtt::common::{LastWill, LastWillProperties}; 16 | use serde::{Deserialize, Serialize}; 17 | 18 | #[derive(Serialize, Deserialize, Default, Clone, Debug)] 19 | pub struct LastWillData { 20 | pub client_id: String, 21 | pub last_will: Option, 22 | pub last_will_properties: Option, 23 | } 24 | 25 | impl LastWillData { 26 | pub fn encode(&self) -> Vec { 27 | serde_json::to_vec(&self).unwrap() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod auto_subscribe_rule; 16 | pub mod bridge; 17 | pub mod cluster; 18 | pub mod connection; 19 | pub mod lastwill; 20 | pub mod message; 21 | pub mod node_extend; 22 | pub mod session; 23 | pub mod subscribe_data; 24 | pub mod topic; 25 | pub mod topic_rewrite_rule; 26 | pub mod user; 27 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/node_extend.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Clone, Default, Serialize, Deserialize)] 18 | pub struct MqttNodeExtend { 19 | pub grpc_addr: String, 20 | pub mqtt_addr: String, 21 | pub mqtts_addr: String, 22 | pub websocket_addr: String, 23 | pub websockets_addr: String, 24 | pub quic_addr: String, 25 | } 26 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/mqtt/user.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] 18 | pub struct MqttUser { 19 | pub username: String, 20 | pub password: String, 21 | pub is_superuser: bool, 22 | } 23 | 24 | impl MqttUser { 25 | pub fn encode(&self) -> Vec { 26 | serde_json::to_vec(&self).unwrap() 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/placement/cluster.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | #[derive(Default, Clone, Debug, Serialize, Deserialize)] 18 | pub struct ClusterInfo { 19 | pub cluster_name: String, 20 | pub cluster_type: String, 21 | pub create_time: u128, 22 | } 23 | 24 | impl ClusterInfo { 25 | pub fn encode(&self) -> Vec { 26 | serde_json::to_vec(&self).unwrap() 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/common/metadata-struct/src/placement/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod cluster; 16 | pub mod node; 17 | -------------------------------------------------------------------------------- /src/common/metadata-struct/tests/test.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/common/pprof-monitor/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "pprof-monitor" 17 | version.workspace = true 18 | edition.workspace = true 19 | license.workspace = true 20 | 21 | [dependencies] 22 | tokio.workspace = true 23 | pprof.workspace = true 24 | hyper.workspace = true 25 | axum.workspace = true 26 | bytes.workspace = true 27 | tracing.workspace = true 28 | 29 | [dev-dependencies] 30 | mockall.workspace = true 31 | -------------------------------------------------------------------------------- /src/common/pprof-monitor/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod pprof_monitor; 16 | -------------------------------------------------------------------------------- /src/common/rocksdb-engine/src/warp.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use common_base::tools::now_second; 16 | use serde::{Deserialize, Serialize}; 17 | 18 | #[derive(Serialize, Deserialize, Debug)] 19 | pub struct StorageDataWrap { 20 | pub data: String, 21 | pub create_time: u64, 22 | } 23 | 24 | impl StorageDataWrap { 25 | pub fn new(data: String) -> Self { 26 | StorageDataWrap { 27 | data, 28 | create_time: now_second(), 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/common/rocksdb-engine/tests/test.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/common/third-driver/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "third-driver" 17 | version.workspace = true 18 | edition.workspace = true 19 | license.workspace = true 20 | 21 | [dependencies] 22 | thiserror.workspace = true 23 | common-base.workspace = true 24 | mysql.workspace = true -------------------------------------------------------------------------------- /src/common/third-driver/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![allow(clippy::result_large_err)] 16 | pub mod mysql; 17 | -------------------------------------------------------------------------------- /src/common/third-driver/src/mysql.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use common_base::error::common::CommonError; 16 | use mysql::Pool; 17 | 18 | pub fn build_mysql_conn_pool(addr: &str) -> Result { 19 | match Pool::new(addr) { 20 | Ok(pool) => Ok(pool), 21 | Err(e) => Err(CommonError::CommonError(e.to_string())), 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/common/third-driver/tests/test.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/delay-message/src/storage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robustmq/robustmq/5a2697f42e5ebd1e169354c0e73e77505e4e64e5/src/delay-message/src/storage -------------------------------------------------------------------------------- /src/delay-message/tests/delay.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/delay-message/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod delay; 16 | -------------------------------------------------------------------------------- /src/grpc-clients/src/journal/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod admin; 16 | pub mod inner; 17 | -------------------------------------------------------------------------------- /src/grpc-clients/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod macros; 16 | 17 | pub mod journal; 18 | pub mod mqtt; 19 | pub mod placement; 20 | pub mod pool; 21 | mod utils; 22 | // const MAX_RETRY_TIMES: usize = 10; 23 | 24 | pub fn retry_times() -> usize { 25 | 0 26 | } 27 | 28 | pub fn retry_sleep_time(times: usize) -> u64 { 29 | (times * 2) as u64 30 | } 31 | -------------------------------------------------------------------------------- /src/grpc-clients/src/mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod admin; 16 | pub mod inner; 17 | 18 | #[cfg(test)] 19 | mod tests {} 20 | -------------------------------------------------------------------------------- /src/grpc-clients/tests/common.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![allow(dead_code)] 16 | 17 | pub fn get_placement_addr() -> String { 18 | "127.0.0.1:1228".to_string() 19 | } 20 | 21 | pub fn get_mqtt_broker_addr() -> String { 22 | "127.0.0.1:9981".to_string() 23 | } 24 | -------------------------------------------------------------------------------- /src/grpc-clients/tests/journal/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod update_cache; 16 | -------------------------------------------------------------------------------- /src/grpc-clients/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod common; 16 | mod journal; 17 | mod mqtt; 18 | mod placement; 19 | -------------------------------------------------------------------------------- /src/grpc-clients/tests/mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod mqtt_admin_test; 16 | mod mqtt_connect_test; 17 | -------------------------------------------------------------------------------- /src/grpc-clients/tests/placement/journal/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod segment; 16 | pub mod shard; 17 | -------------------------------------------------------------------------------- /src/grpc-clients/tests/placement/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod journal; 16 | pub mod mqtt; 17 | -------------------------------------------------------------------------------- /src/grpc-clients/tests/placement/mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod cluster_test; 16 | mod kv_test; 17 | mod mqtt_acl_test; 18 | mod mqtt_blacklist_test; 19 | mod mqtt_connector_test; 20 | mod mqtt_last_will_test; 21 | mod mqtt_schema_test; 22 | mod mqtt_session_test; 23 | mod mqtt_share_sub_test; 24 | mod mqtt_topic_test; 25 | mod mqtt_user_test; 26 | mod openraft_test; 27 | -------------------------------------------------------------------------------- /src/idempotent-message/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/idempotent-message/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/journal-client/src/consts.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(crate) const ADMIN_NODE_ID: i64 = -999; 16 | pub(crate) const MODULE_ADMIN: &str = "admin"; 17 | pub(crate) const MODULE_WRITE: &str = "write"; 18 | pub(crate) const MODULE_READ: &str = "read"; 19 | -------------------------------------------------------------------------------- /src/journal-client/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![allow(dead_code, unused_variables)] 16 | #![allow(clippy::result_large_err)] 17 | mod async_reader; 18 | mod async_writer; 19 | mod cache; 20 | pub mod client; 21 | mod connection; 22 | mod consts; 23 | mod error; 24 | pub mod option; 25 | mod service; 26 | pub mod tool; 27 | -------------------------------------------------------------------------------- /src/journal-server/src/core/consts.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub const DB_COLUMN_FAMILY_INDEX: &str = "index"; 16 | 17 | pub const BUILD_INDE_PER_RECORD_NUM: u64 = 10000; 18 | -------------------------------------------------------------------------------- /src/journal-server/src/core/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod cache; 16 | pub mod cluster; 17 | pub mod cluster_config; 18 | pub mod consts; 19 | pub mod error; 20 | pub mod notification; 21 | pub mod segment; 22 | pub mod segment_meta; 23 | pub mod segment_status; 24 | pub mod shard; 25 | pub mod test; 26 | -------------------------------------------------------------------------------- /src/journal-server/src/handler/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod cluster; 16 | pub mod command; 17 | pub mod data; 18 | pub mod shard; 19 | -------------------------------------------------------------------------------- /src/journal-server/src/index/engine.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::core::consts::DB_COLUMN_FAMILY_INDEX; 16 | 17 | pub fn column_family_list() -> Vec { 18 | vec![DB_COLUMN_FAMILY_INDEX.to_string()] 19 | } 20 | 21 | pub fn storage_data_fold(data_fold: &Vec) -> String { 22 | if let Some(fold) = data_fold.first() { 23 | return format!("{}/_index", fold); 24 | } 25 | panic!( 26 | "No configuration data storage directory, configuration info :{:?}", 27 | data_fold 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /src/journal-server/src/index/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | pub mod build; 18 | pub mod engine; 19 | pub mod keys; 20 | pub mod offset; 21 | pub mod tag; 22 | pub mod time; 23 | 24 | #[derive(Serialize, Deserialize, Clone, Debug)] 25 | pub struct IndexData { 26 | pub offset: u64, 27 | pub timestamp: u64, 28 | pub position: u64, 29 | } 30 | -------------------------------------------------------------------------------- /src/journal-server/src/isr/fetch.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/journal-server/src/isr/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod fetch; 16 | -------------------------------------------------------------------------------- /src/journal-server/src/server/grpc/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod admin; 16 | pub mod inner; 17 | pub mod server; 18 | -------------------------------------------------------------------------------- /src/journal-server/src/server/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod connection; 16 | pub mod connection_manager; 17 | pub mod grpc; 18 | pub mod packet; 19 | pub mod quic; 20 | pub mod tcp; 21 | -------------------------------------------------------------------------------- /src/journal-server/src/server/quic/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/journal-server/src/server/tcp/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod response; 17 | pub mod server; 18 | mod tcp_server; 19 | mod tls_server; 20 | -------------------------------------------------------------------------------- /src/journal-server/tests/common.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/journal-server/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod common; 16 | -------------------------------------------------------------------------------- /src/kafka-broker/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 RobustMQ Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | name = "kafka-broker" 17 | version.workspace = true 18 | edition.workspace = true 19 | license.workspace = true 20 | 21 | 22 | [dependencies] 23 | bytes.workspace = true 24 | axum.workspace = true 25 | thiserror.workspace = true 26 | common-base.workspace = true 27 | storage-adapter.workspace = true 28 | metadata-struct.workspace = true 29 | dashmap.workspace = true 30 | tokio.workspace = true 31 | tokio-util.workspace = true 32 | tracing.workspace = true 33 | futures.workspace = true 34 | -------------------------------------------------------------------------------- /src/kafka-broker/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/kafka-broker/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/message-expire/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/message-expire/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/bridge/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod core; 16 | pub mod file; 17 | pub mod heartbeat; 18 | pub mod kafka; 19 | pub mod manager; 20 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/handler/flow_control.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use protocol::mqtt::common::QoS; 16 | 17 | pub fn is_qos_message(qos: QoS) -> bool { 18 | qos == QoS::AtLeastOnce || qos == QoS::ExactlyOnce 19 | } 20 | 21 | pub fn is_connection_rate_exceeded() -> bool { 22 | false 23 | } 24 | 25 | pub fn is_subscribe_rate_exceeded() -> bool { 26 | false 27 | } 28 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/metrics/auth.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/metrics/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod auth; 16 | pub mod event_metrics; 17 | pub mod packets; 18 | pub mod publish; 19 | pub mod server; 20 | pub mod session; 21 | pub mod time; 22 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/metrics/publish.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/metrics/session.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/metrics/time.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/slow/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod request; 16 | pub mod sub; 17 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/system_topic/packet/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(crate) mod bytes; 16 | pub(crate) mod messages; 17 | pub(crate) mod packets; 18 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/system_topic/stats/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(crate) mod client; 16 | pub(crate) mod route; 17 | pub(crate) mod subscription; 18 | pub(crate) mod topics; 19 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/system_topic/warn.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/observability/warn/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/acl/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod auth; 16 | pub mod metadata; 17 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/login/http.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/login/jwt.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/login/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::handler::error::MqttBrokerError; 16 | use axum::async_trait; 17 | 18 | pub mod http; 19 | pub mod jwt; 20 | pub mod plaintext; 21 | pub mod psk; 22 | pub mod x509; 23 | 24 | #[async_trait] 25 | pub trait Authentication { 26 | async fn apply(&self) -> Result; 27 | } 28 | 29 | #[cfg(test)] 30 | mod test {} 31 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/login/psk.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/login/x509.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/storage/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod mysql; 16 | pub mod placement; 17 | pub mod redis; 18 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/storage/mysql/sql.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `mqtt_user` ( 2 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 3 | `username` varchar(100) DEFAULT NULL, 4 | `password` varchar(100) DEFAULT NULL, 5 | `salt` varchar(35) DEFAULT NULL, 6 | `is_superuser` tinyint(1) DEFAULT 0, 7 | `created` datetime DEFAULT NULL, 8 | PRIMARY KEY (`id`), 9 | UNIQUE KEY `mqtt_username` (`username`) 10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 11 | 12 | CREATE TABLE `mqtt_acl` ( 13 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 14 | `allow` int(1) DEFAULT 1 COMMENT '0: deny, 1: allow', 15 | `ipaddr` varchar(60) DEFAULT NULL COMMENT 'IpAddress', 16 | `username` varchar(100) DEFAULT NULL COMMENT 'Username', 17 | `clientid` varchar(100) DEFAULT NULL COMMENT 'ClientId', 18 | `access` int(2) NOT NULL COMMENT '0:All, 1: subscribe, 2: publish, 3: pubsub, 4: retain, 5: qos', 19 | `topic` varchar(100) NOT NULL DEFAULT '' COMMENT 'Topic Filter', 20 | PRIMARY KEY (`id`) 21 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 22 | 23 | INSERT INTO `mqtt_user` ( `username`, `password`, `salt`) VALUES 24 | ('robustmq', 'robustmq@2024', NULL); -------------------------------------------------------------------------------- /src/mqtt-broker/src/security/storage/redis/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/server/grpc/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod admin; 16 | mod inner; 17 | pub mod server; 18 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/server/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod connection; 16 | pub mod connection_manager; 17 | pub mod grpc; 18 | pub mod packet; 19 | pub mod quic; 20 | pub mod tcp; 21 | pub mod websocket; 22 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/server/quic/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod client; 16 | mod handler; 17 | mod quic_server_handler; 18 | pub mod quic_stream_wrapper; 19 | mod response; 20 | pub mod server; 21 | mod skip_server_verification; 22 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/server/tcp/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod response; 17 | pub mod server; 18 | mod tcp_server; 19 | mod tls_server; 20 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/server/websocket/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod server; 16 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/storage/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod acl; 16 | pub mod auto_subscribe; 17 | pub mod blacklist; 18 | pub mod cluster; 19 | pub mod connector; 20 | pub mod message; 21 | pub mod session; 22 | pub mod topic; 23 | pub mod user; 24 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/subscribe/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod common; 16 | pub mod exclusive; 17 | pub mod manager; 18 | pub mod push; 19 | pub mod share; 20 | -------------------------------------------------------------------------------- /src/mqtt-broker/src/subscribe/share/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod follower; 16 | pub mod leader; 17 | pub mod write; 18 | -------------------------------------------------------------------------------- /src/mqtt-broker/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod server; 16 | -------------------------------------------------------------------------------- /src/mqtt-broker/tests/server/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod quic; 16 | -------------------------------------------------------------------------------- /src/mqtt-broker/tests/server/quic/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod packet_handler; 16 | mod quic_common; 17 | mod quic_connect_test; 18 | -------------------------------------------------------------------------------- /src/mqtt-broker/tests/server/quic/packet_handler.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/placement-center/src/core/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod cache; 16 | pub mod cluster; 17 | pub mod controller; 18 | pub mod error; 19 | pub mod heartbeat; 20 | pub mod metrics; 21 | pub mod schema; 22 | -------------------------------------------------------------------------------- /src/placement-center/src/inner/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod services; 16 | -------------------------------------------------------------------------------- /src/placement-center/src/journal/controller/preferred_election.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub struct PreferredElection {} 16 | 17 | impl PreferredElection { 18 | pub fn new() -> Self { 19 | PreferredElection {} 20 | } 21 | 22 | pub async fn start(&self) {} 23 | } 24 | -------------------------------------------------------------------------------- /src/placement-center/src/journal/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod cache; 16 | pub mod controller; 17 | pub mod services; 18 | -------------------------------------------------------------------------------- /src/placement-center/src/journal/services/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod segment; 16 | pub mod shard; 17 | -------------------------------------------------------------------------------- /src/placement-center/src/kv/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod services; 16 | -------------------------------------------------------------------------------- /src/placement-center/src/mqtt/connector/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod scheduler; 16 | pub mod status; 17 | -------------------------------------------------------------------------------- /src/placement-center/src/mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use common_base::tools::now_second; 16 | use controller::session_expire::ExpireLastWill; 17 | 18 | pub mod cache; 19 | pub mod connector; 20 | pub mod controller; 21 | pub mod services; 22 | 23 | pub fn is_send_last_will(lastwill: &ExpireLastWill) -> bool { 24 | if now_second() >= lastwill.delay_sec { 25 | return true; 26 | } 27 | false 28 | } 29 | -------------------------------------------------------------------------------- /src/placement-center/src/mqtt/services/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod acl; 16 | pub mod connector; 17 | pub mod session; 18 | pub mod share_sub; 19 | pub mod subscribe; 20 | pub mod topic; 21 | pub mod user; 22 | -------------------------------------------------------------------------------- /src/placement-center/src/raft/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use common_base::error::common::CommonError; 16 | use openraft::error::{RPCError, Unreachable}; 17 | 18 | use super::typeconfig::TypeConfig; 19 | 20 | pub fn to_error(e: CommonError) -> RPCError { 21 | RPCError::Unreachable(Unreachable::new(&e)) 22 | } 23 | -------------------------------------------------------------------------------- /src/placement-center/src/raft/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod error; 16 | pub mod leadership; 17 | #[allow(clippy::module_inception)] 18 | pub mod network; 19 | pub mod raft_node; 20 | pub mod route; 21 | pub mod services; 22 | pub mod store; 23 | pub mod typeconfig; 24 | -------------------------------------------------------------------------------- /src/placement-center/src/raft/network/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod connection; 16 | pub mod network; 17 | -------------------------------------------------------------------------------- /src/placement-center/src/raft/route/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::{Deserialize, Serialize}; 16 | 17 | /** 18 | * Here you will defined what type of answer you expect from reading the data of a node. 19 | * In this example it will return a optional value from a given key in 20 | * the `ExampleRequest.Set`. 21 | * 22 | * TODO: Should we explain how to create multiple `AppDataResponse`? 23 | * 24 | */ 25 | #[derive(Serialize, Deserialize, Debug, Clone)] 26 | pub struct AppResponseData { 27 | pub value: Option>, 28 | } 29 | -------------------------------------------------------------------------------- /src/placement-center/src/raft/typeconfig.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use std::io::Cursor; 16 | 17 | use crate::raft::raft_node::Node; 18 | use crate::raft::route::AppResponseData; 19 | use crate::route::data::StorageData; 20 | 21 | pub type SnapshotData = Cursor>; 22 | 23 | openraft::declare_raft_types!( 24 | pub TypeConfig: 25 | D = StorageData, 26 | R = AppResponseData, 27 | Node = Node, 28 | ); 29 | -------------------------------------------------------------------------------- /src/placement-center/src/server/grpc/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod server; 16 | pub mod service_inner; 17 | pub mod service_journal; 18 | pub mod service_kv; 19 | pub mod service_mqtt; 20 | pub mod service_openraft; 21 | -------------------------------------------------------------------------------- /src/placement-center/src/server/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod grpc; 16 | -------------------------------------------------------------------------------- /src/placement-center/src/storage/journal/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod segment; 16 | pub mod segment_meta; 17 | pub mod shard; 18 | -------------------------------------------------------------------------------- /src/placement-center/src/storage/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod engine; 16 | pub mod journal; 17 | pub mod keys; 18 | pub mod mqtt; 19 | pub mod placement; 20 | pub mod rocksdb; 21 | -------------------------------------------------------------------------------- /src/placement-center/src/storage/placement/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod cluster; 16 | pub mod config; 17 | pub mod idempotent; 18 | pub mod kv; 19 | pub mod node; 20 | pub mod offset; 21 | pub mod schema; 22 | -------------------------------------------------------------------------------- /src/placement-center/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/protocol/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | fn main() -> Result<(), Box> { 16 | robustmq_proto_build::setup()?; 17 | Ok(()) 18 | } 19 | -------------------------------------------------------------------------------- /src/protocol/src/amqp/codec.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/protocol/src/amqp/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod codec; 16 | -------------------------------------------------------------------------------- /src/protocol/src/broker_mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![cfg_attr(any(), rustfmt::skip)] 16 | #![allow(clippy::all)] 17 | 18 | pub mod broker_mqtt_admin { 19 | tonic::include_proto!("broker.mqtt.admin"); 20 | } 21 | 22 | pub mod broker_mqtt_inner { 23 | tonic::include_proto!("broker.mqtt.inner"); 24 | } 25 | -------------------------------------------------------------------------------- /src/protocol/src/kafka/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/protocol/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod amqp; 16 | pub mod broker_mqtt; 17 | pub mod journal_server; 18 | pub mod kafka; 19 | pub mod mqtt; 20 | pub mod placement_center; 21 | -------------------------------------------------------------------------------- /src/protocol/src/mqtt/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod codec; 16 | pub mod common; 17 | pub mod mqttv4; 18 | pub mod mqttv5; 19 | -------------------------------------------------------------------------------- /src/protocol/src/mqtt/mqttv4/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use bytes::{Buf, BufMut, Bytes, BytesMut}; 16 | 17 | use crate::mqtt::common::*; 18 | 19 | pub mod codec; 20 | pub mod connack; 21 | pub mod connect; 22 | pub mod disconnect; 23 | pub mod ping; 24 | pub mod puback; 25 | pub mod pubcomp; 26 | pub mod publish; 27 | pub mod pubrec; 28 | pub mod pubrel; 29 | pub mod suback; 30 | pub mod subscribe; 31 | pub mod unsuback; 32 | pub mod unsubscribe; 33 | -------------------------------------------------------------------------------- /src/protocol/src/mqtt/mqttv4/ping.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::*; 16 | 17 | pub mod pingreq { 18 | use super::*; 19 | 20 | pub fn write(payload: &mut BytesMut) -> Result { 21 | payload.put_slice(&[0xC0, 0x00]); 22 | Ok(2) 23 | } 24 | } 25 | 26 | pub mod pingresp { 27 | use super::*; 28 | 29 | pub fn write(payload: &mut BytesMut) -> Result { 30 | payload.put_slice(&[0xD0, 0x00]); 31 | Ok(2) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/robustmq-macro/tests/expand.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[test] 16 | fn test_validate_req_expand() { 17 | macrotest::expand_args( 18 | "tests/validate_req/expand/*.rs", 19 | &["--features", "validate-req"], 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /src/schema-register/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![allow(clippy::result_large_err)] 16 | pub mod avro; 17 | pub mod json; 18 | pub mod protobuf; 19 | pub mod schema; 20 | -------------------------------------------------------------------------------- /src/schema-register/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/storage-adapter/src/mysql/sql.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE mqtt; 2 | USE mqtt; 3 | -------------------------------------------------------------------------------- /src/storage-adapter/src/s3/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /src/storage-adapter/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod mqtt_build_tool; 16 | -------------------------------------------------------------------------------- /tests/src/mqtt_build_tool/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod build_connack; 16 | pub mod build_connect; 17 | -------------------------------------------------------------------------------- /tests/tests/journal_client/common.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub fn journal_tcp_addr_vec() -> Vec { 16 | vec![journal_tcp_addr()] 17 | } 18 | 19 | pub fn journal_tcp_addr() -> String { 20 | "127.0.0.1:3110".to_string() 21 | } 22 | -------------------------------------------------------------------------------- /tests/tests/journal_client/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod client_test; 16 | pub mod common; 17 | pub mod segment_scroll_test; 18 | mod segment_status_test; 19 | -------------------------------------------------------------------------------- /tests/tests/journal_client/segment_status_test.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(test)] 16 | mod tests { 17 | #[test] 18 | fn segment_status_update() { 19 | // create segment 20 | 21 | // get metadata 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/tests/journal_server/common.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub fn journal_grpc_addr() -> String { 16 | "127.0.0.1:2228".to_string() 17 | } 18 | -------------------------------------------------------------------------------- /tests/tests/journal_server/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod base_test; 16 | pub mod common; 17 | pub mod data_test; 18 | pub mod grpc_admin; 19 | -------------------------------------------------------------------------------- /tests/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod journal_client; 16 | pub mod journal_server; 17 | pub mod mqtt_client; 18 | pub mod mqtt_protocol; 19 | pub mod mqtt_server; 20 | pub mod place_server; 21 | -------------------------------------------------------------------------------- /tests/tests/mqtt_client/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod flapping_detect_test; 16 | mod offline_message_test; 17 | mod slow_sub_test; 18 | mod system_alarm_test; 19 | -------------------------------------------------------------------------------- /tests/tests/mqtt_server/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod cluster_storage_test; 16 | mod observability; 17 | pub mod session_storage_test; 18 | mod topic_rewrite_rule_test; 19 | pub mod topic_storage_test; 20 | pub mod user_storage_test; 21 | -------------------------------------------------------------------------------- /tests/tests/mqtt_server/observability/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod slow_sub_test; 16 | -------------------------------------------------------------------------------- /tests/tests/place_server/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2023 RobustMQ Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod broker_heartbeat_test; 16 | pub mod cluster_node_test; 17 | pub mod common; 18 | pub mod grpc_clients_test; 19 | pub mod kv_storage_test; 20 | pub mod share_sub; 21 | mod topic_rewrite_rule; 22 | --------------------------------------------------------------------------------