summaryrefslogtreecommitdiff
path: root/redfish-core/include/event_service_manager.hpp
diff options
context:
space:
mode:
authorAyushi Smriti <smriti.ayushi@linux.intel.com>2020-05-15 12:54:45 +0300
committersmriti.ayushi <smriti.ayushi@linux.intel.com>2020-07-02 04:14:02 +0300
commitfe44eb0b4b46fa3a96f445df05e962e15e5d337d (patch)
tree7d968bbec8adb9916e8f73eb5ae4a04324626ace /redfish-core/include/event_service_manager.hpp
parentc0557e1acd060cbc7d68befd5659d081c1a7fdb0 (diff)
downloadbmcweb-fe44eb0b4b46fa3a96f445df05e962e15e5d337d.tar.xz
EventService: Add retry configuration support
This commit is to pass configuration parameters: retry attempts, retry interval secs and retry policy to http client and take required delivery retry policy action. Also, perform async wait for retryTimeoutInterval before each retry attempts. Tested: - Set and verified config properties by sending PATCH req on EventService and EventDestination uri. - Verified the appropriate delivery retry policy action block reached. - Verified the async_wait logic by triggering retry case depending failed state of connection. - could see a wait for timeout interval before next retry. Signed-off-by: Ayushi Smriti <smriti.ayushi@linux.intel.com> Change-Id: Id1366fca59dc9e6543c553bfe5df95a59f468bc7 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
Diffstat (limited to 'redfish-core/include/event_service_manager.hpp')
-rw-r--r--redfish-core/include/event_service_manager.hpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index c11e31bbb9..7c964207c6 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -292,7 +292,8 @@ class Subscription
host(inHost), port(inPort), path(inPath), uriProto(inUriProto)
{
conn = std::make_shared<crow::HttpClient>(
- crow::connections::systemBus->get_io_context(), host, port, path);
+ crow::connections::systemBus->get_io_context(), id, host, port,
+ path);
}
~Subscription()
{}
@@ -444,6 +445,17 @@ class Subscription
this->sendEvent(msg.dump());
}
+ void updateRetryConfig(const uint32_t retryAttempts,
+ const uint32_t retryTimeoutInterval)
+ {
+ conn->setRetryConfig(retryAttempts, retryTimeoutInterval);
+ }
+
+ void updateRetryPolicy()
+ {
+ conn->setRetryPolicy(retryPolicy);
+ }
+
private:
uint64_t eventSeqNum;
std::string host;
@@ -677,6 +689,7 @@ class EventServiceManager
void setEventServiceConfig(const EventServiceConfig& cfg)
{
bool updateConfig = false;
+ bool updateRetryCfg = false;
if (serviceEnabled != std::get<0>(cfg))
{
@@ -696,18 +709,31 @@ class EventServiceManager
{
retryAttempts = std::get<1>(cfg);
updateConfig = true;
+ updateRetryCfg = true;
}
if (retryTimeoutInterval != std::get<2>(cfg))
{
retryTimeoutInterval = std::get<2>(cfg);
updateConfig = true;
+ updateRetryCfg = true;
}
if (updateConfig)
{
updateSubscriptionData();
}
+
+ if (updateRetryCfg)
+ {
+ // Update the changed retry config to all subscriptions
+ for (const auto& it :
+ EventServiceManager::getInstance().subscriptionsMap)
+ {
+ std::shared_ptr<Subscription> entry = it.second;
+ entry->updateRetryConfig(retryAttempts, retryTimeoutInterval);
+ }
+ }
}
void updateNoOfSubscribersCount()
@@ -791,6 +817,10 @@ class EventServiceManager
cacheLastEventTimestamp();
}
#endif
+ // Update retry configuration.
+ subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval);
+ subValue->updateRetryPolicy();
+
return id;
}