It depends on the inbound endpoint. If it's a polled endpoint (or message-driven adapters that support the <transactional/> element - such as the imap idle mail adapter), you can use a 'PseudoTransactionManager', with 'onCommit' 'onRollback' expressions that can invoke a @bean to do the clean up.
For other message-driven adapters, you can put an interceptor on the first channel, and do the clean up in the post-Send - this can do the clean up for "good" results; for exceptions, you'd use an error-channel and do the clean up there.
You can also use this technique for polled adapters (put the error-channel on the poller).
Gary P. Russell
Spring Integration Team
SpringSource, a division of VMware