ccapi: Upgrade to v5.31.2
This commit is contained in:
1 parent
b91431e518
commit
7a3fae62c3
32 files changed
+203
-17
No files matched your search
@@ -203,6 +203,12 @@
|
||||
#include "ccapi_cpp/service/ccapi_service_context.h"
|
||||
using steady_timer = boost::asio::steady_timer;
|
||||
namespace ccapi {
|
||||
/**
|
||||
* This class provides a consumer session for making requests and subscriptions for services. Sessions manage access to services either by requests and
|
||||
* responses or subscriptions. A Session can dispatch events and replies in either an immediate or batching mode. The mode of a Session is determined when it is
|
||||
* constructed and cannot be changed subsequently. A Session is immediate if an EventHandler object is supplied when it is constructed. All incoming events are
|
||||
* delivered to the EventHandler supplied on construction. A Session is batching if an EventHandler object is not supplied when it is constructed.
|
||||
*/
|
||||
class Session {
|
||||
public:
|
||||
Session(const Session&) = delete;
|
||||
@@ -614,6 +620,18 @@ class Session {
|
||||
} else {
|
||||
if (this->eventHandler) {
|
||||
CCAPI_LOGGER_TRACE("handle event in immediate mode");
|
||||
#ifdef CCAPI_USE_SINGLE_THREAD
|
||||
bool shouldContinue = true;
|
||||
try {
|
||||
shouldContinue = this->eventHandler->processEvent(event, this);
|
||||
} catch (const std::runtime_error& e) {
|
||||
CCAPI_LOGGER_ERROR(e.what());
|
||||
}
|
||||
if (!shouldContinue) {
|
||||
CCAPI_LOGGER_DEBUG("about to pause the event dispatcher");
|
||||
this->eventDispatcher->pause();
|
||||
}
|
||||
#else
|
||||
this->eventDispatcher->dispatch([that = this, event = std::move(event)] {
|
||||
bool shouldContinue = true;
|
||||
try {
|
||||
@@ -626,6 +644,7 @@ class Session {
|
||||
that->eventDispatcher->pause();
|
||||
}
|
||||
});
|
||||
#endif
|
||||
} else {
|
||||
CCAPI_LOGGER_TRACE("handle event in batching mode");
|
||||
this->eventQueue.pushBack(std::move(event));
|
||||
|
||||
Reference in new issue
Block a user