IoTDameon 1.0.0.20091601

Former-commit-id: 01de0e7ba2ca705393e35f25c3dded041c463042
Former-commit-id: 650d9f6112c4812c01d91d48292a1862fdba3c1d
TSXN
wanggang 5 years ago
parent 02e89c8e9f
commit f39d70e36a

@ -1,6 +1,2 @@
.vscode .vscode
be docker
fe
udf
log
data

@ -1,6 +1,6 @@
using Confluent.Kafka; using Confluent.Kafka;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using MySqlConnector; using MySql.Data.MySqlClient;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Threading; using System.Threading;
@ -37,15 +37,19 @@ namespace KafkaEFTest
try try
{ {
var entity = new TestEntity(); var entity = new TestEntity();
var entity1 = new TestEntity();
producer.InitTransactions(DefaultTimeout); producer.InitTransactions(DefaultTimeout);
producer.BeginTransaction(); producer.BeginTransaction();
dbContext.Database.BeginTransaction(); dbContext.Database.BeginTransaction();
dbContext.Tests.Add(entity); dbContext.Tests.Add(entity);
dbContext.Tests.Add(entity1);
dbContext.SaveChanges(); dbContext.SaveChanges();
var dr = await producer.ProduceAsync(topic, new Message<string, string> { Key = "test_table", Value = JsonConvert.SerializeObject(entity) }); var dr = await producer.ProduceAsync(topic, new Message<string, string> { Key = "test_table", Value = JsonConvert.SerializeObject(entity) });
var dr1 = await producer.ProduceAsync(topic, new Message<string, string> { Key = "test_table", Value = JsonConvert.SerializeObject(entity1) });
dbContext.Database.CommitTransaction(); dbContext.Database.CommitTransaction();
producer.CommitTransaction(DefaultTimeout); producer.CommitTransaction(DefaultTimeout);
Console.WriteLine($"send message offset: '{dr.TopicPartitionOffset}' value: '{dr.Value}"); Console.WriteLine($"send message offset: '{dr.TopicPartitionOffset}' value: '{dr.Value}");
Console.WriteLine($"send message offset: '{dr1.TopicPartitionOffset}' value: '{dr1.Value}");
} }
catch (Exception ex)//DbUpdateException//ProduceException<Null,string> catch (Exception ex)//DbUpdateException//ProduceException<Null,string>
{ {
@ -61,7 +65,7 @@ namespace KafkaEFTest
} }
} }
await Task.Delay(5000); await Task.Delay(20);
} }
}); });
var conf = new ConsumerConfig var conf = new ConsumerConfig
@ -129,6 +133,7 @@ namespace KafkaEFTest
//create database test; //create database test;
//CREATE USER 'usr' IDENTIFIED BY 'pwd'; //CREATE USER 'usr' IDENTIFIED BY 'pwd';
//GRANT ALL ON test TO usr; //GRANT ALL ON test TO usr;
//use test;
//CREATE TABLE IF NOT EXISTS test //CREATE TABLE IF NOT EXISTS test
//( //(
// `id` VARCHAR(64), // `id` VARCHAR(64),

@ -45,11 +45,11 @@ services:
environment: environment:
TZ: "Asia/Shanghai" TZ: "Asia/Shanghai"
volumes: volumes:
#- ./conf/fe.conf:/opt/fe/conf/fe.conf #- ./docker/conf/fe.conf:/opt/fe/conf/fe.conf
- ./log/fe:/opt/fe/log - ./docker/log/fe:/opt/fe/log
- ./data/fe/doris-meta:/opt/fe/doris-meta - ./docker/data/fe/doris-meta:/opt/fe/doris-meta
#- ./conf/be.conf:/opt/be/conf/be.conf #- ./docker/conf/be.conf:/opt/be/conf/be.conf
- ./data/be/storage:/opt/be/storage - ./docker/data/be/storage:/opt/be/storage
ports: ports:
- 8081:8081 - 8081:8081
- 8030:8030 - 8030:8030

@ -78,7 +78,6 @@ namespace IoTDameon
var root = Directory.GetParent(_env.ContentRootPath).FullName; var root = Directory.GetParent(_env.ContentRootPath).FullName;
var appPath = Path.Combine(root, appFolder); var appPath = Path.Combine(root, appFolder);
var name = $"{appFolder}.zip"; var name = $"{appFolder}.zip";
var backupPath = Path.Combine(root, $"{appFolder}_bk");
var file = Path.Combine(root, name); var file = Path.Combine(root, name);
string currentVersion; string currentVersion;
try try
@ -109,6 +108,7 @@ namespace IoTDameon
throw ex; throw ex;
} }
var doc = new XmlDocument(); var doc = new XmlDocument();
doc.LoadXml(info);
var lastVersion = doc.GetElementsByTagName("version")[0].InnerText.Trim(); var lastVersion = doc.GetElementsByTagName("version")[0].InnerText.Trim();
var lastCheckSum = doc.GetElementsByTagName("checksum")[0].InnerText.Trim(); var lastCheckSum = doc.GetElementsByTagName("checksum")[0].InnerText.Trim();
if (currentVersion != lastVersion) if (currentVersion != lastVersion)
@ -165,6 +165,7 @@ namespace IoTDameon
} }
} }
//备份要更新的程序 //备份要更新的程序
var backupPath = Path.Combine(root, $"{appFolder}_{currentVersion}_bk");
try try
{ {
if (Directory.Exists(backupPath)) if (Directory.Exists(backupPath))

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.20090101")] [assembly: AssemblyInformationalVersion("1.0.0.20091601")]

@ -87,11 +87,8 @@ namespace IoTNode
{ {
context.Database.BeginTransaction(); context.Database.BeginTransaction();
context.Database.ExecuteSqlRaw(sql); context.Database.ExecuteSqlRaw(sql);
context.Database.ExecuteSqlRaw($"update iot_Node set Version='{Path.GetFileNameWithoutExtension(item.Value)}'");
context.Database.CommitTransaction(); context.Database.CommitTransaction();
using var cmd2 = context.Database.GetDbConnection().CreateCommand();
context.Database.OpenConnection();
cmd2.CommandText = $"update iot_Node set Version='{Path.GetFileNameWithoutExtension(item.Value)}'";
cmd2.ExecuteNonQuery();
} }
catch (Exception ex) catch (Exception ex)
{ {

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.20090101")] [assembly: AssemblyInformationalVersion("1.0.0.20090102")]
Loading…
Cancel
Save