Skip to content

Commit

Permalink
publish message effect (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
oncicaradupopovici authored Oct 2, 2023
1 parent 37f1dd5 commit 9298402
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Messaging/NBB.Messaging.Effects/PublishMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ namespace NBB.Messaging.Effects
{
public class PublishMessage
{
public class SideEffect : ISideEffect
{
public object Message { get; }

public SideEffect(object message)
{
Message = message;
}
}
public record SideEffect(object Message, MessagingPublisherOptions Options = null) : ISideEffect;

public class Handler : ISideEffectHandler<SideEffect, Unit>
{
Expand All @@ -31,7 +23,7 @@ public Handler(IMessageBusPublisher messageBusPublisher)

public async Task<Unit> Handle(SideEffect sideEffect, CancellationToken cancellationToken = default)
{
await _messageBusPublisher.PublishAsync(sideEffect.Message as dynamic, null, cancellationToken);
await _messageBusPublisher.PublishAsync(sideEffect.Message as dynamic, sideEffect.Options, cancellationToken);
return Unit.Value;
}
}
Expand Down

0 comments on commit 9298402

Please sign in to comment.