Example #1
0
        public static async Task<string> PublishAsync(string nsqd_http_address, string topic, string message)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                throw new ArgumentException("a message cannot be null or blank", "message");
            }

            var uri = new Uri(nsqd_http_address);
            var baseUriString = uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
            var req = new NSQUtil(baseUriString);
            var res = await req.put(topic, message);
            return res;
        }
Example #2
0
        public static async Task<string> PublishAsync(string nsqd_http_address, string topic, IEnumerable<string> messages)
        {
            if (messages.Any() == false)
            {
                throw new ArgumentException("messages is empty", "messages");
            }

            var uri = new Uri(nsqd_http_address);
            var baseUriString = uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
            var req = new NSQUtil(baseUriString);
            var res = await req.mput(topic, messages);
            return res;
        }
Example #3
0
        public static async Task <string> PublishAsync(string nsqd_http_address, string topic, string message)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                throw new ArgumentException("a message cannot be null or blank", "message");
            }

            var uri           = new Uri(nsqd_http_address);
            var baseUriString = uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
            var req           = new NSQUtil(baseUriString);
            var res           = await req.put(topic, message);

            return(res);
        }
Example #4
0
        public static async Task <string> PublishAsync(string nsqd_http_address, string topic, IEnumerable <string> messages)
        {
            if (messages.Any() == false)
            {
                throw new ArgumentException("messages is empty", "messages");
            }

            var uri           = new Uri(nsqd_http_address);
            var baseUriString = uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
            var req           = new NSQUtil(baseUriString);
            var res           = await req.mput(topic, messages);

            return(res);
        }