Make eventId increment per event
Currently, eventId is incremented for each subscriber even for the same
event. So, this is to increment eventId per event.
Tested:
- Run multiple instance of event listeners
- Generate an event like
```
curl -k -H "X-Auth-Token: $bmc_token" -H "Content-Type: application/json" \
-X POST https://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData \
-d '{"DiagnosticDataType":"Manager"}'
```
- Check the EventId whether it is incremented per event
```
"@odata.type": "#Event.v1_4_0.Event",
"Events": [
{
...
"MessageId": "TaskEvent.1.0.3.TaskStarted",
"MessageSeverity": "OK",
"OriginOfCondition": "/redfish/v1/TaskService/Tasks/0",
"Resolution": "None."
}
],
"Id": 2, <===
"Name": "Event Log"
}
```
Change-Id: I7a1f61cb932068cac5a50838fefeeaf880516a97
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 7fac1f9..ad756df 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -660,8 +660,8 @@
std::string strMsg = msgJson.dump(
2, ' ', true, nlohmann::json::error_handler_t::replace);
entry->sendEventToSubscriber(std::move(strMsg));
- eventId++; // increment the eventId
}
+ eventId++; // increment the eventId
}
};