The Tracker instance must be initialized with an emitter. This section will go into more depth about the Emitter and how it works under the hood.
Emitter emitter("com.acme", Emitter::Method::POST, Emitter::Protocol::HTTP, 52000, 52000, 500, "sp.db");
There are other optional arguments:
|The URI to send events to||Yes|
|The request type to use (GET or POST)||Yes|
|The protocol to use (http or https)||Yes|
|The maximum amount of events to send at a time||Yes|
|The byte limit when sending a POST request||Yes|
|The byte limit when sending a GET request||Yes|
|Defines the path and file name of the database||Yes|
db_name can be any valid path on your host file system (that can be created with the current user). By default it will create the required files wherever the application is being run from.
Once the emitter receives an event from the Tracker a few things start to happen:
- The event is added to a local Sqlite3 database (blocking execution)
- A long running daemon thread is started which will continue to send events as long as they can be found in the database (asynchronous)
- The emitter loop will grab a range of events from the database up until the
SendLimitas noted _above
- The emitter will send all of these events as determined by the Request, Protocol and ByteLimits
- Each request is sent in its thread.
- Once sent it will process the results of all the requests sent and will remove all successfully sent events from the database