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 class PlaceOrderHandler : | |
IHandleMessages<PlaceOrder> | |
{ | |
static readonly ILog log = LogManager.GetLogger<PlaceOrderHandler>(); | |
static readonly Random random = new Random(); | |
public Task Handle(PlaceOrder message, IMessageHandlerContext context) | |
{ | |
log.Info($"Received PlaceOrder, OrderId = {message.OrderId}"); |
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 class HomeController : Controller | |
{ | |
static int messagesSent; | |
private readonly ILogger<HomeController> _log; | |
private readonly IMessageSession _messageSession; | |
public HomeController(IMessageSession messageSession, ILogger<HomeController> logger) | |
{ | |
_messageSession = messageSession; | |
_log = logger; |
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
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
await CreateHostBuilder(args).RunConsoleAsync(); | |
} | |
public static IHostBuilder CreateHostBuilder(string[] args) | |
{ | |
return Host.CreateDefaultBuilder(args) |
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
using RabbitMQ.Client; | |
using RabbitMQ.Client.Events; | |
using System; | |
using System.Text; | |
class Receive | |
{ | |
public static void Main() | |
{ | |
var factory = new ConnectionFactory() { HostName = "localhost" }; |
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
using System; | |
using RabbitMQ.Client; | |
using System.Text; | |
class Send | |
{ | |
public static void Main() | |
{ | |
var factory = new ConnectionFactory() { HostName = "localhost" }; | |
using(var connection = factory.CreateConnection()) |