using MassTransit;
using Shared;
using System;
using System.Threading.Tasks;

namespace Producer
{
    public class MessageA : IMessageA
    {
        public string Text { get; set; }
    }
    public class MessageB : IMessageB
    {
        public string Text { get; set; }
    }
    public class MessageC : IMessageC
    {
        public string Text { get; set; }
    }
    class Program
    {
        static async Task Main(string[] args)
        {
            string rabbitMqUri = "amqps://wmfjyalu:X0GmitgZM7iXUPmT4uymccexqiTKoxJq@shark.rmq.cloudamqp.com/wmfjyalu";
            string queue = "test-queue";
            string userName = "wmfjyalu";
            string password = "X0GmitgZM7iXUPmT4uymccexqiTKoxJq";

            var bus = Bus.Factory.CreateUsingRabbitMq(factory =>
            {
                factory.Host(rabbitMqUri, configurator =>
                {
                    configurator.Username(userName);
                    configurator.Password(password);
                });
            });

            await bus.Publish<IMessageA>(new MessageA { Text = "mesaj a" });
            await bus.Publish<IMessageB>(new MessageB { Text = "mesaj b" });
            await bus.Publish<IMessageC>(new MessageC { Text = "mesaj c" });

            Console.WriteLine("Mesajlar gönderilmiştir.");

            Console.Read();
        }
    }
}
