#include <cloudwatch_service.h>
Public Member Functions | |
virtual bool | batchData (const D &data_to_batch) |
virtual bool | batchData (const D &data_to_batch, const std::chrono::milliseconds &milliseconds) |
CloudWatchService (std::shared_ptr< Publisher< std::list< T >>> publisher, std::shared_ptr< DataBatcher< T >> batcher) | |
virtual std::chrono::milliseconds | getCurrentTimestamp () |
virtual std::chrono::milliseconds | getDequeueDuration () |
int | getNumberDequeued () |
virtual bool | isConnected () |
virtual bool | publishBatchedData () |
virtual bool | setDequeueDuration (std::chrono::milliseconds new_value) |
virtual bool | shutdown () |
virtual bool | start () override |
~CloudWatchService ()=default | |
Public Member Functions inherited from Aws::DataFlow::InputStage< TaskPtr< std::list< T > > > | |
std::shared_ptr< Source< TaskPtr< std::list< T > > > > | getSource () |
void | setSource (std::shared_ptr< Source< TaskPtr< std::list< T > > >> source) |
Public Member Functions inherited from RunnableService | |
std::string | getStatusString () override |
virtual bool | isRunning () |
void | join () |
RunnableService () | |
bool | shutdown () override |
bool | start () override |
void | waitForShutdown () |
void | waitForShutdown (std::chrono::milliseconds millis) |
~RunnableService () override=default | |
Public Member Functions inherited from Service | |
ServiceState | getState () |
Service () | |
virtual | ~Service ()=default |
Protected Member Functions | |
virtual T | convertInputToBatched (const D &input, const std::chrono::milliseconds &milliseconds)=0 |
virtual T | convertInputToBatched (const D &input)=0 |
void | work () |
Protected Member Functions inherited from RunnableService | |
virtual void | run () |
virtual bool | startWorkerThread () |
virtual bool | stopWorkerThread () |
Protected Member Functions inherited from Service | |
void | setState (ServiceState new_state) |
Protected Attributes | |
std::shared_ptr< DataBatcher< T > > | batcher_ |
std::chrono::milliseconds | dequeue_duration_ |
std::shared_ptr< FileUploadStreamer< std::list< T > > > | file_upload_streamer_ |
std::shared_ptr< Publisher< std::list< T > > > | publisher_ |
Private Attributes | |
std::atomic< int > | number_dequeued_ |
Generic class to batch and publish data to CloudWatch. Note: if the file_upload_streamer is set then data will be stored on disk if offline (data cannot be successfully sent) and in the event of send success data will be read from disk and sent.
D | the type to be batched and converted to the CloudWatch published type T |
T | the type to be published to CloudWatch, specific to the AWS SDk |
Definition at line 48 of file cloudwatch_service.h.
|
inline |
invalid | argument if either publisher or batcher are null |
publisher | |
batcher |
Definition at line 56 of file cloudwatch_service.h.
|
default |
|
inlinevirtual |
Entry point to batch data for publishing
data_to_batch |
Definition at line 129 of file cloudwatch_service.h.
|
inlinevirtual |
Entry point to batch data for publishing
data_to_batch | |
milliseconds | timestamp of the data |
Definition at line 142 of file cloudwatch_service.h.
|
protectedpure virtual |
|
protectedpure virtual |
|
inlinevirtual |
Return the current timestamp
Definition at line 204 of file cloudwatch_service.h.
|
inlinevirtual |
Return the amount of time to wait to dequeue a work item to attempt to publish.
Definition at line 167 of file cloudwatch_service.h.
|
inline |
Get the total number of items dequeued (and sent to the publishing mechanism) from the work thread.
Definition at line 185 of file cloudwatch_service.h.
|
inlinevirtual |
Return the current connected state.
Definition at line 194 of file cloudwatch_service.h.
|
inlinevirtual |
Publishing mechanism, force the batcher to yield its data to the publisher and attempt to send.
data_to_batch |
Definition at line 155 of file cloudwatch_service.h.
|
inlinevirtual |
Definition at line 171 of file cloudwatch_service.h.
|
inlinevirtual |
Shut all services down. Note: this method blocks and waits for the FileUploadStreamer's and its own RunnableService work threads to be complete.
Reimplemented from Service.
Definition at line 103 of file cloudwatch_service.h.
|
inlineoverridevirtual |
Start the publisher, batcher, and file upload streamer (collection of services).
Reimplemented from Service.
Definition at line 81 of file cloudwatch_service.h.
|
inlineprotectedvirtual |
Main workhorse thread that dequeues from the source and calls Task run.
Implements RunnableService.
Definition at line 217 of file cloudwatch_service.h.
|
protected |
Definition at line 242 of file cloudwatch_service.h.
|
protected |
Duration to wait for work from the queue.
Definition at line 247 of file cloudwatch_service.h.
|
protected |
Definition at line 240 of file cloudwatch_service.h.
|
private |
Count of total items dequeued.
Definition at line 253 of file cloudwatch_service.h.
|
protected |
Definition at line 241 of file cloudwatch_service.h.