<commit_before>var workerOptions = {
    nsquishyOptions: {
        channel: 'example-worker'
    },
    writer: true,
    match: function (msg, msgBody) {
        if (msgBody.source === 'eventlog-trace') {
            return true;
        }
        return false;
    },
    job: function (msg, msgBody, callback) {
        var Message = require('nsquishy-message');
        var message = new Message({
            source: 'example-worker',
            payload: 'cowabunga'
        });
        this.nsqWriter.publish('events', JSON.stringify(message));
        return callback(null, 'complete');
    },
    finish: function (data, msg, msgBody, next) {
        console.log('job status: %s', data);
        return next();
    }
};
var NsquishyWorker = require('nsquishy-worker');
var worker = new NsquishyWorker(workerOptions);
worker.start();<commit_msg>make example make sense<commit_after>var NsquishyWorker = require('nsquishy-worker');

var workerOptions = {
    nsquishyOptions: {
        channel: 'talky-trace-pg-worker'
    },
    writer: true,
    match: function (msg, msgBody) {
        if (msgBody.source === 'eventlog-trace') {
            return true;
        }
        return false;
    },
    job: function (msg, msgBody, callback) {
        // Do some stuff
        // ...
        var status = 'complete';
        return callback(null, status);
    },
    finish: function (data, msg, msgBody, next) {
        var Message = require('nsquishy-message');
        if (data === 'complete') {
            var message = new Message({
                source: 'example-worker',
                payload: data
            });
            this.nsqWriter.publish('events', JSON.stringify(message));
            return next();
        }

        var message = new Message({
            source: 'example-worker',
            payload: 'there was a problem'
        });
        this.nsqWriter.publish('events', JSON.stringify(message));
        return next();

    }
};
var NsquishyWorker = require('nsquishy-worker');
var worker = new NsquishyWorker(workerOptions);
worker.start();
{'fraction_non_alphanumeric': 0.1344860710854947, 'fraction_numerical': 0.0, 'mean_word_length': 2.151285930408472, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6911799', 'n_tokens_mistral': 598, 'n_tokens_neox': 589, 'n_words': 143}