|
|
@@ -30,7 +30,7 @@ namespace DotNetCore.CAP.MySql |
|
|
|
return new MySqlStorageTransaction(this); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<CapPublishedMessage> GetPublishedMessageAsync(int id) |
|
|
|
public async Task<CapPublishedMessage> GetPublishedMessageAsync(long id) |
|
|
|
{ |
|
|
|
var sql = $@"SELECT * FROM `{_prefix}.published` WHERE `Id`={id};"; |
|
|
|
|
|
|
@@ -52,7 +52,7 @@ namespace DotNetCore.CAP.MySql |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Task StoreReceivedMessageAsync(CapReceivedMessage message) |
|
|
|
public void StoreReceivedMessage(CapReceivedMessage message) |
|
|
|
{ |
|
|
|
if (message == null) |
|
|
|
{ |
|
|
@@ -60,16 +60,16 @@ namespace DotNetCore.CAP.MySql |
|
|
|
} |
|
|
|
|
|
|
|
var sql = $@" |
|
|
|
INSERT INTO `{_prefix}.received`(`Name`,`Group`,`Content`,`Retries`,`Added`,`ExpiresAt`,`StatusName`) |
|
|
|
VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; |
|
|
|
INSERT INTO `{_prefix}.received`(`Id`,`Name`,`Group`,`Content`,`Retries`,`Added`,`ExpiresAt`,`StatusName`) |
|
|
|
VALUES(@Id,@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; |
|
|
|
|
|
|
|
using (var connection = new MySqlConnection(Options.ConnectionString)) |
|
|
|
{ |
|
|
|
return connection.ExecuteScalarAsync<int>(sql, message); |
|
|
|
connection.Execute(sql, message); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<CapReceivedMessage> GetReceivedMessageAsync(int id) |
|
|
|
public async Task<CapReceivedMessage> GetReceivedMessageAsync(long id) |
|
|
|
{ |
|
|
|
var sql = $@"SELECT * FROM `{_prefix}.received` WHERE Id={id};"; |
|
|
|
using (var connection = new MySqlConnection(Options.ConnectionString)) |
|
|
@@ -89,7 +89,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public bool ChangePublishedState(int messageId, string state) |
|
|
|
public bool ChangePublishedState(long messageId, string state) |
|
|
|
{ |
|
|
|
var sql = |
|
|
|
$"UPDATE `{_prefix}.published` SET `Retries`=`Retries`+1,`ExpiresAt`=NULL,`StatusName` = '{state}' WHERE `Id`={messageId}"; |
|
|
@@ -100,7 +100,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public bool ChangeReceivedState(int messageId, string state) |
|
|
|
public bool ChangeReceivedState(long messageId, string state) |
|
|
|
{ |
|
|
|
var sql = |
|
|
|
$"UPDATE `{_prefix}.received` SET `Retries`=`Retries`+1,`ExpiresAt`=NULL,`StatusName` = '{state}' WHERE `Id`={messageId}"; |
|
|
|