Skip to content

Instantly share code, notes, and snippets.

@fatihdumanli
Created November 3, 2020 11:34
Show Gist options
  • Save fatihdumanli/8c403f1b864f923f583a54901e349a54 to your computer and use it in GitHub Desktop.
Save fatihdumanli/8c403f1b864f923f583a54901e349a54 to your computer and use it in GitHub Desktop.
Publishing a command to rabbitmq server
public void BasicPublish(ICommand command, string destination)
{
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare(COMMAND_EXCHANGE_NAME, type: ExchangeType.Direct);
channel.BasicPublish(exchange: COMMAND_EXCHANGE_NAME, routingKey: destination, basicProperties: null, body: command.ToJson().ToByteArray());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment