implements factory pattern for message queues