reference code for xqueue client