Commit 1d3692d4 authored by yangxiaodong's avatar yangxiaodong

Add summary comment.

parent 34f77642
using System.Text; using System;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Infrastructure; using DotNetCore.CAP.Infrastructure;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
...@@ -36,5 +37,9 @@ namespace DotNetCore.CAP.RabbitMQ ...@@ -36,5 +37,9 @@ namespace DotNetCore.CAP.RabbitMQ
return Task.CompletedTask; return Task.CompletedTask;
} }
} }
public Task SendAsync<T>(string topic, T contentObj) {
throw new NotImplementedException();
}
} }
} }
\ No newline at end of file
...@@ -9,6 +9,9 @@ using Microsoft.Extensions.Options; ...@@ -9,6 +9,9 @@ using Microsoft.Extensions.Options;
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
/// <summary>
/// Default implement of <see cref="IBootstrapper"/>.
/// </summary>
public class DefaultBootstrapper : IBootstrapper public class DefaultBootstrapper : IBootstrapper
{ {
private IApplicationLifetime _appLifetime; private IApplicationLifetime _appLifetime;
...@@ -27,6 +30,7 @@ namespace DotNetCore.CAP ...@@ -27,6 +30,7 @@ namespace DotNetCore.CAP
_appLifetime = appLifetime; _appLifetime = appLifetime;
Provider = provider; Provider = provider;
Servers = Provider.GetServices<IProcessingServer>(); Servers = Provider.GetServices<IProcessingServer>();
_cts = new CancellationTokenSource(); _cts = new CancellationTokenSource();
_ctsRegistration = appLifetime.ApplicationStopping.Register(() => _ctsRegistration = appLifetime.ApplicationStopping.Register(() =>
{ {
......
...@@ -6,6 +6,9 @@ using Microsoft.Extensions.Logging; ...@@ -6,6 +6,9 @@ using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
/// <summary>
/// Cap <see cref="ICapProducerService"/> default implement.
/// </summary>
public class DefaultProducerService : ICapProducerService public class DefaultProducerService : ICapProducerService
{ {
private readonly ICapMessageStore _store; private readonly ICapMessageStore _store;
...@@ -29,13 +32,13 @@ namespace DotNetCore.CAP ...@@ -29,13 +32,13 @@ namespace DotNetCore.CAP
return StoreMessage(topic, content); return StoreMessage(topic, content);
} }
public Task SendAsync<T>(string topic, T obj) public Task SendAsync<T>(string topic, T contentObj)
{ {
if (topic == null) throw new ArgumentNullException(nameof(topic)); if (topic == null) throw new ArgumentNullException(nameof(topic));
var content = Helper.ToJson(obj); var content = Helper.ToJson(contentObj);
if (content == null) if (content == null)
throw new InvalidCastException(nameof(obj)); throw new InvalidCastException(nameof(contentObj));
return StoreMessage(topic, content); return StoreMessage(topic, content);
} }
......
...@@ -2,8 +2,25 @@ ...@@ -2,8 +2,25 @@
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
/// <summary>
/// Cap producer service for store message to database.
/// </summary>
public interface ICapProducerService public interface ICapProducerService
{ {
/// <summary>
/// Send a message to cap job.
/// </summary>
/// <param name="topic">the topic name or exchange router key.</param>
/// <param name="content">message body content.</param>
Task SendAsync(string topic, string content); Task SendAsync(string topic, string content);
/// <summary>
/// Send a message to cap job.
/// </summary>
/// <typeparam name="T">The type of conetent object.</typeparam>
/// <param name="topic">the topic name or exchange router key.</param>
/// <param name="contentObj">object instance that will be serialized of json.</param>
/// <returns></returns>
Task SendAsync<T>(string topic, T contentObj);
} }
} }
\ No newline at end of file
...@@ -5,6 +5,9 @@ using DotNetCore.CAP.Infrastructure; ...@@ -5,6 +5,9 @@ using DotNetCore.CAP.Infrastructure;
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
/// <summary>
/// consumer client
/// </summary>
public interface IConsumerClient : IDisposable public interface IConsumerClient : IDisposable
{ {
void Subscribe(string topic); void Subscribe(string topic);
......
...@@ -5,8 +5,17 @@ using System.Threading.Tasks; ...@@ -5,8 +5,17 @@ using System.Threading.Tasks;
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
/// <summary>
/// Consumer client factory to create consumer client instance.
/// </summary>
public interface IConsumerClientFactory public interface IConsumerClientFactory
{ {
/// <summary>
/// Create a new instance of <see cref="IConsumerClient"/>.
/// </summary>
/// <param name="groupId"></param>
/// <param name="clientHostAddress"></param>
/// <returns></returns>
IConsumerClient Create(string groupId, string clientHostAddress); IConsumerClient Create(string groupId, string clientHostAddress);
} }
} }
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
/// <summary>
/// An empty interface, which is used to mark the current class have a CAP methods.
/// </summary>
public interface IConsumerService public interface IConsumerService
{ {
} }
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
/// <summary>
/// A process thread abstract of job process.
/// </summary>
public interface IProcessingServer : IDisposable public interface IProcessingServer : IDisposable
{ {
void Start(); void Start();
......
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