     durable     : true
 
   connect: ()->
-    {host, port, protocol, login, password, vhost, heartbeat} = @amqpOptions
+    {host, port, protocol, login, password, vhost, heartbeat, autoReconnect} = @amqpOptions
     port              ?= 5672
     protocol          ?= 'amqp:'
     options           = {host, port, protocol} # but not vhost, because of a bug in node-amqp

    options.password  = password  if password?
    options.vhost     = vhost     if vhost?
    options.heartbeat = heartbeat if heartbeat?
    @connection       = amqp.createConnection options
    @connection.on "ready", =>
      @connection.exchange "workerExchange", @getWorkerExchangeOptions(), (exchange) =>
        @connection.queue "#{@worker.name}-#{@worker.hostname}-#{@worker.uuid}",

{exec}          = require "child_process"

class Worker extends EventEmitter

  @throwIt = (it) ->
    console.error it  if it?
    process.kill process.pid, 'SIGTERM'

  constructor:(options = {},data)->
    options.name       or= "worker"
