Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EV369: Message queue buffering #284

Merged
merged 8 commits into from
Dec 6, 2023

Conversation

klemmpnx
Copy link
Contributor

First PR addressing EV-369 to control the message buffer (addresses the "QueueAllMessages" configuration in OCPP 2.0.1.)

Implemented features:

  • Add QueueAllMessage parameter to queue also non-transactional messages
  • Add maximum queue size threshold to limit the queue size / potentially drop messages

Missing: This PR yet misses the capability to drop intermediate transaction events (in a follow-up PR)

Implementation details:

  • Extract MessageQueue config into a dedicated struct (for better handling); slight refactoring of ChargePointImpl in OCPP 1.6
  • add parameters for limiting queue size and Queueing all message types (added in OCPP schemas)
  • add check for message sizes and removal logic
  • restructure unit tests (common executable for unit tests; structure according to source files adapt CMakeLists accordingly;)

…nt dropping non-transactional; tests

- Extract MessageQueue config into dedicated struct
- add parameters for limiting queue size and Queueing all message types
- add check for message sizes and removal logic
- restructure unit tests (common executuable)

Signed-off-by: Fabian Klemm <[email protected]>
Signed-off-by: Fabian Klemm <[email protected]>
Signed-off-by: Fabian Klemm <[email protected]>
Signed-off-by: Fabian Klemm <[email protected]>
@klemmpnx klemmpnx requested a review from hikinggrass November 29, 2023 11:45
@klemmpnx klemmpnx self-assigned this Nov 29, 2023
Signed-off-by: Fabian Klemm <[email protected]>
[this](json message) -> bool { return this->websocket->send(message.dump()); },
MessageQueueConfig{this->configuration->getTransactionMessageAttempts(),
this->configuration->getTransactionMessageRetryInterval(),
this->configuration->getMessageQueueSizeThreshold().value_or(2E5),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2E5 should probably be defined in a constant

this->device_model->get_value<int>(ControllerComponentVariables::MessageAttempts),
this->device_model->get_value<int>(ControllerComponentVariables::MessageAttemptInterval),
this->device_model->get_optional_value<int>(ControllerComponentVariables::MessageQueueSizeThreshold)
.value_or(2E5),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reuse the (to be added) constant from ocpp 1.6 charge point

@@ -0,0 +1,362 @@
#include <gmock/gmock.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing the license header

Suggested change
#include <gmock/gmock.h>
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest
#include <gmock/gmock.h>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is also missing its license header

// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest

Copy link
Contributor

@hikinggrass hikinggrass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 just a few small things

@klemmpnx klemmpnx requested a review from hikinggrass December 6, 2023 10:20
Signed-off-by: Fabian Klemm <[email protected]>
@corneliusclaussen corneliusclaussen merged commit d0b429b into main Dec 6, 2023
@corneliusclaussen corneliusclaussen deleted the feature/fk-ev369-message-queue-buffering branch December 6, 2023 16:30
couryrr-afs pushed a commit to US-JOET/libocpp that referenced this pull request Dec 18, 2023
* MessageQueue: add config struct; add parameters for queueing; implement dropping non-transactional; tests

- Extract MessageQueue config into dedicated struct
- add parameters for limiting queue size and Queueing all message types
- add check for message sizes and removal logic
- restructure unit tests (common executuable)

* add v201 config var for queue size threshold
* add queue config parameters
* remove temporary tests
* add missing test resources
* clang format
* add missing constants; add missing headers

Signed-off-by: Fabian Klemm <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants