예제 #1
0
 private void registerChannels(Map<String, MessageChannel> channels, String group, int index) {
   for (Map.Entry<String, MessageChannel> entry : channels.entrySet()) {
     if ("input".equals(entry.getKey())) {
       Assert.isTrue(
           index > 0, "a module with an input channel must have an index greater than 0");
       String channelNameInRegistry = group + "." + (index - 1);
       channelRegistry.inbound(channelNameInRegistry, entry.getValue());
     } else if ("output".equals(entry.getKey())) {
       String channelNameInRegistry = group + "." + index;
       channelRegistry.outbound(channelNameInRegistry, entry.getValue());
     }
   }
 }
예제 #2
0
 /* (non-Javadoc)
  * @see org.springframework.xd.module.Plugin#processModule(org.springframework.xd.module.Module)
  */
 @Override
 public void processModule(Module module, String group, int index) {
   // TODO: Check if module started?
   Assert.notNull(module, "module cannot be null");
   Assert.isAssignable(IntegrationModule.class, module.getClass());
   String resourcePath = this.integrationModuleBasePath + "/" + module.getName() + ".xml";
   module.addComponents(new ClassPathResource(resourcePath));
   IntegrationModule integrationModule = (IntegrationModule) module;
   integrationModule.initializeModule();
   channelRegistry.inbound(
       integrationModule.getName() + ".input", integrationModule.getInputChannel());
   for (Entry<String, SubscribableChannel> entry :
       integrationModule.getOutputChannels().entrySet()) {
     channelRegistry.outbound(
         integrationModule.getName() + "." + entry.getKey(), entry.getValue());
   }
 }