Aeron
=====
[![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/real-logic/Aeron?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) To chat with other Aeron users and the contributors.
[![Javadocs](https://www.javadoc.io/badge/io.aeron/aeron-all.svg)](https://www.javadoc.io/doc/io.aeron/aeron-all)
[![Build Status](https://travis-ci.org/real-logic/aeron.svg?branch=master)](https://travis-ci.org/real-logic/aeron)
[![GitHub](https://img.shields.io/github/license/real-logic/Aeron.svg)](https://github.com/real-logic/aeron/blob/master/LICENSE)
[![Code Quality: Java](https://img.shields.io/lgtm/grade/java/g/real-logic/aeron.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/real-logic/aeron/context:java)
[![Code Quality: C/C++](https://img.shields.io/lgtm/grade/cpp/g/real-logic/aeron.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/real-logic/aeron/context:cpp)
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/real-logic/aeron.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/real-logic/aeron/alerts)
Efficient reliable UDP unicast, UDP multicast, and IPC message transport. Java and C++ clients are available in this
repository, and a [.NET client](https://github.com/AdaptiveConsulting/Aeron.NET) is available from a 3rd party. All
three clients can exchange messages across machines, or on the same machine via IPC, very efficiently. Message streams
can be recorded by the [Archive](https://github.com/real-logic/aeron/tree/master/aeron-archive) module to persistent
storage for later, or real-time, replay.
Performance is the key focus. Aeron is designed to be the highest throughput with the lowest and most predictable
latency possible of any messaging system. Aeron integrates with
[Simple Binary Encoding (SBE)](https://github.com/real-logic/simple-binary-encoding) for the best possible performance
in message encoding and decoding. Many of the data structures used in the creation of Aeron have been factored out to
the [Agrona](https://github.com/real-logic/agrona) project.
For details of usage, protocol specification, FAQ, etc. please check out the
[Wiki](https://github.com/real-logic/aeron/wiki).
For those who prefer to watch a video then try [Aeron Messaging](https://www.youtube.com/watch?v=tM4YskS94b0) from
StrangeLoop 2014. Things have advanced quite a bit with performance and features but the basic design still applies.
For the latest version information and changes see the [Change Log](https://github.com/real-logic/aeron/wiki/Change-Log)
with Java **downloads** at [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Caeron).
### How do I use Aeron?
1. [Java Programming Guide](https://github.com/real-logic/aeron/wiki/Java-Programming-Guide)
1. [C++11 Programming Guide](https://github.com/real-logic/aeron/wiki/Cpp-Programming-Guide)
1. [Best Practices Guide](https://github.com/real-logic/aeron/wiki/Best-Practices-Guide)
1. [Monitoring and Debugging](https://github.com/real-logic/aeron/wiki/Monitoring-and-Debugging)
1. [Configuration Options](https://github.com/real-logic/aeron/wiki/Configuration-Options)
1. [Channel Specific Configuration](https://github.com/real-logic/aeron/wiki/Channel-Configuration)
1. [Aeron Archive (Durable/Persistent Stream Storage)](https://github.com/real-logic/aeron/wiki/Aeron-Archive)
### How does Aeron work?
1. [Transport Protocol Specification](https://github.com/real-logic/aeron/wiki/Transport-Protocol-Specification)
1. [Design Overview](https://github.com/real-logic/aeron/wiki/Design-Overview)
1. [Design Principles](https://github.com/real-logic/aeron/wiki/Design-Principles)
1. [Flow Control Semantics](https://github.com/real-logic/aeron/wiki/Flow-and-Congestion-Control)
1. [Media Driver Operation](https://github.com/real-logic/aeron/wiki/Media-Driver-Operation)
### How do I hack on Aeron?
1. [Hacking on Aeron](https://github.com/real-logic/aeron/wiki/Hacking-on-Aeron)
1. [Performance Testing](https://github.com/real-logic/aeron/wiki/Performance-Testing)
Build
-----
### Java Build
The project is built with [Gradle](http://gradle.org/) using this
[build.gradle](https://github.com/real-logic/aeron/blob/master/build.gradle) file.
You require the following to build Aeron:
* [JDK 8](https://adoptopenjdk.net/index.html) or later, Java versions before 1.8.0_65 are very buggy and can cause tests to fail. Aeron is tested and supported on Java 8 & Java 11.
You must first build and install [Agrona](https://github.com/real-logic/agrona) and
[Simple Binary Encoding (SBE)](https://github.com/real-logic/simple-binary-encoding) into the local maven repository **if** the current master for Aeron depends on changes to Agrona or SBE. However we will try to not have this as the typical case.
```shell
$ ./gradlew
```
After Agrona & SBE are compiled and installed, then you can build Aeron.
Full clean and build of all modules
```shell
$ ./gradlew
```
### C++ Build
You require the following to build the C++ API for Aeron:
* 3.1.3 or higher of [CMake](http://www.cmake.org/)
* C++11 supported compiler for the supported platform
* C11 supported compiler for the supported platform
* Requirements to build [HdrHistogram_c](https://github.com/HdrHistogram/HdrHistogram_c). HdrHistogram requires
`zlib.h` currently. So on Ubuntu:
```shell
$ sudo apt-get install libz-dev
```
__Note__: Aeron is supported on Linux, Mac, and Windows. Windows builds require Visual Studio and are being developed
with Visual Studio 2017 with 64-bit builds only. Cygwin, MSys, etc. may work, but are not maintained at this time.
Windows builds require 7z to unzip the zlib source archive.
For convenience, a script is provided that does a full clean, build, and test of all targets as a Release build.
```shell
$ ./cppbuild/cppbuild
```
If you are comfortable with using CMake, then a full clean, build, and test looks like:
```shell
$ mkdir -p cppbuild/Debug
$ cd cppbuild/Debug
$ cmake ../..
$ cmake --build . --clean-first
$ ctest
```
#### C Media Driver
By default, the C Media Driver is built as part of the C++ Build. However, it can be disabled via the CMake
option `BUILD_AERON_DRIVER` being set to `OFF`.
__Note__: C Media Driver is currently only supported on Mac and Linux (Windows version is experimental).
For dependencies and other information, see the
[README](https://github.com/real-logic/aeron/blob/master/aeron-driver/src/main/c/README.md).
#### Documentation
If you have doxygen installed and want to build the Doxygen doc, there is a nice `doc` target that can be used.
```shell
$ make doc
```
#### Packaging
If you would like a packaged version of the compiled API, there is the `package` target that uses CPack. If the doc
has been built previous to the packaging, it will be included. Packages created are "TGZ;STGZ", but can be changed
by running `cpack` directly.
```shell
$ make package
```
Running Samples
---------------
Start up a media driver which will create the data and conductor directories. On Linux, this will probably be in
`/dev/shm/aeron` or `/tmp/aeron`.
```shell
$ java -cp aeron-samples/build/libs/samples.jar io.aeron.driver.MediaDriver
```
Alternatively, specify the data and conductor directories. The following example uses the shared memory 'directory' on
Linux, but you could just as easily point to the regular filesystem.
```shell
$ java -cp aeron-samples/build/libs/samples.jar -Daeron.dir=/dev/shm/aeron io.aeron.driver.MediaDriver
```
You can run the `BasicSubscriber` from a command line. On Linux, this will be pointing to the `/dev/shm` shared memory
directory, so be sure your `MediaDriver` is doing the same!
```shell
$ java -cp aeron-samples/build/libs/samples.jar io.aeron.samples.BasicSubscriber
```
You can run the `BasicPublisher` from a command line. On Linux, this will be pointing to the `/dev/shm` shared memory
directory, so be sure your `MediaDriver` is doin