static void TaskTest() { var logger = Configuration.DefaultLoggerFactory.CreateLogger($"TaskTest_{Task.CurrentId.Value}"); var config = new KeyValueMemoryConfiguration() { MemoryName = "DemoMemory" }; var conn = RtConnectorMemoryMapped.Build(config, syncWithExistentTopics: true); var tag = conn.AddTag($"TagPrueba_{Task.CurrentId.Value}"); logger.LogInformation("Previo:: Tag:{0} Status:{1} Updated:{2} Value:{3}", tag.TagName, tag.Status, tag.Updated.ToString("o"), tag.Value.Numeric); tag.SetNumeric(Task.CurrentId.Value + 0.001); logger.LogInformation("Despues de escribir:: Tag:{0} Status:{1} Updated:{2} Value:{3}", tag.TagName, tag.Status, tag.Updated.ToString("o"), tag.Value.Numeric); while (Task.CurrentId.Value == 1) { logger.LogInformation("ALL TAGS>>>"); foreach (var tagName in conn.TagNames) { tag = conn.GetTag(tagName); logger.LogInformation("Despues de escribir:: Tag:{0} Status:{1} Updated:{2} Value:{3}", tag.TagName, tag.Status, tag.Updated.ToString("o"), tag.Value.Numeric); } Thread.Sleep(TimeSpan.FromSeconds(1)); } }
public static IRtConnector Build( KeyValueMemoryConfiguration configuration, bool syncWithExistentTopics = false, ILoggerFactory loggerFactory = null) { var keyValueMemory = KeyValueMemory.Build(configuration, loggerFactory); return(new RtConnectorMemoryMapped(keyValueMemory, syncWithExistentTopics, loggerFactory)); }
public static IRtConnector BuildFromFactory( IConfigurationSection configuration, ILoggerFactory loggerFactory = null) { var config = new KeyValueMemoryConfiguration(configuration); var keyValueMemory = KeyValueMemory.Build(config); var syncWithExistentTopics = configuration?.GetValue <bool>("SyncWithExistentTopics", false) ?? false; return(new RtConnectorMemoryMapped(keyValueMemory, syncWithExistentTopics, loggerFactory)); }