GetConnection() 공개 메소드

public GetConnection ( ) : IConnection
리턴 IConnection
 public uint GetMessageCount()
 {
     using (var model = _connectionPool.GetConnection().CreateModel())
     {
         return(GetMessageCount(model));
     }
 }
예제 #2
0
        public void Publish <T>(string exchangeName, string routingKey, T content)
        {
            var serializedContent = _serializer.Serialize(content);

            using (var model = _connectionPool.GetConnection().CreateModel())
            {
                var props = model.CreateBasicProperties();
                props.DeliveryMode = 2;
                var payload = Encoding.UTF8.GetBytes(serializedContent);
                model.BasicPublish(exchangeName, routingKey, props, payload);
            }
        }