SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Hi Kanber,
I think it goes back to my first response, and what @Adam_Summers was mentioning about using the In memory cache. The in memory cache is cleared whenever Smart Connector restarts. So this will accomplish what you are looking for. (e.g. not reading the file every time)
var cachedFileRead = Cache.RetrieveItem<FileReadResultType>("TheCacheItemKey");
if (cachedFileRead == null)
{
var readFileResults = ReadTheFile();
Cache.AddOrUpdateItem(readFileResults, "TheCacheItemKey");
_tagList= readFileResults;
}
else
{
_tagList= cachedFileRead;
}
You can add code similar to the above in your Execute_Subclass method. Most likely, this code will be at the start of your Execute_Subclass method. _tagList is a private field of your class where which is whatever type your tag list is. You can then use _tagList from anywhere else in the class to access it.
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi,
Not sure if I fully understand the question but if you want to read something (configuration) once on service start and not on each processor cycle you have 2 options.
1) Read and store in memory cache - this stores for the runtime of the service (or until the expiry datetime you set)
2) Read and store in processor values - this survices a reset but could still be updated on first run.
For me option 1 is best, it will perform better and provide you a simple way to check if the value you want (config data) exists in cache - if not update it, if it does return fast and use it. A lazy loading approach.
Link copied. Please paste this link to share this article on your social media post.
Hi Kanber,
The best way to do this, is probably to cache the data the first time the processor runs.
var cachedFileRead = Cache.RetrieveItem<FileReadResultType>("TheCacheItemKey");
if (cachedFileRead == null)
{
var readFileResults = ReadTheFile();
Cache.AddOrUpdateItem(readFileResults, "TheCacheItemKey");
TagList = readFileResults;
}
else
{
TagList = cachedFileRead;
}
You could also create a processor, whos job in life is to read the file and add it to the cache, then run that processor on start.
Best Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi Jeff,
But I don't know which code I need to add these. as you know we have;
- Execute_Subclass
- Discover
- SmartConnectorEwsServerSettings
which are them working only once which are working every schedule time? I look doucment but I can't solve.
Link copied. Please paste this link to share this article on your social media post.
Hi Kanber,
All code in your processors executes out of the Execute_Subclass method. This check is likely something that you do at the start of that.
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Ok I will try.
which method working with schedule time? I mean when we add dll file on smart connector and edit schedule lets say 10 min. every 10 min which method is fisrt running.
Link copied. Please paste this link to share this article on your social media post.
Hi Kanber,
The Execute_Subclass method is the entrypoint of the processor, so if you setup a schedule, this method will ALWAYS be run first. Your code should start from in that.
In order to setup a schedule you just need to create a Configuration Schedule with setting similar to the below:
And then set your processor to run on a schedule.a
And finally set the schedule on the processor:
Best Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
that mean these is not what I am looking for.
I want to one method which will run when windows is open and smart connector service start to running and first time when dll was called. then it will read text file once and on scheduled timed it will not read file again and again.
Link copied. Please paste this link to share this article on your social media post.
Hi Kanber,
I think it goes back to my first response, and what @Adam_Summers was mentioning about using the In memory cache. The in memory cache is cleared whenever Smart Connector restarts. So this will accomplish what you are looking for. (e.g. not reading the file every time)
var cachedFileRead = Cache.RetrieveItem<FileReadResultType>("TheCacheItemKey");
if (cachedFileRead == null)
{
var readFileResults = ReadTheFile();
Cache.AddOrUpdateItem(readFileResults, "TheCacheItemKey");
_tagList= readFileResults;
}
else
{
_tagList= cachedFileRead;
}
You can add code similar to the above in your Execute_Subclass method. Most likely, this code will be at the start of your Execute_Subclass method. _tagList is a private field of your class where which is whatever type your tag list is. You can then use _tagList from anywhere else in the class to access it.
Regards,
-Jeff
Posted: 2019-08-02 05:27 AM . Last Modified: 2019-08-02 05:28 AM
Link copied. Please paste this link to share this article on your social media post.
Hi @Kanber,
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.