IoT Client for Spring Boot
Available since versions: 2.0.2-fireball (onesait Platform) & 2.0.2-RELEASE (client library).
The following use of the library is intended to be used by administrators/developers of the platform willing to provide (micro)services that use this library to connect to the Digital Broker in Multitenant mode.
The client library Client4SpringBoot can be used in Multitenant mode. To use it in such way, you have to take into account the following considerations.
Application properties/yaml
To use this library in Multitenant mode, you have to add the following properties to the application properties:
onesaitplatform:
iotclient:
urlRestControlpanel: http://controlpanelservice.onesait-platform:18000
multitenant: true
admin-api-token: 8e303d50cfd647ce97c9b18f3031d908
deviceTemplate: MasterDevice
#token: 902409548c704c33befefddbed0ef66f
The admin-api-token, is the application user token of a vertical administrator, that you can find at /controlpanel/apimanager/token/list:
The device token is no longer needed in this mode, as the library will take care of token management for the device.
Annotations
All IoT Broker annotations including: @IoTBrokerDelete, @IoTBrokerInsert, @IoTBrokerQuery, @IoTBrokerUpdate, and @IoTBrokerTransaction; now have an extra argument ‘tenant’ that you must specify. This way the library and the Broker will know how to manage the requests.
This argument is specified with SpEL (Spring expression language), as it will be dynamic at runtime. Here are some examples of use:
Â