function taskA() {

 switch $MESSAGE[:taskA].shift() {
  case :メッセージ1 then function1()
  case :メッセージ2 then function2()
  case :メッセージ3 then function3()
  else default()
 }
}