Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ protected override async Task<int> ExecuteAsync(CommandContext context, SearchMe
var table = new Table();
table.AddColumn("Id");
table.AddColumn("Message Type");
table.AddColumn("Status");
table.AddColumn("Processing Time");
table.AddColumn("Critical Time");
table.AddColumn("Delivery Time");
Expand All @@ -37,10 +38,11 @@ protected override async Task<int> ExecuteAsync(CommandContext context, SearchMe
table.AddRow(
message.Id,
message.MessageType,
message.Status.ToString(),
message.ProcessingTime,
message.CriticalTime.StartsWith("-") ? "00:00:00" : message.ProcessingTime,
message.DeliveryTime.StartsWith("-") ? message.DeliveryTime.Substring(1) : message.DeliveryTime,
message.TimeSent.Value.ToString("u"));
message.TimeSent?.ToString("u") ?? "");
}

console.Write(table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class SearchMessagesSettings : GlobalCommandSettings
[CommandOption("--page-size <page-size>")]
[DefaultValue(50)]
[Description("The page size to use when searching messages")]
public uint PageSize { get; set; }
public int PageSize { get; set; }

[CommandOption("--from <from>")]
[Description("The start date to search messages from, using ISO-8601 format (YYYY-MM-DDTHH:mm:ssZ)")]
Expand Down
4 changes: 3 additions & 1 deletion src/BuslyCLI.Console/Infrastructure/ServiceControlClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Net;
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
using BuslyCLI.Infrastructure.ServiceControl;

namespace BuslyCLI.Infrastructure;
Expand All @@ -10,6 +11,7 @@ public class ServiceControlClient(HttpClient httpClient)
private static readonly JsonSerializerOptions JsonOptions = new()
{
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseLower) },
};

public async Task<IReadOnlyList<ServiceControlEndpoint>> GetEndpointsAsync(string baseUrl, CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -62,7 +64,7 @@ public async Task<IReadOnlyList<ServiceControlMessage>> SearchMessagesAsync(
string endpointName = null,
DateTimeOffset? from = null,
DateTimeOffset? to = null,
uint pageSize = 50,
int pageSize = 50,
string sort = "time_sent",
string direction = "desc",
CancellationToken cancellationToken = default)
Expand Down
13 changes: 12 additions & 1 deletion src/BuslyCLI.Console/Infrastructure/ServiceControlMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,26 @@ public class ServiceControlMessage
public string ProcessingTime { get; set; }
public bool IsSystemMessage { get; set; }
public string ConversationId { get; set; }
public string Status { get; set; }
public MessageStatus Status { get; set; }
public string MessageIntent { get; set; }
public string BodyUrl { get; set; }
public int BodySize { get; set; }
public string InstanceId { get; set; }
public IReadOnlyList<ServiceControlMessageHeader> Headers { get; set; } = [];
}

public enum MessageStatus
{
Failed = 1,
RepeatedFailure = 2,
Successful = 3,
ResolvedSuccessfully = 4,
ArchivedFailure = 5,
RetryIssued = 6
}

public class ServiceControlMessageEndpoint

{
public string Name { get; set; }
public string Host { get; set; }
Expand Down