Skip to content

Instantly share code, notes, and snippets.

@fatihdumanli
Created November 3, 2020 11:40
Show Gist options
  • Save fatihdumanli/d1e22c3d2a0227452ae032a9a9117d1a to your computer and use it in GitHub Desktop.
Save fatihdumanli/d1e22c3d2a0227452ae032a9a9117d1a to your computer and use it in GitHub Desktop.
Publishing an event
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