public static IEnumerable <SubscribeMessage> LoadMessages(MessageQueryFilter filter, out int totalCount) { var sql = DataCommandHelper.GetDataCommandSql("LoadMessages", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { string whereStr = "WHERE 1 = 1"; if (!string.IsNullOrWhiteSpace(filter.Topic)) { whereStr += " AND `subscribemessage`.`Topic`=@Topic"; } if (!string.IsNullOrWhiteSpace(filter.ReferenceIdentifier)) { whereStr += " AND `message`.`ReferenceIdentifier`=@ReferenceIdentifier"; } if (filter.CreateDateFrom.HasValue) { whereStr += " AND `message`.`CreateDate`>=@CreateDateFrom"; } if (filter.CreateDateTo.HasValue) { whereStr += " AND `message`.`CreateDate`<@CreateDateTo"; } whereStr += " Order By `message`.`CreateDate` DESC"; sql = sql.Replace("#StrWhere#", whereStr); var result = conn.QueryMultiple(sql, filter); var messages = result.Read <SubscribeMessage>(); totalCount = result.ReadFirstOrDefault <int>(); return(messages); } }
public static void CreateProcessFailRecord(ProcessFailRecord record) { var sql = DataCommandHelper.GetDataCommandSql("CreateProcessFailRecord", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, record); } }
public static void UpdateMessageStatusToSuccess(Guid messageId, string topic, long milliseconds) { var sql = DataCommandHelper.GetDataCommandSql("UpdateMessageStatusToSuccess", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, new { MessageId = messageId, Topic = topic, TimePeriod = milliseconds }); } }
public static void UpdateMessageStatusToFail(Guid messageId, string topic) { var sql = DataCommandHelper.GetDataCommandSql("UpdateMessageStatusToFail", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, new { MessageId = messageId, Topic = topic }); } }
public static void UpdateMessageStatusToPrepared(Guid messageId) { var sql = DataCommandHelper.GetDataCommandSql("UpdateMessageStatusToPrepared", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, new { MessageId = messageId }); } }
public static bool ExistsMessage(string hashFingerprint) { var sql = DataCommandHelper.GetDataCommandSql("ExistsMessage", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.ExecuteScalar <bool>(sql, new { HashFingerprint = hashFingerprint })); } }
public static IEnumerable <ProcessFailRecord> LoadProcessFailRecords(Guid messageId) { var sql = DataCommandHelper.GetDataCommandSql("LoadProcessFailRecords", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.Query <ProcessFailRecord>(sql, new { MessageId = messageId })); } }
public static void CreateApp(App app) { var sql = DataCommandHelper.GetDataCommandSql("CreateApp", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, app); } }
public static bool ExistsApp(string appId) { var sql = DataCommandHelper.GetDataCommandSql("ExistsApp", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.ExecuteScalar <bool>(sql, new { AppID = appId })); } }
public static IEnumerable <Topic> LoadTopics() { var sql = DataCommandHelper.GetDataCommandSql("LoadTopics", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.Query <Topic>(sql)); } }
/// <summary> /// 获取单位时间内发布失败的消息,单位小时 /// </summary> /// <param name="publishReloadTimeSpan"></param> /// <returns></returns> public static IEnumerable <Message> LoadPublishFailedMessage(int publishReloadTimeSpan) { var sql = DataCommandHelper.GetDataCommandSql("LoadPublishFailedMessage", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.Query <Message>(sql, new { PublishReloadTimeSpan = publishReloadTimeSpan })); } }
public static Topic LoadTopicBySysNo(int sysno) { var sql = DataCommandHelper.GetDataCommandSql("LoadTopicBySysNo", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.QueryFirstOrDefault <Topic>(sql, new { SysNo = sysno })); } }
public static Topic LoadTopicByTopicName(string name) { var sql = DataCommandHelper.GetDataCommandSql("LoadTopicByTopicName", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.QueryFirstOrDefault <Topic>(sql, new { Name = name })); } }
public static bool ExistsTopic(string topic) { var sql = DataCommandHelper.GetDataCommandSql("ExistsTopic", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.ExecuteScalar <bool>(sql, new { Name = topic })); } }
public static void EditTopic(Topic topic) { var sql = DataCommandHelper.GetDataCommandSql("EditTopic", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, topic); } }
public static void UpdateTopicStatusToInValid(int sysno) { var sql = DataCommandHelper.GetDataCommandSql("UpdateTopicStatusToInValid", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, new { SysNo = sysno }); } }
public static void CreateExchange(Exchange exchange) { var sql = DataCommandHelper.GetDataCommandSql("CreateExchange", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, exchange); } }
public static void RemoveServerNode(string server) { var sql = DataCommandHelper.GetDataCommandSql("RemoveServerNode", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { conn.Execute(sql, new { ServerHost = server }); } }
public static bool ExistsServer(string server) { var sql = DataCommandHelper.GetDataCommandSql("ExistsServer", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { return(conn.ExecuteScalar <bool>(sql, new { ServerHost = server })); } }
public static SubscribeMessage LoadMessage(Guid messageId, string topic) { var sql = DataCommandHelper.GetDataCommandSql("LoadMessage", out string connectionString); using (IDbConnection conn = MysqlFactory.CreateConnection(connectionString)) { var result = conn.QueryMultiple(sql, new { MessageId = messageId, Topic = topic }); var message = result.ReadFirstOrDefault <SubscribeMessage>(); message.ProcessFailRecords = result.Read <ProcessFailRecord>().AsList(); return(message); } }