router will route the message based on the message type.