add api to flush messages from queue