SObjectizer-5.5.21 and so_5_extra-1.0.4

2018.02.08

We have updated SObjectizer to version 5.5.21.

The v.5.5.21 has several additions/changes which are listed in the corresponding Wiki section.

The most significant addition of v.5.5.21 is an ability to subscribe a deadletter handler. This deadletter handler will receive a message if there is no any other event handlers for that message. And the deadletter handler will be called regardless of the current state of the agent. Because of that deadletter handler can be used for implementation of default message handlers if any other approaches are not applicable. See [so-5.5.21 Deadletter Handlers] for more information.

We have also released another version of our companion project so_5_extra which is built on top of SObjectizer.

The v.1.0.4 of so_5_extra adds such thing as async operations: [so5extra 1.0 Async Operations]. Async operation are intended to significantly reduce the amount of code required for implementation of one-time interaction between agents. For example, with async_op a developer can write code like that:

class request_manager : public so_5::agent_t {
   struct request_timed_out {
      user_id user_;
      request_id id_;
   };
   ...
   void on_successful_result(mhood_t<request_successed> cmd) {...}
   void on_failed_result(mhood_t<request_failed> cmd) {...}
   void on_timeout(mhood_t<request_timed_out> cmd) {...}
   ...
   void on_new_request(mhood_t<request_data> cmd) {
      // Detect who will process the request.
      const auto processor_mbox = detect_processor_for_req(*cmd);

      // Prepare async operation of handling the request.
      so_5::extra::async_op::time_limited::make<request_timed_out>(*this)
         .completed_on(processor_mbox, so_default_state(),
            &request_manager::on_successful_result)
         .completed_on(processor_mbox, so_default_state(),
            &request_manager::on_failed_result)
         .timeout_handler(so_default_state(),
            &request_manager::on_timeout)
         .activate(5s, cmd->user_, cmd->id_);

      // Transfer request processing to actual processor.
      so_5::send(processor_mbox, cmd);
   }
   ...
};

The trick is an automatic subscription and unsubscription of completion and timeout handlers, and also automatic handling of timeout message/signals (with automatic cancellation of timeout message/signal when the operation completes).

The SObjectizer v.5.5.21 can be downloaded from the corresponding Files section or can be checked out from Subversion repository and from mirror on GitHub.

The latest version of SObjectizer can be also installed via vcpkg package manager by the command:
vcpkg install sobjectizer.

Source code of so_4_extra-1.0.4 can be obtained from the repository or can be downloaded from Files section.