StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();
// use an external template so we can share his cache
RetryTemplate retryTemplate = new RetryTemplate();
RetryContextCache cache = new MapRetryContextCache();
retryTemplate.setRetryContextCache(cache);
fb.setRetryOperations(retryTemplate);
// give him a reference to the retry cache so he can clean it up
MissingMessageIdAdvice missingIdAdvice = new MissingMessageIdAdvice(cache);