Exemple #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Starting IoC publisher...");

            var builder = new ContainerBuilder();
            builder.RegisterType<MassTransitBus>().As<IBus>().SingleInstance();
            IContainer container = builder.Build();

            var bus = container.Resolve<IBus>();

            Console.WriteLine("Press Enter to publish a random message or 'x' if you get bored");
            while (Console.ReadLine().Trim() != "x")
            {
                var message = new SimpleMessage();
                bus.Publish(message);
                Console.WriteLine("Published message " + message.Id);
            }

            Console.WriteLine("Stopping IoC publisher...");
        }
Exemple #2
0
        public static void Main()
        {
            Console.WriteLine("Starting publisher...");
            var bus = ServiceBusFactory.New(sbc =>
            {
                sbc.UseMsmq();
                sbc.VerifyMsmqConfiguration();
                sbc.UseMulticastSubscriptionClient();
                sbc.ReceiveFrom("msmq://localhost/masstransittest_publisher");
            });

            Console.WriteLine("Press Enter to publish a random message or 'x' if you get bored");
            while (Console.ReadLine().Trim() != "x")
            {
                var message = new SimpleMessage();
                bus.Publish(message);
                Console.WriteLine("Published message " + message.Id);
            }

            Console.WriteLine("Stopping publisher...");
        }
 public ActionResult Index()
 {
     var message = new SimpleMessage();
     _bus.Publish(message);
     return View(message);
 }