|
@@ -3,7 +3,7 @@ |
|
|
|
|
|
|
|
|
using System.Reflection; |
|
|
using System.Reflection; |
|
|
using DotNetCore.CAP.Dashboard.Pages; |
|
|
using DotNetCore.CAP.Dashboard.Pages; |
|
|
using DotNetCore.CAP.Infrastructure; |
|
|
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
|
|
|
|
|
namespace DotNetCore.CAP.Dashboard |
|
|
namespace DotNetCore.CAP.Dashboard |
|
|
{ |
|
|
{ |
|
@@ -83,24 +83,34 @@ namespace DotNetCore.CAP.Dashboard |
|
|
Routes.AddJsonResult("/published/message/(?<Id>.+)", x => |
|
|
Routes.AddJsonResult("/published/message/(?<Id>.+)", x => |
|
|
{ |
|
|
{ |
|
|
var id = int.Parse(x.UriMatch.Groups["Id"].Value); |
|
|
var id = int.Parse(x.UriMatch.Groups["Id"].Value); |
|
|
var message = x.Storage.GetConnection().GetPublishedMessageAsync(id).GetAwaiter().GetResult(); |
|
|
|
|
|
|
|
|
var message = x.Storage.GetConnection().GetPublishedMessageAsync(id) |
|
|
|
|
|
.GetAwaiter().GetResult(); |
|
|
return message.Content; |
|
|
return message.Content; |
|
|
}); |
|
|
}); |
|
|
Routes.AddJsonResult("/received/message/(?<Id>.+)", x => |
|
|
Routes.AddJsonResult("/received/message/(?<Id>.+)", x => |
|
|
{ |
|
|
{ |
|
|
var id = int.Parse(x.UriMatch.Groups["Id"].Value); |
|
|
var id = int.Parse(x.UriMatch.Groups["Id"].Value); |
|
|
var message = x.Storage.GetConnection().GetReceivedMessageAsync(id).GetAwaiter().GetResult(); |
|
|
|
|
|
|
|
|
var message = x.Storage.GetConnection().GetReceivedMessageAsync(id) |
|
|
|
|
|
.GetAwaiter().GetResult(); |
|
|
return message.Content; |
|
|
return message.Content; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
Routes.AddPublishBatchCommand( |
|
|
Routes.AddPublishBatchCommand( |
|
|
"/published/requeue", |
|
|
"/published/requeue", |
|
|
(client, messageId) => |
|
|
(client, messageId) => |
|
|
client.Storage.GetConnection().ChangePublishedState(messageId, StatusName.Scheduled)); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
var msg = client.Storage.GetConnection().GetPublishedMessageAsync(messageId) |
|
|
|
|
|
.GetAwaiter().GetResult(); |
|
|
|
|
|
client.RequestServices.GetService<IDispatcher>().EnqueueToPublish(msg); |
|
|
|
|
|
}); |
|
|
Routes.AddPublishBatchCommand( |
|
|
Routes.AddPublishBatchCommand( |
|
|
"/received/requeue", |
|
|
"/received/requeue", |
|
|
(client, messageId) => |
|
|
(client, messageId) => |
|
|
client.Storage.GetConnection().ChangeReceivedState(messageId, StatusName.Scheduled)); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
var msg = client.Storage.GetConnection().GetReceivedMessageAsync(messageId) |
|
|
|
|
|
.GetAwaiter().GetResult(); |
|
|
|
|
|
client.RequestServices.GetService<IDispatcher>().EnqueueToExecute(msg); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
Routes.AddRazorPage( |
|
|
Routes.AddRazorPage( |
|
|
"/published/(?<StatusName>.+)", |
|
|
"/published/(?<StatusName>.+)", |
|
|