@@ -5,7 +5,7 @@ namespace DotNetCore.CAP.Internal | |||||
/// <summary> | /// <summary> | ||||
/// A context for consumers, it used to be provider wrapper of method description and received message. | /// A context for consumers, it used to be provider wrapper of method description and received message. | ||||
/// </summary> | /// </summary> | ||||
public class ConsumerContext | |||||
internal class ConsumerContext | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// create a new instance of <see cref="ConsumerContext" /> . | /// create a new instance of <see cref="ConsumerContext" /> . | ||||
@@ -4,7 +4,7 @@ using System.Text; | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public class ConsumerExecutedResult | |||||
internal class ConsumerExecutedResult | |||||
{ | { | ||||
public ConsumerExecutedResult(object result, string msgId, string callbackName) | public ConsumerExecutedResult(object result, string msgId, string callbackName) | ||||
{ | { | ||||
@@ -6,7 +6,7 @@ namespace DotNetCore.CAP.Internal | |||||
/// <summary> | /// <summary> | ||||
/// A descriptor of user definition method. | /// A descriptor of user definition method. | ||||
/// </summary> | /// </summary> | ||||
public class ConsumerExecutorDescriptor | |||||
internal class ConsumerExecutorDescriptor | |||||
{ | { | ||||
public MethodInfo MethodInfo { get; set; } | public MethodInfo MethodInfo { get; set; } | ||||
@@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging; | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public class ConsumerInvokerFactory : IConsumerInvokerFactory | |||||
internal class ConsumerInvokerFactory : IConsumerInvokerFactory | |||||
{ | { | ||||
private readonly ILogger _logger; | private readonly ILogger _logger; | ||||
private readonly IMessagePacker _messagePacker; | private readonly IMessagePacker _messagePacker; | ||||
@@ -2,7 +2,7 @@ | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public interface ICallbackMessageSender | |||||
internal interface ICallbackMessageSender | |||||
{ | { | ||||
Task SendAsync(string messageId, string topicName, object bodyObj); | Task SendAsync(string messageId, string topicName, object bodyObj); | ||||
} | } |
@@ -7,7 +7,7 @@ using Microsoft.Extensions.Logging; | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public class DefaultConsumerInvoker : IConsumerInvoker | |||||
internal class DefaultConsumerInvoker : IConsumerInvoker | |||||
{ | { | ||||
private readonly ILogger _logger; | private readonly ILogger _logger; | ||||
private readonly IModelBinderFactory _modelBinderFactory; | private readonly IModelBinderFactory _modelBinderFactory; | ||||
@@ -1,12 +1,11 @@ | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using DotNetCore.CAP.Abstractions; | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Perform user definition method of consumers. | /// Perform user definition method of consumers. | ||||
/// </summary> | /// </summary> | ||||
public interface IConsumerInvoker | |||||
internal interface IConsumerInvoker | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Invoke consumer method whit consumer context. | /// Invoke consumer method whit consumer context. | ||||
@@ -1,6 +1,6 @@ | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public interface IConsumerInvokerFactory | |||||
internal interface IConsumerInvokerFactory | |||||
{ | { | ||||
IConsumerInvoker CreateInvoker(); | IConsumerInvoker CreateInvoker(); | ||||
} | } |
@@ -12,7 +12,7 @@ namespace DotNetCore.CAP.Internal | |||||
/// <summary> | /// <summary> | ||||
/// A default <see cref="T:DotNetCore.CAP.Abstractions.IConsumerServiceSelector" /> implementation. | /// A default <see cref="T:DotNetCore.CAP.Abstractions.IConsumerServiceSelector" /> implementation. | ||||
/// </summary> | /// </summary> | ||||
public class DefaultConsumerServiceSelector : IConsumerServiceSelector | |||||
internal class DefaultConsumerServiceSelector : IConsumerServiceSelector | |||||
{ | { | ||||
private readonly IServiceProvider _serviceProvider; | private readonly IServiceProvider _serviceProvider; | ||||
@@ -5,7 +5,7 @@ namespace DotNetCore.CAP.Internal | |||||
/// <summary> | /// <summary> | ||||
/// Defines an interface for selecting an consumer service method to invoke for the current message. | /// Defines an interface for selecting an consumer service method to invoke for the current message. | ||||
/// </summary> | /// </summary> | ||||
public interface IConsumerServiceSelector | |||||
internal interface IConsumerServiceSelector | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Selects a set of <see cref="ConsumerExecutorDescriptor" /> candidates for the current message associated with | /// Selects a set of <see cref="ConsumerExecutorDescriptor" /> candidates for the current message associated with | ||||
@@ -1,15 +1,21 @@ | |||||
using DotNetCore.CAP.Abstractions; | |||||
using System; | |||||
using DotNetCore.CAP.Abstractions; | |||||
using DotNetCore.CAP.Infrastructure; | using DotNetCore.CAP.Infrastructure; | ||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public class JsonContentSerializer : IContentSerializer | |||||
internal class JsonContentSerializer : IContentSerializer | |||||
{ | { | ||||
public T DeSerialize<T>(string messageObjStr) | public T DeSerialize<T>(string messageObjStr) | ||||
{ | { | ||||
return Helper.FromJson<T>(messageObjStr); | return Helper.FromJson<T>(messageObjStr); | ||||
} | } | ||||
public object DeSerialize(string content, Type type) | |||||
{ | |||||
return Helper.FromJson(content, type); | |||||
} | |||||
public string Serialize<T>(T messageObj) | public string Serialize<T>(T messageObj) | ||||
{ | { | ||||
return Helper.ToJson(messageObj); | return Helper.ToJson(messageObj); | ||||
@@ -3,7 +3,7 @@ using DotNetCore.CAP.Models; | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public class DefaultMessagePacker : IMessagePacker | |||||
internal class DefaultMessagePacker : IMessagePacker | |||||
{ | { | ||||
private readonly IContentSerializer _serializer; | private readonly IContentSerializer _serializer; | ||||
@@ -8,7 +8,7 @@ using DotNetCore.CAP.Abstractions.ModelBinding; | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public class SimpleTypeModelBinder : IModelBinder | |||||
internal class SimpleTypeModelBinder : IModelBinder | |||||
{ | { | ||||
private readonly ParameterInfo _parameterInfo; | private readonly ParameterInfo _parameterInfo; | ||||
private readonly TypeConverter _typeConverter; | private readonly TypeConverter _typeConverter; | ||||
@@ -1,11 +1,12 @@ | |||||
using System; | using System; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using DotNetCore.CAP.Abstractions; | |||||
using DotNetCore.CAP.Models; | using DotNetCore.CAP.Models; | ||||
using Microsoft.Extensions.Logging; | using Microsoft.Extensions.Logging; | ||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public class DefaultSubscriberExecutor : ISubscriberExecutor | |||||
internal class DefaultSubscriberExecutor : ISubscriberExecutor | |||||
{ | { | ||||
private readonly ICallbackMessageSender _callbackMessageSender; | private readonly ICallbackMessageSender _callbackMessageSender; | ||||
private readonly ILogger<DefaultSubscriberExecutor> _logger; | private readonly ILogger<DefaultSubscriberExecutor> _logger; | ||||
@@ -41,11 +42,11 @@ namespace DotNetCore.CAP.Internal | |||||
var executeDescriptor = executeDescriptorGroup[receivedMessage.Group][0]; | var executeDescriptor = executeDescriptorGroup[receivedMessage.Group][0]; | ||||
var consumerContext = new ConsumerContext(executeDescriptor, receivedMessage.ToMessageContext()); | var consumerContext = new ConsumerContext(executeDescriptor, receivedMessage.ToMessageContext()); | ||||
var ret = await Invoker.InvokeAsync(consumerContext); | |||||
var ret = await Invoker.InvokeAsync(consumerContext); | |||||
if (!string.IsNullOrEmpty(ret.CallbackName)) | |||||
await _callbackMessageSender.SendAsync(ret.MessageId, ret.CallbackName, ret.Result); | |||||
if (!string.IsNullOrEmpty(ret.CallbackName)) | |||||
await _callbackMessageSender.SendAsync(ret.MessageId,ret.CallbackName,ret.Result); | |||||
return OperateResult.Success; | return OperateResult.Success; | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -6,7 +6,7 @@ using DotNetCore.CAP.Abstractions; | |||||
namespace DotNetCore.CAP.Internal | namespace DotNetCore.CAP.Internal | ||||
{ | { | ||||
public class MethodMatcherCache | |||||
internal class MethodMatcherCache | |||||
{ | { | ||||
private readonly IConsumerServiceSelector _selector; | private readonly IConsumerServiceSelector _selector; | ||||