abstract out dispatcher from gateway
check whether a message is valid in each message handler