code: private void purgeChannel(MessageChannel channel) {
          if (channel instanceof QueueChannel) {
              List<Message<?>> messages = ((QueueChannel)channel).purge(messageSelector);
              
              if (log.isDebugEnabled()) {
                  log.debug("Purged channel " + ((QueueChannel)channel).getComponentName() + " - removed " + messages.size() + " messages");
              }
          }
      }
docs: Purges all messages from a message channel. Prerequisite is that channel is
  of type {@link QueueChannel}.
  
  @param channel