logger = require 'torch'
postal = require 'postal'

postal.subscribe {
  channel: 'module.run/stop'
  topic: 'request.#'
  callback: (message, envelope) ->
    logger {message, envelope}
}

#postal.publish {
  #channel: 'module.run/stop'
  #topic: 'request.1'
  #data: 'hello'
#}

postal.linkChannels(
  {channel: 'system.kill', topic: '#'}
  {channel: 'module.run/stop'}
)

postal.publish {
  channel: 'system.kill'
  topic: 'request.1'
  data: 'hello'
}
