AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <CertifiedSender.h>
Public Member Functions | |
virtual | ~CertifiedSender () |
std::future< bool > | sendJSONMessage (const std::string &jsonMessage, const std::string &uriPathExtension="") |
void | clearData () override |
Public Member Functions inherited from alexaClientSDK::avsCommon::utils::RequiresShutdown | |
RequiresShutdown (const std::string &name) | |
virtual | ~RequiresShutdown () |
Destructor. More... | |
const std::string & | name () const |
void | shutdown () |
bool | isShutdown () const |
Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface | |
virtual | ~ConnectionStatusObserverInterface ()=default |
virtual void | onConnectionStatusChanged (const Status status, const std::vector< EngineConnectionStatus > &engineStatuses) |
Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandler | |
CustomerDataHandler (const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &dataManager) | |
virtual | ~CustomerDataHandler () |
Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandlerInterface | |
virtual | ~CustomerDataHandlerInterface ()=default |
Static Public Member Functions | |
static std::shared_ptr< CertifiedSender > | create (std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::AVSConnectionManagerInterface > connection, std::shared_ptr< MessageStorageInterface > storage, std::shared_ptr< registrationManager::CustomerDataManagerInterface > dataManager) |
This class provides a guaranteed message delivery service to AVS. Upon calling the single api, sendJSONMessage
, this class will persist the message and continually attempt sending it until it succeeds. The persistence will work across application runs, dependent on the nature of the storage object provided.
To avoid excessive memory usage, the maximum number of messages stored in this way is configurable via the settings 'queueSizeWarnLimit' and 'queueSizeHardLimit', under the configuration root 'certifiedSender'.
Similarly, the file path for the database storage is configured under the setting 'databaseFilePath'.
This class maintains the ordering of messages passed to it. For example, if sendJSONMessage
is invoked with messages A then B then C, then this class guarantees that the messages will be sent to AVS in the same order - A then B then C.
|
virtual |
Destructor.
|
overridevirtual |
Clear all messages that we are currently storing
Implements alexaClientSDK::registrationManager::CustomerDataHandlerInterface.
|
static |
This function creates a new instance of a CertifiedSender
. If it fails for any reason, nullptr
is returned.
messageSender | The entity which is able to send MessageRequests to AVS. |
connection | The connection which may be observed to determine connection status. |
storage | The object which manages persistent storage of messages to be sent. |
dataManager | A dataManager object that will track the CustomerDataHandler. |
CertifiedSender
object, or nullptr
if there is any problem. std::future<bool> alexaClientSDK::certifiedSender::CertifiedSender::sendJSONMessage | ( | const std::string & | jsonMessage, |
const std::string & | uriPathExtension = "" |
||
) |
Function to request a message be sent to AVS. Since this class is strictly responsible for sending a message to AVS, the parameter is explicitly described as being in JSON format. This will be expected to take the form of some kind of Event which AVS understands. While the sending of the message is entirely asynchronous, the future returned allows the caller to know if the request was successfully persisted. Once the message is persisted, the caller can expect the message to be sent to AVS at some point in the future by this class.
jsonMessage | The message to be sent to AVS. |
uriPathExtension | An optional uri path extension to be appended to the base url of the AVS endpoint. If not specified, the default AVS path extension will be used. |
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0