简单二进制编码(SBE)

简单二进制编码(SBE)-- 高性能信息编解码器。「Simple Binary Encoding (SBE) - High Performance Message Codec」

Github stars Tracking Chart

简单二进制编码(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.



Overview

Name With Ownerreal-logic/simple-binary-encoding
Primary LanguageJava
Program languageC++ (Language Count: 10)
PlatformLinux, Mac, Windows
License:Apache License 2.0
Release Count106
Last Release Name1.31.1 (Posted on )
First Release Name1.0.3-RC2 (Posted on 2014-09-30 14:50:17)
Created At2013-09-03 09:13:34
Pushed At2024-05-01 15:23:12
Last Commit At2024-04-15 15:28:10
Stargazers Count3k
Watchers Count209
Fork Count512
Commits Count3.6k
Has Issues Enabled
Issues Count649
Issue Open Count26
Pull Requests Count285
Pull Requests Open Count5
Pull Requests Close Count54
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Simple Binary Encoding (SBE)

Javadocs
GitHub

Actions Status
Total Alerts
Code Quality: Java

SBE is an OSI layer 6 presentation for
encoding and decoding binary application messages for low-latency financial applications. This repository contains
the reference implementations in Java, C++, Golang, and C#.

Further details on the background and usage of SBE can be found on the
Wiki.

An XSD for SBE specs can be found
here. Please address questions about the specification to the SBE FIX community.

For the latest version information and changes see the Change Log with downloads at Maven Central.

The Java and C++ SBE implementations are designed with work very efficiently with the
Aeron messaging system for low-latency and
high-throughput communications. The Java SBE implementation has a dependency on
Agrona for its buffer implementations.

Binaries

Binaries and dependency information for Maven, Ivy, Gradle, and others can be found at
http://search.maven.org.

Example for Maven:

<dependency>
    <groupId>uk.co.real-logic</groupId>
    <artifactId>sbe-all</artifactId>
    <version>1.16.1</version>
</dependency>

Build

The project is built with Gradle using this build.gradle file.

Full clean build:

$ ./gradlew

Run the Java examples

$ ./gradlew runJavaExamples

Distribution

Jars for the executable, source, and javadoc for the various modules can be found in the following directories:

sbe-benchmarks/build/libs
sbe-samples/build/libs
sbe-tool/build/libs
sbe-all/build/libs

An example to execute a Jar from command line using the 'all' jar which includes the Agrona dependency:

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-1.16.1.jar my-sbe-messages.xml

C++ Build using CMake

NOTE: Linux, Mac OS, and Windows only for the moment. See
FAQ.
Windows builds have been tested with Visual Studio Express 12.

For convenience, a script is provided that does a full clean, build, and test of all targets as a Release build.

$ ./cppbuild/cppbuild

If you are comfortable with using CMake, then a full clean, build, and test looks like:

$ mkdir -p cppbuild/Debug
$ cd cppbuild/Debug
$ cmake ../..
$ cmake --build . --clean-first
$ ctest

Note: A C generator is included with the C++ build. And is built with the C++ build. Currently, the C generator is
a work in progress.

Golang Build

First build using Gradle to generate the SBE jar and then use it to
generate the golang code for testing

$ ./gradlew
$ ./gradlew generateGolangCodecs

For convenience on Linux, a gnu Makefile is provided that runs some
tests and contains some examples

$ cd gocode
# make # test, examples, bench

Users of golang generated code should see the user
documentation
.

Developers wishing to enhance the golang generator should see the developer
documentation

C# Build

Users of CSharp generated code should see the user documentation.

Developers wishing to enhance the CSharp generator should see the developer documentation

License (See LICENSE file for full license)

Copyright 2013-2020 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.

To the top