Created
November 3, 2020 11:40
-
-
Save fatihdumanli/d1e22c3d2a0227452ae032a9a9117d1a to your computer and use it in GitHub Desktop.
Publishing an event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void BasicPublish(IEvent @event) | |
{ | |
using(var channel = connection.CreateModel()) | |
{ | |
channel.ExchangeDeclare(EVENT_EXCHANGE_NAME, type: ExchangeType.Fanout); | |
channel.BasicPublish(exchange: EVENT_EXCHANGE_NAME, routingKey: string.Empty, basicProperties: null, body: @event.ToJson().ToByteArray()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment