Esempio n. 1
0
        private static async Task RunSender(List <IReceiver> receivers)
        {
            using (var sender = MessagingScenarioFactory.CreateSender("Sender"))
            {
                while (true)
                {
                    Console.WriteLine($"Enter a message for sender '{sender.Name}'. Add headers as a trailing JSON object. Leave blank to quit.");
                    Console.Write("message > ");
                    string message;
                    if ((message = Console.ReadLine()) == "")
                    {
                        break;
                    }

                    if (TryExtractHeaders(ref message, out var headers))
                    {
                        await sender.SendAsync(new SenderMessage(message) { Headers = headers });
                    }
Esempio n. 2
0
        private static void RunSender()
        {
            using (var sender = MessagingScenarioFactory.CreateSender("Sender1"))
            {
                Console.WriteLine($"Enter a message for sender '{sender.Name}'. Add headers as a trailing JSON object. Leave blank to quit.");
                string message;
                while (true)
                {
                    Console.Write("message>");
                    if ((message = Console.ReadLine()) == "")
                    {
                        return;
                    }

                    if (TryExtractHeaders(ref message, out var headers))
                    {
                        sender.Send(new SenderMessage(message)
                        {
                            Headers = headers
                        });
                    }
Esempio n. 3
0
            public TestSenderDecorator(string name, string senderName)
#pragma warning disable CA2000 // Dispose objects before losing scope
                : this(name, MessagingScenarioFactory.CreateSender(senderName))
#pragma warning restore CA2000 // Dispose objects before losing scope
            {
            }
Esempio n. 4
0
 public TestSenderDecorator(string name, string senderName)
     : this(name, MessagingScenarioFactory.CreateSender(senderName))
 {
 }