SQL for storing Tags using SDK - Custom Module

I'm trying to create a tag group for some of my instruments to store metadata about the instruments, not the actual instrument data. I used ProviderConfiguration and ManagedTagProvider in GatewayContext as shown below and was able to create the tags. However, when the Gateway was restarted, these tags disappeared. Is this the correct way to create them? Also, internally, we decided to store these tags in a database. We started testing with SQLite, which comes default with Ignition.

Question 1: Is it normal for the tags to disappear after a Gateway restart?
Question 2: Can these tags be stored and retrieved even after a Gateway restart?
Question 3: Is it better to store these tags in a database like SQL?
Question 4: Is there any example of how this can be achieved?

public class GatewayHook extends AbstractGatewayModuleHook {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    private ManagedTagProvider deviceTagProvider;
    private GatewayContext gatewayContext;

    private final DeviceRegistryGatewayScript deviceRegistryGatewayScript = new DeviceRegistryGatewayScript();


    @Override
    public void setup(GatewayContext gatewayContext) {
        logger.info("setup()");

        this.gatewayContext = gatewayContext;

        ProviderConfiguration configuration = new ProviderConfiguration("Test-11");
        configuration.setAllowTagCustomization(true);
        configuration.setPersistTags(false);
        configuration.setPersistValues(false);
        configuration.setAttribute(TagProviderMeta.FLAG_HAS_OPCBROWSE, false);

        deviceTagProvider = gatewayContext.getTagManager().getOrCreateManagedProvider(configuration);

        deviceRegistryGatewayScript.setDeviceTagProvider(deviceTagProvider);

        deviceRegistryGatewayScript.setGatewayContext(gatewayContext);
    }
this.deviceTagProvider.configureTag("Devices/instrument-1/" + deviceName + "/Device-ID", DataType.String);
        this.deviceTagProvider.configureTag("Devices/instrument-1/" + deviceName + "/EndPoint", DataType.String);
        this.deviceTagProvider.configureTag("Devices/instrument-1/" + deviceName + "/Floor", DataType.String);

        // Actual values are updated here
        this.deviceTagProvider.updateValue("Devices/instrument-1/" + deviceName + "/Device-ID", deviceID, QualityCode.Good);
        this.deviceTagProvider.updateValue("Devices/instrument-1/" + deviceName + "/Endpoint", ipAddress+":"+port, QualityCode.Good);
        this.deviceTagProvider.updateValue("Devices/instrument-1/" + deviceName + "/Floor", floor, QualityCode.Good);
1 Like
  1. A managed tag provider doesn't store anything. (?) You (the developer) are still responsible for persistently storing whatever needs to be stored. (Hmm. Try using true in the .setPersistTags() and .setPersistValues() configuration calls.)

  2. Sure, by you. Probably should update your persistent store as things change.

  3. Totally dependent on quantities and organization. But, likely.

  4. Not that I am aware of.

Could you store persistent metadata within custom properties on tags/UDT instances/folders?

We've found this to be an effective way to store things, read them with simple tag bindings or system.tag.readBlocking, but not have the performance overhead of tag execution for persistent properties.

For us it works well to have some properties, common across a UDT for example, with the custom property set in the UDT. But other properties, unique per instance or tag, set via a script process.

Sorry, I am new to Ignition. Where can I read more about this ? below link ?

Thank you