handle replica commands and responses