adds IMessageFactory to handle creation of messages.