static void prepareSharedChannelRegistry(
     SharedChannelRegistry sharedChannelRegistry,
     LinkedHashMap<Class<?>, String> appsWithNamespace) {
   int i = 0;
   SubscribableChannel sharedChannel = null;
   for (Entry<Class<?>, String> appEntry : appsWithNamespace.entrySet()) {
     String namespace = appEntry.getValue();
     if (i > 0) {
       sharedChannelRegistry.register(namespace + "." + INPUT_CHANNEL_NAME, sharedChannel);
     }
     sharedChannel = new DirectChannel();
     if (i < appsWithNamespace.size() - 1) {
       sharedChannelRegistry.register(namespace + "." + OUTPUT_CHANNEL_NAME, sharedChannel);
     }
     i++;
   }
 }
 private MessageChannel locateSharedChannel(String name) {
   return sharedChannelRegistry != null
       ? sharedChannelRegistry.get(getNamespacePrefixedChannelName(name))
       : null;
 }