added to_nsq app

Addresses #304

  * Added tool and README
  * Updated Makefile

## Usage

Publish each line of a file:

```
cat source.txt | to_nsq -topic="topic" -nsqd-tcp-address="127.0.0.1:4150"
```

Publish manually entered lines in a shell:

```
to_nsq -topic="topic" -nsqd-tcp-address="127.0.0.1:4150"
one
two
three
(Ctrl+C to stop)
```

Publish comma separated values from a source file:

```
cat source.txt | to_nsq -delimiter="," -topic="topic" -nsqd-tcp-address="127.0.0.1:4150"
```

Publish three messages, in one go:

```
echo "one,two,three" | to_nsq -delimiter="," -topic="topic" -nsqd-tcp-address="127.0.0.1:4150"
```
Why don’t we get v1 done and add those features later?

I’ll remove the max in flight.

Mat



On Jul 22, 2014, at 5:29 PM, Jehiah Czebotar <notifications@github.com> wrote:

> In apps/to_nsq/main.go:
> 
> > +		fatal(false, fatalErr)
> > +	}
> > +
> > +}
> > +
> > +// readAndPublish reads to the delim from r and publishes the bytes
> > +// to the map of producers.
> > +func readAndPublish(r *bufio.Reader, delim byte, producers map[string]*nsq.Producer) error {
> > +
> > +	line, readErr := r.ReadBytes(delim)
> > +
> > +	if len(line) > 0 { // trim the delimiter
> > +		line = line[:len(line)-1]
> > +	}
> > +	if len(line) > 0 {
> > +		for _, producer := range producers {
> It would be great to mirror nsq_to_nsq options to roundrobin messages or send to each destination.
> 
> —
> Reply to this email directly or view it on GitHub.
>