C++ Actor Framework — Dev Blog

An Open Source implementation of the actor model in C++

Version 0.16 Finally Released!

We are excited to announce version 0.16 of the C++ Actor Framework! Among other features and improvements, this release adds experimental support for streams.

Streams in CAF are now the fourth pillar of our communication layer and complement asnychronous messaging, publish/subscribe groups, and request/response protocols. Fundamentally, streams give you bounded queueing of pipelined messages with backpressure. This means they provide a safe channel for sending arbitrary amounts of data without worrying about overloading receivers.

Of course streams are first-class citizens in CAF. Actors can have any number of active streams and can modify existing streams at runtime, for example by adding more sources or sinks to it. This gives actors a powerful new tool that required a lot of changes under the hood. Without going into too much detail, actor mailboxes now consist of several internal queues that allow seamless multiplexing of regular actor messages and stream traffic. You can find an introduction to streams with code examples in our new manual section.

Expect your projects to run and compile after updating to 0.16, since this release brings no breaking changes. However, you might get warnings for deprecated member variables in actor_system_config. We have improved support for runtime configurations in CAF by adding lists, durations and dictionaries and made settings available by name instead of requiring access to member variables:

// Deprecated API:
auto verbosity = cfg.logger_verbosity;

// New API:
auto verbosity = get_or(cfg, "logger.verbosity", defaults::logger::verbosity);

CAF 0.16 bundles constants unter defaults::<component>. This may seem like strictly more overhead and typing at first, but now you can access custom options in the same way, without having to know the subtype in order to access some member variable. Your application could add the option database.host, for example, and you would access it directly from the system-wide config. No downcasting to the subtype of actor_config_server required.

Got no default? Use get_if or get instead. The API is modelled after C++17’s get_if, and get, i.e., you could query a parameter as follows:

auto host = get_if<std::string>(&cfg, "database.host");
if (!host) {
  std::cerr << "database host missing" << std::endl;
  // ...
} else {
  std::cout << "connect to database host " << *host << std::endl;
  // ...
Version 0.15.1 Released!

Version 0.15.1 of CAF has just released. This patch removes the non-null guarantee on actor handles. While the non-null guarantee is a nice property and allows for cleaner code in some parts in CAF, the absence of a default constructor puts obstacles in the way of developers trying to port from earlier version of CAF. Also, using actor handles in containers or optional was painful. Sending messages to invalid handles is a no-op, no checking by the user required.

Further changes:

  • Fix handling of integer types in actor_system_config for custom parameters
  • Fix a possible race when spawning function-based actors
  • Avoid ambiguous overload with inspect() when serializing/deserializing
  • Deprecate .unsafe() (simply use bool conversion instead)
  • Fix spawn_in_group<T>
  • Fix a bug that matched any atom when querying type-erased tuple directly
  • Remove all try/catch blocks when compiling CAF with CAF_NO_EXCEPTIONS
  • Mark optional<T>’s move ctor/assignment noexcept if noexcept in T
Version 0.15 is Out!

Just a quick announcement: CAF 0.15 is finally out! We delayed the release due to two last minute bug fixes. With 0.15 out in the wild, we can start working on exciting new features again.