Commit e5175a6c authored by Savorboard's avatar Savorboard

code cleanup

parent b1bd53bf
...@@ -4,7 +4,7 @@ using System.Data; ...@@ -4,7 +4,7 @@ using System.Data;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Dapper; using Dapper;
using DotNetCore.CAP.Infrastructure; using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Serialization; using DotNetCore.CAP.Serialization;
......
...@@ -7,7 +7,7 @@ using System.Diagnostics; ...@@ -7,7 +7,7 @@ using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Diagnostics; using DotNetCore.CAP.Diagnostics;
using DotNetCore.CAP.Infrastructure; using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using DotNetCore.CAP.Abstractions; using DotNetCore.CAP.Abstractions;
// ReSharper disable once CheckNamespace // ReSharper disable once CheckNamespace
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
/// <summary>
/// An attribute for subscribe event bus message.
/// </summary>
public class CapSubscribeAttribute : TopicAttribute public class CapSubscribeAttribute : TopicAttribute
{ {
public CapSubscribeAttribute(string name) public CapSubscribeAttribute(string name)
...@@ -29,4 +28,12 @@ namespace DotNetCore.CAP ...@@ -29,4 +28,12 @@ namespace DotNetCore.CAP
{ {
} }
public class CapHeader : ReadOnlyDictionary<string, string>
{
public CapHeader(IDictionary<string, string> dictionary) : base(dictionary)
{
}
}
} }
\ No newline at end of file
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace DotNetCore.CAP
{
public class CapHeader : ReadOnlyDictionary<string, string>
{
public CapHeader(IDictionary<string, string> dictionary) : base(dictionary)
{
}
}
}
\ No newline at end of file
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Threading.Tasks;
using DotNetCore.CAP.Messages;
namespace DotNetCore.CAP
{
/// <summary>
/// A callback that is sent to Producer after a successful consumer execution
/// </summary>
public interface ICallbackPublisher
{
/// <summary>
/// Publish a callback message
/// </summary>
Task PublishCallbackAsync(CapPublishedMessage obj);
}
}
\ No newline at end of file
...@@ -7,9 +7,9 @@ using System.Linq; ...@@ -7,9 +7,9 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DotNetCore.CAP.Abstractions; using DotNetCore.CAP.Abstractions;
using DotNetCore.CAP.Infrastructure;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using DotNetCore.CAP.Internal;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace DotNetCore.CAP namespace DotNetCore.CAP
......
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Threading.Tasks;
using DotNetCore.CAP.Messages;
namespace DotNetCore.CAP
{
/// <summary>
/// Represents a connection to the storage.
/// </summary>
public interface IStorageConnection
{
//Sent messages
/// <summary>
/// Returns the message with the given id.
/// </summary>
/// <param name="id">The message's id.</param>
Task<CapPublishedMessage> GetPublishedMessageAsync(long id);
/// <summary>
/// Returns executed failed messages.
/// </summary>
Task<IEnumerable<CapPublishedMessage>> GetPublishedMessagesOfNeedRetry();
// Received messages
/// <summary>
/// Stores the message.
/// </summary>
/// <param name="message">The message to store.</param>
void StoreReceivedMessage(CapReceivedMessage message);
/// <summary>
/// Returns the message with the given id.
/// </summary>
/// <param name="id">The message's id.</param>
Task<CapReceivedMessage> GetReceivedMessageAsync(long id);
/// <summary>
/// Returns executed failed message.
/// </summary>
Task<IEnumerable<CapReceivedMessage>> GetReceivedMessagesOfNeedRetry();
/// <summary>
/// Change specified message's state of published message
/// </summary>
/// <param name="messageId">Message id</param>
/// <param name="state">State name</param>
bool ChangePublishedState(long messageId, string state);
/// <summary>
/// Change specified message's state of received message
/// </summary>
/// <param name="messageId">Message id</param>
/// <param name="state">State name</param>
bool ChangeReceivedState(long messageId, string state);
}
}
\ No newline at end of file
...@@ -7,7 +7,6 @@ using System.Diagnostics; ...@@ -7,7 +7,6 @@ using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Diagnostics; using DotNetCore.CAP.Diagnostics;
using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Internal; using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
......
...@@ -5,7 +5,7 @@ using System; ...@@ -5,7 +5,7 @@ using System;
using System.ComponentModel; using System.ComponentModel;
using System.Reflection; using System.Reflection;
namespace DotNetCore.CAP.Infrastructure namespace DotNetCore.CAP.Internal
{ {
public static class Helper public static class Helper
{ {
......
...@@ -5,7 +5,6 @@ using System; ...@@ -5,7 +5,6 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Diagnostics; using DotNetCore.CAP.Diagnostics;
using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Processor; using DotNetCore.CAP.Processor;
......
...@@ -9,7 +9,7 @@ using System.Security.Cryptography; ...@@ -9,7 +9,7 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
namespace DotNetCore.CAP.Infrastructure namespace DotNetCore.CAP.Internal
{ {
/// <summary> /// <summary>
/// Represents an ObjectId /// Represents an ObjectId
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
using System; using System;
namespace DotNetCore.CAP.Infrastructure namespace DotNetCore.CAP.Internal
{ {
public class SnowflakeId public class SnowflakeId
{ {
......
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
namespace DotNetCore.CAP.Infrastructure namespace DotNetCore.CAP.Internal
{ {
/// <summary> /// <summary>
/// The message status name. /// The message status name.
......
...@@ -5,7 +5,7 @@ using System; ...@@ -5,7 +5,7 @@ using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DotNetCore.CAP.Infrastructure namespace DotNetCore.CAP.Internal
{ {
public static class WaitHandleEx public static class WaitHandleEx
{ {
......
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
namespace DotNetCore.CAP.Messages
{
public class CapPublishedMessage
{
public CapPublishedMessage()
{
Added = DateTime.Now;
}
public Message Message { get; set; }
public DateTime Added { get; set; }
public DateTime? ExpiresAt { get; set; }
public int Retries { get; set; }
public string StatusName { get; set; }
}
}
\ No newline at end of file
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
namespace DotNetCore.CAP.Messages
{
public class CapReceivedMessage
{
/// <summary>
/// Initializes a new instance of <see cref="CapReceivedMessage" />.
/// </summary>
public CapReceivedMessage()
{
Added = DateTime.Now;
}
public long Id { get; set; }
public string Group { get; set; }
public string Name { get; set; }
public string Content { get; set; }
public DateTime Added { get; set; }
public DateTime? ExpiresAt { get; set; }
public int Retries { get; set; }
public string StatusName { get; set; }
public override string ToString()
{
return "name:" + Name + ", group:" + Group + ", content:" + Content;
}
}
}
\ No newline at end of file
//using System;
//using System.Collections.Generic;
//using DotNetCore.CAP.Dashboard.Monitoring;
//using DotNetCore.CAP.Messages;
//namespace DotNetCore.CAP.Persistence
//{
// public interface IDashboardQuerying
// {
// StatisticsDto GetStatistics();
// IList<MessageDto> Messages(MessageQueryDto queryDto);
// int PublishedFailedCount();
// int PublishedSucceededCount();
// int ReceivedFailedCount();
// int ReceivedSucceededCount();
// IDictionary<DateTime, int> HourlySucceededJobs(MessageType type);
// IDictionary<DateTime, int> HourlyFailedJobs(MessageType type);
// }
//}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Infrastructure; using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
namespace DotNetCore.CAP.Persistence namespace DotNetCore.CAP.Persistence
...@@ -22,31 +22,5 @@ namespace DotNetCore.CAP.Persistence ...@@ -22,31 +22,5 @@ namespace DotNetCore.CAP.Persistence
Task<IEnumerable<MediumMessage>> GetPublishedMessagesOfNeedRetry(); Task<IEnumerable<MediumMessage>> GetPublishedMessagesOfNeedRetry();
Task<IEnumerable<MediumMessage>> GetReceivedMessagesOfNeedRetry(); Task<IEnumerable<MediumMessage>> GetReceivedMessagesOfNeedRetry();
//Task<CapPublishedMessage> GetPublishedMessageAsync(long id);
//Task<CapReceivedMessage> GetReceivedMessageAsync(long id);
//public void UpdateMessage(CapPublishedMessage message)
//{
// if (message == null)
// {
// throw new ArgumentNullException(nameof(message));
// }
// var sql =
// $"UPDATE `{_prefix}.published` SET `Retries` = @Retries,`Content`= @Content,`ExpiresAt` = @ExpiresAt,`StatusName`=@StatusName WHERE `Id`=@Id;";
// _dbConnection.Execute(sql, message);
//}
//public void UpdateMessage(CapReceivedMessage message)
//{
// if (message == null)
// {
// throw new ArgumentNullException(nameof(message));
// }
// var sql = $"UPDATE `{_prefix}.received` SET `Retries` = @Retries,`Content`= @Content,`ExpiresAt` = @ExpiresAt,`StatusName`=@StatusName WHERE `Id`=@Id;";
// _dbConnection.Execute(sql, message);
//}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment