Convert publication to gen_fsm.