-
Notifications
You must be signed in to change notification settings - Fork 917
Java Programming Guide
The Aeron API is designed to be as simple as possible and no simpler. In this guide, we will walk through a set of applications demonstrating specific points as we do. The entire applications can be found in the locations below.
The Aeron Media Driver can be run standalone and handle many applications. However, in some situations, it is desirable to run the media driver within the application.
In this case, a MediaDriver
can be instantiated in the process. Only a single one is needed, but it does require some
resources as discussed here.
When running an embedded media driver, it is recommended to set the following via system properties or directly via MediaDriver.Context
passed into MediaDriver.launch
:
- Buffer Locations should point to a specific location as to not interfere with other Media Driver instances and
- Threading Modes should be considered carefully as they will be spawned within the parent process.
An example of starting up an embedded Media Driver.
final MediaDriver driver = MediaDriver.launch();
Aeron client applications need to coordinate operation with a running Media Driver. Either an embedded one or one that is standalone. This interaction handles creating Publication
s and Subscription
s and housekeeping. The interaction point for the application
is the Aeron
class.
final Aeron aeron = Aeron.connect(new Aeron.Context());
Settings for the instance may be changed via an Aeron.Context
instance that is passed into the Aeron.connect
method. As mentioned here, an Executor
may be passed to this method to have the ClientConductor
thread use said Executor
.
Exception handler
New/Inactive connection handler
comes in from ClientConductor
thread
DirectBuffer
usage and differences between other buffer types.
DirectBuffer
MutableDirectBuffer
UnsafeBuffer
Subscription
instance creation and usage
DataHandler
interface
Subscription.poll
usage and considerations
Publication
instance creation and usage
Fragmentation handler for the application
Publication.offer
returning false
Walk through AeronStat
Walk through Ping/Pong