Module TagProvider vs ManagedTagProvider

In my ignition module I was able to get basic reads and writes working by creating a TagProvider (with an empty Security context for testing). Based off the example in the sdk docs

But then I saw that the github sdk example is using a ManagedTagProvider instead.

From @Kevin.Herron's reply on an older post it seems ManagedTagProvider is the recommended way to do it? If I already have the basics working with TagProvider is it worth pivoting now? I don't want to run into issues down the line from doing something unsupported.

There's an added caveat that the I'll need to be updating a dozen or so tags simultaneously, and the TagProvider supports that with writeAsync. ManagedTagProvider seems to only support a singular updateValue at a time.

You should not be using .writeAsync to deliver data to tags from inside your module. That method is for users of your data to write into your module.

The ManagedTagProvider is structured to make it easy for module developers to provide the inside data supply. If you implement the TagProvider interface, you are entirely on your own.

I didn't have to implement the interface myself. From the GatewayTagManager I was able to getTagProvider() and use an existing implementation.

ManagedTagProvider has updateValues, but I don't see a way to read tags into the module. Is there a different interface to use for that?

So... you didn't actually create a TagProvider then?

You just got ahold of an existing one and used it to read or write to its tags.

Which is fine, but it's not creating a TagProvider.

Oh no, I didn't implement a new one. That was confusing wording on my part.

I got an instance of (something that implements) TagProvider from the GatewayTagManager.

From the GatewayHook's setup I took the GatewayContext and then called
context.getTagManager().getTagProvider(TAG_PROVIDER);

It works for me now, but I don't want to leave landmines for myself to step on later by using an unsupported interface.

This is fine.

Creating your own TagProvider (using ManagedTagProvider) is an entirely different thing that looks like it may irrelevant for you.

2 Likes

Got it. Thank you!