#include <publisher.h>
Public Member Functions | |
virtual void | addPublisherStateListener (const std::function< void(const PublisherState &)> &listener) |
Aws::DataFlow::UploadStatus | attemptPublish (T &data) override |
bool | canPublish () |
std::chrono::milliseconds | getLastPublishDuration () |
int | getPublishAttempts () |
PublisherState | getPublisherState () |
int | getPublishSuccesses () |
float | getPublishSuccessPercentage () |
Publisher () | |
bool | shutdown () override |
~Publisher () override=default | |
Public Member Functions inherited from Service | |
ServiceState | getState () |
virtual std::string | getStatusString () |
Service () | |
virtual bool | start () |
virtual | ~Service ()=default |
Protected Member Functions | |
virtual Aws::DataFlow::UploadStatus | publishData (T &data)=0 |
Protected Member Functions inherited from Service | |
void | setState (ServiceState new_state) |
Private Attributes | |
std::atomic< std::chrono::milliseconds > | last_publish_duration_ {} |
std::atomic< int > | publish_attempts_ {} |
std::mutex | publish_mutex_ |
std::atomic< int > | publish_successes_ {} |
ObservableObject< PublisherState > | publisher_state_ |
Base class implementing the Aws::FileManagement::IPublisher interface.
Overriding classes should provide the mechanisms to initialize / configure their respective components.
T | the type to publish |
Definition at line 46 of file publisher.h.
Definition at line 51 of file publisher.h.
|
inlinevirtual |
Provide the registration mechanism for ObservableObject (in this case PublisherState) changes.
listener | the PublisherState listener |
Definition at line 172 of file publisher.h.
|
inlineoverridevirtual |
Attempt to publish data to CloudWatch if this service is in the started state.
data | the data to publish |
Implements Aws::DataFlow::IPublisher< T >.
Definition at line 75 of file publisher.h.
|
inline |
Return true if this publisher can send data to CloudWatch, false otherwise.
Definition at line 121 of file publisher.h.
|
inline |
Return the time taken for the last publish attempt
Definition at line 147 of file publisher.h.
|
inline |
|
inline |
|
inline |
|
inline |
Calculate and return the success rate of this publisher.
Definition at line 157 of file publisher.h.
|
protectedpure virtual |
Actual publishing mechanism implemented by the agent.
data |
Implemented in SimpleTestPublisher.
|
inlineoverridevirtual |
Shutdown the publisher. This waits for attemptPublish to finish before returning.
Reimplemented from Service.
Definition at line 108 of file publisher.h.
|
private |
The amount of time taken for the last publish action
Definition at line 202 of file publisher.h.
|
private |
Number of publish attempts
Definition at line 198 of file publisher.h.
|
mutableprivate |
Mutex used in publish and shutdown
Definition at line 206 of file publisher.h.
|
private |
Number of publish successes
Definition at line 194 of file publisher.h.
|
private |
Track the publish state in a thread safe container which can provide events to registered listeners.
Definition at line 190 of file publisher.h.