Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

What is the best way to share data between processors?

SmartConnector Forum

Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Building
  • SmartConnector
  • SmartConnector Forum
  • What is the best way to share data between processors?
Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
JeffBowman
Sisko JeffBowman Sisko
164
ardak
ardak Schneider Alumni (Retired)
34
sesa180908_brid
Commander sesa180908_brid Commander
34
mike_meirovitz
Commander mike_meirovitz
21
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to SmartConnector Forum
Solved
JeffBowman
Sisko JeffBowman Sisko
Sisko

Posted: ‎2016-07-29 11:28 AM

2 Likes
6
1126
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-07-29 11:28 AM

What is the best way to share data between processors?

What is the best way to share data between processors?

Tags (5)
  • Tags:
  • extension
  • processor
  • smartconnector
  • smartconnector extension
  • tips and tricks
Reply
  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
sesa180908_brid
Commander sesa180908_brid Commander
Commander

Posted: ‎2016-07-29 11:55 AM

2 Likes
2
1034
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-07-29 11:55 AM

The SmartConnector framework provides two ways for running Processors to exchange data.  Using one over the other is really a matter of preference based on need.

  1. ProcessorValue store. Data stored here is actually persisted in the SmartConnector database.  You would obviously use this approach if you needed to ensure that your data would not be lost if the service restarted.  Complex data types are not directly supported but by serializing (XML or JSON) in/outboud of the ProcessorValue store, you could achieve storing structs or reference types just as easily as a primitive value.

  1. InMemoryCache. Data stored here is persisted in a thread-safe cache.  References are not persisted across the cache boundary but the InMemoryCache provides generic overloads that allow type safe access to the data.  Data store here is volatile and would be lost with a service restart.  In v2.2 of SmartConnector(due out in September) the InMemoryCache is enhanced to include automatic content expiration and an approach to create logical silos (a cache of caches effectively) where data from one silo is not visible to someone that doesn’t know the cache key.

Both Processor subclasses and Native EWS Server Processor subclasses have access to both of these methods via the base Processor class.  There are also some extension methods available to you to make getting data in and out of them in type safe manner.

See Answer In Context

Reply
Replies 6
Benji
Administrator Benji Administrator
Administrator

Posted: ‎2016-07-29 11:35 AM

0 Likes
2
1034
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-07-29 11:35 AM

You mean threads?


I usually have a central class I pass around as reference

Reply
sesa180908_brid
Commander sesa180908_brid Commander
Commander

Posted: ‎2016-07-29 11:55 AM

2 Likes
2
1035
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-07-29 11:55 AM

The SmartConnector framework provides two ways for running Processors to exchange data.  Using one over the other is really a matter of preference based on need.

  1. ProcessorValue store. Data stored here is actually persisted in the SmartConnector database.  You would obviously use this approach if you needed to ensure that your data would not be lost if the service restarted.  Complex data types are not directly supported but by serializing (XML or JSON) in/outboud of the ProcessorValue store, you could achieve storing structs or reference types just as easily as a primitive value.

  1. InMemoryCache. Data stored here is persisted in a thread-safe cache.  References are not persisted across the cache boundary but the InMemoryCache provides generic overloads that allow type safe access to the data.  Data store here is volatile and would be lost with a service restart.  In v2.2 of SmartConnector(due out in September) the InMemoryCache is enhanced to include automatic content expiration and an approach to create logical silos (a cache of caches effectively) where data from one silo is not visible to someone that doesn’t know the cache key.

Both Processor subclasses and Native EWS Server Processor subclasses have access to both of these methods via the base Processor class.  There are also some extension methods available to you to make getting data in and out of them in type safe manner.

Reply
sesa180908_brid
Commander sesa180908_brid Commander
Commander

Posted: ‎2016-07-29 11:56 AM

0 Likes
1
1034
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-07-29 11:56 AM

This approach could work as well, but you would need to safeguard against cross thread access to object reference since each Processor is executing in its own thread.

Reply
Benji
Administrator Benji Administrator
Administrator

Posted: ‎2016-07-29 11:59 AM

0 Likes
0
1034
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-07-29 11:59 AM

Yup. Race conditions is a bummer. Till now I only worked with single threads, but being forced to explore mutex 🙂

Reply
Adam_Summers
Lt. Commander Adam_Summers Lt. Commander
Lt. Commander

Posted: ‎2016-07-29 12:45 PM

0 Likes
1
1034
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-07-29 12:45 PM

Hi Mark,

Yes that's exactly the approach we have been using (mostly just the ProcessorValue store until the recent addition of InMemoryCache), and most recently we used a mixture of the two. Thats's where we wanted to share data across multiple processors and needed this to persist beyond a single run of the SmartConnector service. We stored serialised JSON content to the ProcessorValue store and referenced a flag whilst reading or writing InMemoryCache to block and avoid cross thread issues.

Is there a particular pattern or design which would work better in this case?

Reply
sesa180908_brid
Commander sesa180908_brid Commander
Commander

Posted: ‎2016-07-29 02:40 PM

1 Like
0
1034
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-07-29 02:40 PM

I don’t think there really is a  right or wrong answer for this.  It all comes down what your needs are.  The database store was implemented if you needed non-volatile storage while implicitly allowing for concurrent reads.  The down side of course is the “last in wins” write approach used by default.  If you needed to ensure only one thing can write (nd not allow a new simultaneous write to overwrite newer content), you would need to implement a semaphore like you did with the InMemoryCache.  I suppose someone could easily write some extension methods that do this as well.

InMemoryCache is faster of course, but has the downside of being volatile and (until 2.2 at least with expiring content support) requires manual cleanup else it would become a memory “leak” of sorts.

I’d be interested in hearing what others think in this regard.

P.S.

In 2.2 I used the InMemoryCache quite extensively in the implementation of the “REST for SBO”. This is what was the impetus for expiring content (and silos) in the IMC - to not cause memory "leaks".

Reply
Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

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.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of