static async Task Main(string[] args)
        {
            var address = Dns.GetHostAddresses("centos0.mshome.net")[0];
            RabbitMQConnectionBuilder builder = new RabbitMQConnectionBuilder(new IPEndPoint(address, 5672));
            var connection = builder.ConnectionInfo("gamover", "gam2106", "/")
                             .Heartbeat(60 * 10)
                             .ProductName("AMQP.Client.RabbitMQ")
                             .ProductVersion("0.0.1")
                             .ConnectionName("AMQP.Client.RabbitMQ:Test")
                             .ClientInformation("TEST TEST TEST")
                             .ClientCopyright("©")
                             .Build();
            await connection.StartAsync();

            var channel = await connection.CreateChannel();

            var publisher = channel.CreatePublisher();
            ContentHeaderProperties properties = new ContentHeaderProperties();

            properties.AppId         = "testapp";
            properties.CorrelationId = Guid.NewGuid().ToString();
            while (true)
            {
                properties.CorrelationId = Guid.NewGuid().ToString();
                await publisher.Publish("TestExchange", string.Empty, false, false, properties, new byte[32]);
            }
        }
Exemple #2
0
 internal RabbitMQChannelZero(RabbitMQConnectionBuilder builder, RabbitMQProtocol protocol) : base(protocol)
 {
     MainInfo        = builder.MainInfo;
     ClientInfo      = builder.ClientInfo;
     _connectionInfo = builder.ConnInfo;
     _channelId      = 0;
     _isOpen         = false;
 }
        private static async Task RunDefault()
        {
            var address = Dns.GetHostAddresses("centos0.mshome.net")[0];
            RabbitMQConnectionBuilder builder = new RabbitMQConnectionBuilder(new IPEndPoint(address, 5672));
            var connection = builder.ConnectionInfo("gamover", "gam2106", "/")
                             .Heartbeat(60 * 10)
                             .ProductName("AMQP.Client.RabbitMQ")
                             .ProductVersion("0.0.1")
                             .ConnectionName("AMQP.Client.RabbitMQ:Test")
                             .ClientInformation("TEST TEST TEST")
                             .ClientCopyright("©")
                             .Build();
            await connection.StartAsync();

            var channel = await connection.CreateChannel();

            await channel.ExchangeDeclareAsync("TestExchange", ExchangeType.Direct, arguments : new Dictionary <string, object> {
                { "TEST_ARGUMENT", true }
            });

            var queueOk = await channel.QueueDeclareAsync("TestQueue", false, false, false, new Dictionary <string, object> {
                { "TEST_ARGUMENT", true }
            });

            await channel.QueueBindAsync("TestQueue", "TestExchange");

            var publisher = channel.CreatePublisher();
            ContentHeaderProperties properties = new ContentHeaderProperties();

            properties.AppId         = "testapp";
            properties.CorrelationId = Guid.NewGuid().ToString();
            for (var i = 0; i < 500000; i++)
            {
                properties.CorrelationId = Guid.NewGuid().ToString();
                await publisher.Publish("TestExchange", string.Empty, false, false, properties, new byte[32]);
            }

            var consumer = await channel.CreateConsumer("TestQueue", "TestConsumer", noAck : true);

            consumer.Received += async(deliver, result) =>
            {
                //await deliver.Ack();
            };
            await connection.WaitEndReading();
        }
Exemple #4
0
        static async Task Main(string[] args)
        {
            var address = Dns.GetHostAddresses("centos0.mshome.net")[0];
            RabbitMQConnectionBuilder builder = new RabbitMQConnectionBuilder(new IPEndPoint(address, 5672));
            var connection = builder.ConnectionInfo("gamover", "gam2106", "/")
                             .Heartbeat(60 * 10)
                             .ProductName("AMQP.Client.RabbitMQ")
                             .ProductVersion("0.0.1")
                             .ConnectionName("AMQP.Client.RabbitMQ:Test")
                             .ClientInformation("TEST TEST TEST")
                             .ClientCopyright("©")
                             .Build();
            await connection.StartAsync();

            var channel = await connection.CreateChannel();

            var consumer = await channel.CreateConsumer("TestQueue", "TestConsumer", noAck : true);

            consumer.Received += async(deliver, result) =>
            {
                //await deliver.Ack();
            };
            await connection.WaitEndReading();
        }