Beispiel #1
0
        public async Task SendBatch()
        {
            var msgs = new Message[] { new Message(), new Message(), new Message(), new Message() };

            var bq = new BusTopicClient(new TopicClient(connection, this.name));
            await bq.Send(msgs);
        }
Beispiel #2
0
        public async Task SendBatch()
        {
            var msgs = new BrokeredMessage[] { new BrokeredMessage(), new BrokeredMessage(), new BrokeredMessage(), new BrokeredMessage() };

            var bq = new BusTopicClient(TopicClient.CreateFromConnectionString(connection, this.name));
            await bq.Send(msgs);
        }
Beispiel #3
0
        public async Task Receive()
        {
            var expected = Guid.NewGuid().ToByteArray();
            var msg      = new Message(expected);

            var rClient = new BusSubscriptionClient(connection, recieveName, subName);

            rClient.OnMessage(this.Get, new MessageHandlerOptions(async(ExceptionReceivedEventArgs args) => { await Task.Run(() => {}); }));

            var sClient = new BusTopicClient(connection, recieveName);
            await sClient.Send(msg);

            for (var i = 0; i < 100 && null == message; i++)
            {
                Thread.Sleep(20);
            }

            if (null == message)
            {
                Assert.Fail("did not recieve message.");
            }
            else
            {
                Assert.AreEqual(expected, message.Body);
            }
        }
Beispiel #4
0
        public async Task ReceiveBatch()
        {
            var random = new Random();
            var count  = random.Next(1, 11);
            var sent   = new List <Guid>();
            var bq     = new BusTopicClient(name, connection);

            for (var i = 0; i < count; i++)
            {
                var expected = Guid.NewGuid();
                var msg      = new BrokeredMessage(expected);
                await bq.Send(msg);

                sent.Add(expected);
            }

            var r = new BusSubscriptionClient(name, connection, "testing");

            var got = await r.RecieveBatch(count, TimeSpan.FromSeconds(10));

            foreach (var msg in got)
            {
                var result = msg.GetBody <Guid>();
                Assert.IsTrue(sent.Contains(result));
            }
        }
        public async Task SendBatch()
        {
            var msgs = new Message[] { new Message(), new Message(), new Message(), new Message() };

            var queue = new BusTopicClient(connection, sendBatchName);
            await queue.Send(msgs);
        }
Beispiel #6
0
        public async Task Receive()
        {
            var expected = Guid.NewGuid();
            var msg      = new BrokeredMessage(expected);
            var bq       = new BusTopicClient(name, connection);
            await bq.Send(msg);

            var r         = new BusSubscriptionClient(name, connection, "testing");
            var resultMsg = await r.Recieve(TimeSpan.FromSeconds(10));

            var result = resultMsg.GetBody <Guid>();

            Assert.AreEqual(expected, result);
        }
Beispiel #7
0
 public async Task Send()
 {
     var msg = new Message();
     var bq  = new BusTopicClient(new TopicClient(connection, this.name));
     await bq.Send(msg);
 }
Beispiel #8
0
 public async Task SendBatch()
 {
     var msgs = new BrokeredMessage[] { new BrokeredMessage(), new BrokeredMessage(), new BrokeredMessage(), new BrokeredMessage() };
     var bq   = new BusTopicClient(name, connection);
     await bq.Send(msgs);
 }
Beispiel #9
0
 public async Task Send()
 {
     var msg = new BrokeredMessage();
     var bq  = new BusTopicClient(name, connection);
     await bq.Send(msg);
 }
 public async Task Send()
 {
     var queue = new BusTopicClient(connection, sendName);
     await queue.Send(new Message());
 }