ClothesHorse/NSQnet — pull request #4 by politician (2014-06-13 02:14:09+00:00)
Title: Adds support for publishing to the HTTP endpoint of an nsqd instance

This patch contains a new utility class `NSQUtil` which contains a couple of simple methods to publish messages to the HTTP endpoint of an `nsqd` instance.

The example application `NSQnet.Apps.RandomService` uses this utility class to publish a series of random numbers to a topic while periodically logging statistics to the console. The log4net dependency is only used by this example application.

### Example ###

#### `nsq_rand` Publisher Output ####
```
C:\> nsq_rand --nsqd-http-address="http://192.168.1.128:4151" --topic="random"
19:12:40,387 [10] INFO [(null)] - NSQD HTTP Address: http://192.168.1.128:4151
19:12:40,408 [10] INFO [(null)] - Topic: random
19:12:40,409 [10] INFO [(null)] - Interval (s): 3000
19:12:40,409 [10] INFO [(null)] - Count: continuous
19:12:52,532 [17] INFO [(null)] - 5 random numbers generated (+5)
19:13:04,540 [16] INFO [(null)] - 9 random numbers generated (+4)
19:13:16,545 [17] INFO [(null)] - 13 random numbers generated (+4)
```

#### `nsq_tail` Consumer Output ####
```
...
{"value": 1924963899, "timestamp": "2014-06-12T19:01:50.0108676-07:00"}
{"value": 1026509570, "timestamp": "2014-06-12T19:01:53.0125674-07:00"}
2014/06/12 19:01:55 LOOKUPD: querying http://192.168.1.128:4161/lookup?topic=random
2014/06/12 19:01:55 [192.168.1.128:4150/random/tail026993#ephemeral] heartbeat received
{"value": 1536765567, "timestamp": "2014-06-12T19:01:56.0162670-07:00"}
{"value": 1547454710, "timestamp": "2014-06-12T19:01:59.0169669-07:00"}
{"value": 1157473762, "timestamp": "2014-06-12T19:02:02.0196666-07:00"}
...
```