@@ -130,7 +130,7 @@ SELECT * FROM `{_prefix}.received` WHERE Id=LAST_INSERT_ID();"; | |||||
public bool ChangePublishedState(int messageId, string state) | public bool ChangePublishedState(int messageId, string state) | ||||
{ | { | ||||
var sql = | var sql = | ||||
$"UPDATE `{_prefix}.published` SET `Retries`=`Retries`+1,`StatusName` = '{state}' WHERE `Id`={messageId}"; | |||||
$"UPDATE `{_prefix}.published` SET `Retries`=`Retries`+1,`ExpiresAt`=NULL,`StatusName` = '{state}' WHERE `Id`={messageId}"; | |||||
using (var connection = new MySqlConnection(Options.ConnectionString)) | using (var connection = new MySqlConnection(Options.ConnectionString)) | ||||
{ | { | ||||
@@ -141,7 +141,7 @@ SELECT * FROM `{_prefix}.received` WHERE Id=LAST_INSERT_ID();"; | |||||
public bool ChangeReceivedState(int messageId, string state) | public bool ChangeReceivedState(int messageId, string state) | ||||
{ | { | ||||
var sql = | var sql = | ||||
$"UPDATE `{_prefix}.received` SET `Retries`=`Retries`+1,`StatusName` = '{state}' WHERE `Id`={messageId}"; | |||||
$"UPDATE `{_prefix}.received` SET `Retries`=`Retries`+1,`ExpiresAt`=NULL,`StatusName` = '{state}' WHERE `Id`={messageId}"; | |||||
using (var connection = new MySqlConnection(Options.ConnectionString)) | using (var connection = new MySqlConnection(Options.ConnectionString)) | ||||
{ | { | ||||
@@ -113,7 +113,7 @@ namespace DotNetCore.CAP.PostgreSql | |||||
public bool ChangePublishedState(int messageId, string state) | public bool ChangePublishedState(int messageId, string state) | ||||
{ | { | ||||
var sql = | var sql = | ||||
$"UPDATE \"{Options.Schema}\".\"published\" SET \"Retries\"=\"Retries\"+1,\"StatusName\" = '{state}' WHERE \"Id\"={messageId}"; | |||||
$"UPDATE \"{Options.Schema}\".\"published\" SET \"Retries\"=\"Retries\"+1,\"ExpiresAt\"=NULL,\"StatusName\" = '{state}' WHERE \"Id\"={messageId}"; | |||||
using (var connection = new NpgsqlConnection(Options.ConnectionString)) | using (var connection = new NpgsqlConnection(Options.ConnectionString)) | ||||
{ | { | ||||
@@ -124,7 +124,7 @@ namespace DotNetCore.CAP.PostgreSql | |||||
public bool ChangeReceivedState(int messageId, string state) | public bool ChangeReceivedState(int messageId, string state) | ||||
{ | { | ||||
var sql = | var sql = | ||||
$"UPDATE \"{Options.Schema}\".\"received\" SET \"Retries\"=\"Retries\"+1,\"StatusName\" = '{state}' WHERE \"Id\"={messageId}"; | |||||
$"UPDATE \"{Options.Schema}\".\"received\" SET \"Retries\"=\"Retries\"+1,\"ExpiresAt\"=NULL,\"StatusName\" = '{state}' WHERE \"Id\"={messageId}"; | |||||
using (var connection = new NpgsqlConnection(Options.ConnectionString)) | using (var connection = new NpgsqlConnection(Options.ConnectionString)) | ||||
{ | { | ||||
@@ -68,19 +68,6 @@ OUTPUT DELETED.MessageId,DELETED.[MessageType];"; | |||||
} | } | ||||
} | } | ||||
public bool ChangePublishedState(int messageId, string state) | |||||
{ | |||||
var sql = | |||||
$"UPDATE [{Options.Schema}].[Published] SET Retries=Retries+1,StatusName = '{state}' WHERE Id={messageId}"; | |||||
using (var connection = new SqlConnection(Options.ConnectionString)) | |||||
{ | |||||
return connection.Execute(sql) > 0; | |||||
} | |||||
} | |||||
// CapReceivedMessage | |||||
public async Task StoreReceivedMessageAsync(CapReceivedMessage message) | public async Task StoreReceivedMessageAsync(CapReceivedMessage message) | ||||
{ | { | ||||
if (message == null) throw new ArgumentNullException(nameof(message)); | if (message == null) throw new ArgumentNullException(nameof(message)); | ||||
@@ -124,10 +111,21 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; | |||||
} | } | ||||
} | } | ||||
public bool ChangePublishedState(int messageId, string state) | |||||
{ | |||||
var sql = | |||||
$"UPDATE [{Options.Schema}].[Published] SET Retries=Retries+1,ExpiresAt=NULL,StatusName = '{state}' WHERE Id={messageId}"; | |||||
using (var connection = new SqlConnection(Options.ConnectionString)) | |||||
{ | |||||
return connection.Execute(sql) > 0; | |||||
} | |||||
} | |||||
public bool ChangeReceivedState(int messageId, string state) | public bool ChangeReceivedState(int messageId, string state) | ||||
{ | { | ||||
var sql = | var sql = | ||||
$"UPDATE [{Options.Schema}].[Received] SET Retries=Retries+1,StatusName = '{state}' WHERE Id={messageId}"; | |||||
$"UPDATE [{Options.Schema}].[Received] SET Retries=Retries+1,ExpiresAt=NULL,StatusName = '{state}' WHERE Id={messageId}"; | |||||
using (var connection = new SqlConnection(Options.ConnectionString)) | using (var connection = new SqlConnection(Options.ConnectionString)) | ||||
{ | { | ||||