TagConfigurationRecord RecordListenerAdapter not work



    @Override
    public void setup(GatewayContext gatewayContext) {
        this.context = gatewayContext;
        ModuleServicesManager moduleServicesManager = context.getModuleServicesManager();

        configManager = context.getTagManager().getConfigManager();

        try {
            context.getSchemaUpdater().updatePersistentRecords(new RecordMeta[]{TagConfigurationRecord.META});
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        recordListenerAdapter = new RecordListenerAdapter<TagConfigurationRecord>() {
            {
                logger.info("类空间:");
            }

            public void recordAdded(TagConfigurationRecord record) {
                logger.info("recordAdded:" + record);
                count = (int) (Math.random() * 100);

            }

            public void recordUpdated(TagConfigurationRecord record) {
                logger.info("ceshiihhh");
                logger.info("recordUpdated:" + record);

            }

            public void recordDeleted(KeyValue key) {
                logger.info("recordDeleted");
                logger.info("key:" + key);
            }
        };

        TagConfigurationRecord.META.addRecordListener(recordListenerAdapter);


    }

When I modify the alarm configuration, the log cannot detect the change

What are you trying to do with this change listener?

There’s probably a more efficient, more correct way to do this through the new tag system, by registering your own tag actor.

Record and modify alarm records (including time, person and last record)

Isn’t my method above own

Tags are not my area, but it appears to be intentional that TagConfigurationRecord does not send notification events, so your code will not work as it's written.

You should try registering a TagActorFactory with the gateway's tag configuration manager. Your custom actor indicates which properties it wants to know about, and the tag system automatically invokes your factory when required.

I see. I succeeded

I want to know about alarmobserver. Is there an example? Learn it

I don’t think there are any examples, no. You’re welcome to post questions here or in additional threads as they come up.

As I said, tags aren’t my primary domain, but someone will hopefully be able to answer any questions you may have.