Shutting down the channel adapter is not too complicated as you can call stop() on it.
However, I'm not sure if the channel adapter can know by itself if there are still messages to process.
If I were you, I would implement another little process which contains the "intelligence" of whether to stop or not the channel adapter. This could be for example a wiretap which decides, in case no message was received for 60 seconds, to shutdown the channel adapter.
There may be better ways to do this.
Hope this helps,