make graceful shutdown possible

it is necessary that messages that are currently processed are not lost on a graceful shutdown (currently they are lost with my amqp setup)