Adding items in the event server background plugin

Hi.

I’m making an integration where I add the login details to the other system’s server in the management client. After it’s been saved as a new item, the background plugin gets it and establishes a connection. The first time, it’ll get various items from the server and it saves them as items in the Milestone configuration so that I can use them in rules and actions. While that’s going on, the event server log prints out several lines with this:

StatusSessionServer SetCustomSettingDataGlobal failed. Data was modified by other user.

Apparently I’m doing something I’m not supposed to, but I don’t get what that error message means. Last time I ran the plugin, it seemed to save all items just fine except for one which came up when I manually queried the Central.Items database table, but it was marked as deleted. There’s obviously something that’s not working. What would be the correct way to do this?

The reason why I’m doing it from the background plugin is because every concurrent connection to the server requires a costly client license so I’d like to keep it to one connection. Ideally, the background plugin would establish just one connection, grab the configuration, and then listen to events and configuration updates.

Hi Roger,

Sorry for the delayed response - we have spent quite some time looking into this.

It turns out that what you have found is due to an error in the Event Server code and we will be fixing it for the 2018 R3 release (2018 R2 is already locked down).

The good news is that - as you also observe - it does not affect the actual saving of the items. They will be saved correctly. The only thing this could potentially affect is if someone is listening for the updates made by your plugin and goes in and read it very quickly after the first notification is received, he could potentially miss some of the subsequent updates. So definitely something we want to fix, but not something that will affect you I think.

Best regards,

Peter

Hi Peter.

Thanks for the response. I’ve experimented a bit and sometimes a few of the last items I try to save are not saved. I first create 25-30 items in a List before I run a foreach loop that saves them to the configuration. Sometimes it works fine, though. The missing items are created in a loop so if the code was broken, none of them should be saved. Haven’t found any logic to it so I’ll probably end up finding some other way to do it anyway.

Best regards

Roger