private void unbindTapChannel(String tapChannelName) {
// Should this be unbindProducer() as there won't be multiple producers on the tap channel.
MessageChannel tappedChannel = tappableChannels.remove(tapChannelName);
if (tappedChannel instanceof ChannelInterceptorAware) {
ChannelInterceptorAware interceptorAware = ((ChannelInterceptorAware) tappedChannel);
List<ChannelInterceptor> interceptors = new ArrayList<ChannelInterceptor>();
for (ChannelInterceptor interceptor : interceptorAware.getChannelInterceptors()) {
if (interceptor instanceof WireTap) {
((WireTap) interceptor).stop();
}
else {
interceptors.add(interceptor);
}
}
interceptorAware.setInterceptors(interceptors);
messageBus.unbindProducers(tapChannelName);
}
}