Meter Ingest (SDK sample code)
6min
This sample illustrates ingesting meters in a Spring boot app.
Steps:
- Setup Amberflo environment
- Setup configuration for service discovery of Amberflo ingestion client
- Create helper for mapping object to Amberflo ingestion payload
Maven dependencies (check for latest versions):
- Setup the environment to configure the Amberflo SDK client settings
- Add following entries to the
- Setup an environment for service discoverable.
- Amberflo provides a singleton instance of the Amberflo client to make the ingestion process more efficient. In order to make this client a discoverable service that can be injected as a dependency, create a configuration to return the client instance as a bean.
In this approach the entity is transformed to the ingestion payload using a helper. In this sample, we have an entity called Event which is mapped to the Amberflo SDK ingestion payload in the AmberfloMapper class.
Now AmberfloMapper.ingestMeterForEvent() can be called from anywhere in your code.
Sample entity class:
Sample mapper helper:
Updated 31 Jul 2024
Did this page help you?