AlexaClientSDK  1.18.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::certifiedSender::CertifiedSender Class Reference

#include <CertifiedSender.h>

Inheritance diagram for alexaClientSDK::certifiedSender::CertifiedSender:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::certifiedSender::CertifiedSender:
Collaboration graph
[legend]

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
 
- Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandler
 CustomerDataHandler (std::shared_ptr< CustomerDataManager > customerDataManager)
 
virtual ~CustomerDataHandler ()
 

Static Public Member Functions

static std::shared_ptr< CertifiedSendercreate (std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::AVSConnectionManagerInterface > connection, std::shared_ptr< MessageStorageInterface > storage, std::shared_ptr< registrationManager::CustomerDataManager > dataManager)
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface
enum  Status { Status::DISCONNECTED, Status::PENDING, Status::CONNECTED }
 
enum  ChangedReason {
  ChangedReason::NONE, ChangedReason::SUCCESS, ChangedReason::UNRECOVERABLE_ERROR, ChangedReason::ACL_CLIENT_REQUEST,
  ChangedReason::ACL_DISABLED, ChangedReason::DNS_TIMEDOUT, ChangedReason::CONNECTION_TIMEDOUT, ChangedReason::CONNECTION_THROTTLED,
  ChangedReason::INVALID_AUTH, ChangedReason::PING_TIMEDOUT, ChangedReason::WRITE_TIMEDOUT, ChangedReason::READ_TIMEDOUT,
  ChangedReason::FAILURE_PROTOCOL_ERROR, ChangedReason::INTERNAL_ERROR, ChangedReason::SERVER_INTERNAL_ERROR, ChangedReason::SERVER_SIDE_DISCONNECT,
  ChangedReason::SERVER_ENDPOINT_CHANGED
}
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~CertifiedSender()

alexaClientSDK::certifiedSender::CertifiedSender::~CertifiedSender ( )
virtual

Destructor.

Member Function Documentation

◆ clearData()

void alexaClientSDK::certifiedSender::CertifiedSender::clearData ( )
overridevirtual

Clear all messages that we are currently storing

Implements alexaClientSDK::registrationManager::CustomerDataHandler.

◆ create()

std::shared_ptr< CertifiedSender > alexaClientSDK::certifiedSender::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::CustomerDataManager dataManager 
)
static

This function creates a new instance of a CertifiedSender. If it fails for any reason, nullptr is returned.

Parameters
messageSenderThe entity which is able to send MessageRequests to AVS.
connectionThe connection which may be observed to determine connection status.
storageThe object which manages persistent storage of messages to be sent.
dataManagerA dataManager object that will track the CustomerDataHandler.
Returns
A CertifiedSender object, or nullptr if there is any problem.

◆ sendJSONMessage()

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.

Parameters
jsonMessageThe message to be sent to AVS.
uriPathExtensionAn 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.
Returns
A future expressing if the message was successfully persisted.

The documentation for this class was generated from the following files:

AlexaClientSDK 1.18.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0