Refactor to use factory for redis and kue.

Redis connection errors kill processes when they are not handled. Using
a factory ensures that the correct handlers are added for connections.