     @mongooseConnection.once 'open', ->
       winston.info "Successfully connected to MongoDB queue!"
 
+  generateMessageModel: ->
+    #do find something like: messages not processing, queue as current queue, visibility time before now, sort by insertion time, findOne
+    schema = new mongoose.Schema
+      messageBody : Object,
+      processing: false,
+      insertionTime: {type: Date, default: Date.now }
+      queue: String
+      scheduledVisibilityTime: Date
+    @mongooseConnection.model 'Message',schema
 
 
 class MongoQueue extends events.EventEmitter
-  constructor: (@queueName, options, mubSubClient) ->
-    @channel = mubSubClient.channel queueName, options
-    @subscribe 'message', receieveMessage
+  constructor: (@queueName, options, @Message) ->
+
   subscribe: (eventName, callback) ->
     @channel.subscribe eventName, callback
 

        throw new Error("Fatal SQS error, see Winston output")
      newQueue = new SQSQueue(queueName, data.QueueUrl, @sqs)
      callback err, newQueue

  generateSQSInstance: ->
    new aws.SQS()
