Port from 4.x of batching queue listener

Impact builds and runs fine with this version.