Parcourir la source

rename MessageBase to MessageContext

master
Savorboard il y a 7 ans
Parent
révision
73baaa84dc
5 fichiers modifiés avec 12 ajouts et 8 suppressions
  1. +3
    -2
      src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs
  2. +3
    -2
      src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs
  3. +2
    -2
      src/DotNetCore.CAP/Abstractions/ConsumerContext.cs
  4. +1
    -1
      src/DotNetCore.CAP/IConsumerClient.cs
  5. +3
    -1
      src/DotNetCore.CAP/Infrastructure/MessageContext.cs

+ 3
- 2
src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs Voir le fichier

@@ -12,7 +12,7 @@ namespace DotNetCore.CAP.Kafka
private readonly KafkaOptions _kafkaOptions;
private Consumer<Null, string> _consumerClient;

public event EventHandler<MessageBase> MessageReceieved;
public event EventHandler<MessageContext> MessageReceieved;

public IDeserializer<string> StringDeserializer { get; set; }

@@ -65,8 +65,9 @@ namespace DotNetCore.CAP.Kafka

private void ConsumerClient_OnMessage(object sender, Message<Null, string> e)
{
var message = new MessageBase
var message = new MessageContext
{
Group = _groupId,
KeyName = e.Topic,
Content = e.Value
};


+ 3
- 2
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs Voir le fichier

@@ -17,7 +17,7 @@ namespace DotNetCore.CAP.RabbitMQ
private IConnection _connection;
private IModel _channel;

public event EventHandler<MessageBase> MessageReceieved;
public event EventHandler<MessageContext> MessageReceieved;

public RabbitMQConsumerClient(string queueName, RabbitMQOptions options)
{
@@ -77,8 +77,9 @@ namespace DotNetCore.CAP.RabbitMQ

private void OnConsumerReceived(object sender, BasicDeliverEventArgs e)
{
var message = new MessageBase
var message = new MessageContext
{
Group = _queueName,
KeyName = e.RoutingKey,
Content = Encoding.UTF8.GetString(e.Body)
};


+ 2
- 2
src/DotNetCore.CAP/Abstractions/ConsumerContext.cs Voir le fichier

@@ -13,7 +13,7 @@ namespace DotNetCore.CAP.Abstractions
/// </summary>
/// <param name="descriptor">consumer method descriptor. </param>
/// <param name="message"> reveied message.</param>
public ConsumerContext(ConsumerExecutorDescriptor descriptor, MessageBase message)
public ConsumerContext(ConsumerExecutorDescriptor descriptor, MessageContext message)
{
ConsumerDescriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor));
DeliverMessage = message ?? throw new ArgumentNullException(nameof(message));
@@ -27,6 +27,6 @@ namespace DotNetCore.CAP.Abstractions
/// <summary>
/// consumer reveived message.
/// </summary>
public MessageBase DeliverMessage { get; set; }
public MessageContext DeliverMessage { get; set; }
}
}

+ 1
- 1
src/DotNetCore.CAP/IConsumerClient.cs Voir le fichier

@@ -14,6 +14,6 @@ namespace DotNetCore.CAP

void Listening(TimeSpan timeout);

event EventHandler<MessageBase> MessageReceieved;
event EventHandler<MessageContext> MessageReceieved;
}
}

src/DotNetCore.CAP/Infrastructure/MessageBase.cs → src/DotNetCore.CAP/Infrastructure/MessageContext.cs Voir le fichier

@@ -1,7 +1,9 @@
namespace DotNetCore.CAP.Infrastructure
{
public class MessageBase
public class MessageContext
{
public string Group { get; set; }

public string KeyName { get; set; }

public string Content { get; set; }

Chargement…
Annuler
Enregistrer