diff --git a/Source/Euonia.Bus/Core/IHandler.cs b/Source/Euonia.Bus/Core/IHandler.cs index 5692159..b0ee99a 100644 --- a/Source/Euonia.Bus/Core/IHandler.cs +++ b/Source/Euonia.Bus/Core/IHandler.cs @@ -26,8 +26,8 @@ public interface IHandler : IHandler /// Handle message. /// /// The message. - /// The message context. + /// The message context. /// The cancellation token. /// - Task HandleAsync(TMessage message, MessageContext messageContext, CancellationToken cancellationToken = default); + Task HandleAsync(TMessage message, MessageContext context, CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/Source/Euonia.Bus/Core/ServiceBus.cs b/Source/Euonia.Bus/Core/ServiceBus.cs index 7fb4573..95ae1a8 100644 --- a/Source/Euonia.Bus/Core/ServiceBus.cs +++ b/Source/Euonia.Bus/Core/ServiceBus.cs @@ -40,14 +40,16 @@ public Task PublishAsync(TMessage message, PublishOptions options, Act { options ??= new PublishOptions(); - if (!_convention.IsTopicType(message.GetType())) + var messageType = message.GetType(); + + if (!_convention.IsTopicType(messageType)) { - throw new MessageTypeException("The message type is not an event type."); + throw new MessageTypeException("The message type is not an topic type."); } var context = _requestAccessor?.Context; - var channelName = options.Channel ?? MessageCache.Default.GetOrAddChannel(); + var channelName = options.Channel ?? MessageCache.Default.GetOrAddChannel(messageType); var pack = new RoutedMessage(message, channelName) { MessageId = options.MessageId ?? Guid.NewGuid().ToString(), @@ -63,14 +65,16 @@ public Task SendAsync(TMessage message, SendOptions options, Action(); + var channelName = options.Channel ?? MessageCache.Default.GetOrAddChannel(messageType); var pack = new RoutedMessage(message, channelName) { MessageId = options.MessageId ?? Guid.NewGuid().ToString(), @@ -90,14 +94,16 @@ public Task SendAsync(TMessage message, SendOptions { options ??= new SendOptions(); - if (!_convention.IsQueueType(message.GetType())) + var messageType = message.GetType(); + + if (!_convention.IsQueueType(messageType)) { throw new MessageTypeException("The message type is not a queue type."); } var context = _requestAccessor?.Context; - var channelName = options.Channel ?? MessageCache.Default.GetOrAddChannel(); + var channelName = options.Channel ?? MessageCache.Default.GetOrAddChannel(messageType); var pack = new RoutedMessage(message, channelName) { MessageId = options.MessageId ?? Guid.NewGuid().ToString(), @@ -123,9 +129,16 @@ public Task SendAsync(IQueue message, SendOptions opt { options ??= new SendOptions(); + var messageType = message.GetType(); + + if (!_convention.IsQueueType(messageType)) + { + throw new MessageTypeException("The message type is not a queue type."); + } + var context = _requestAccessor?.Context; - var channelName = options.Channel ?? MessageCache.Default.GetOrAddChannel(message.GetType()); + var channelName = options.Channel ?? MessageCache.Default.GetOrAddChannel(messageType); var pack = new RoutedMessage, TResult>(message, channelName) { MessageId = options.MessageId ?? Guid.NewGuid().ToString(), diff --git a/project.props b/project.props index 05ea161..ce6dd56 100644 --- a/project.props +++ b/project.props @@ -1,6 +1,6 @@ - 8.1.2 + 8.1.3 damon Nerosoft Ltd. Euonia