简单二进制编码(SBE)
SBE 是 OSI 的第 6 层表示,用于为低延迟的金融应用程序编码和解码二进制应用程序消息。这个资源库包含了 Java、C++、Golang 和 C# 中的参考实现。
关于 SBE 的设计和使用的更多细节可以在 Wiki 上找到。
SBE 规范的 XSD 可以在 这里 找到。请向 SBE FIX 社区 提出关于规范的问题。
有关最新版本信息和变更,请参阅在 Maven Central 上的下载中的变更日志。
Java 和 C++ 的 SBE 实现与 Aeron 消息传递系统一起高效地实现了低延迟和高吞吐量的通信。Java SBE 实现的缓冲区实现依赖于 Agrona。商业支持可以从 sales@real-logic.co.uk 获得。
二进制文件
Maven、Ivy、Gradle 等的二进制文件和依赖性信息可在 http://search.maven.org 上找到。
Maven 的例子
<dependency> <groupId>uk.co.real-logic</groupId> <artifactId>sbe-all</artifactId> <version>${sbe.tool.version}</version> </dependency>
构建
使用这个 build.gradle 文件,用 Gradle 构建项目。
完整地构建
$ ./gradlew
运行 Java 实例
$ ./gradlew runJavaExamples
分发
各种模块的可执行文件、源代码和 javadoc 的 jar 文件可以在下面的目录中找到。
sbe-benchmarks/build/libs sbe-samples/build/libs sbe-tool/build/libs sbe-all/build/libs
下面是一个使用包含 Agrona 依赖项的'all' Jar 从命令行执行 Jar 的例子:
java -Dsbe.generate.ir=true -Dsbe.target.language=Cpp -Dsbe.target.namespace=sbe -Dsbe.output.dir=include/gen -Dsbe.errorLog=yes -jar sbe-all/build/libs/sbe-all-${SBE_TOOL_VERSION}.jar my-sbe-messages.xml
使用 CMake 构建 C++
注意:目前只有 Linux、Mac OS 和 Windows。请参见 FAQ。Windows 的构建已经用 Visual Studio Express 12 进行了测试。
为方便起见,cppbuild 脚本对所有目标进行了全面的清理、构建和测试,作为发布版构建。
$ ./cppbuild/cppbuild
如果你能熟练使用 CMake,那么一个完整的清洁、构建和测试看起来像:
$ mkdir -p cppbuild/Debug $ cd cppbuild/Debug $ cmake ../.. $ cmake --build . --clean-first $ ctest
注意:C++ 版本包括 C 语言生成器。目前,C 语言生成器是一项正在进行的工作。
Golang 构建
首先使用 Gradle 构建,生成 SBE jar,然后用它生成 Golang 代码进行测试。
$ ./gradlew $ ./gradlew generateGolangCodecs
为了在 Linux 上的方便,提供了一个 gnu Makefile,运行一些测试并包含一些例子。
$ cd gocode # make # test, examples, bench
使用 golang 生成的代码的用户应该查看 用户文档。
希望增强 golang 生成器的开发者应该看 开发者文档。
C# 构建
生成 CSharp 代码的用户应该看 用户文档。
希望增强CSharp生成器的开发者应参阅 开发者文档。
许可证(完整的许可证见 LICENSE 文件)
Copyright 2013-2021 Real Logic Limited.
Copyright 2017 MarketFactory Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.