Backport Session consume() to 2.x