title: Migrate Spring cloud stream application - Chelsea to Horsham
body: <p>I am trying to migrate a Spring Cloud Stream application Chelsea.SR1 to Horsham. This project does not have binder but uses spring messaging and integration to integrate a custom source and sink.</p>
  
  <p>It looks like <code>AggregateApplicationBuilder</code> is not available anymore. How do I bind the source, transformer and sink without <code>AggregateApplicationBuilder</code> ? </p>
  
  <p>Or is there a better way to implement this in Horsham? The only constraint I have is, I need to use Pollable source/consumer.</p>
  
  <p>Thanks in advance!</p>
  
  <p>pom.xml</p>
  
  <pre><code>  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;artifactId&gt;example-info-processor&lt;/artifactId&gt;
    &lt;groupId&gt;com.example.streams&lt;/groupId&gt;
    &lt;version&gt;1.2-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.5.9.RELEASE&lt;/version&gt;
      &lt;relativePath /&gt;
    &lt;/parent&gt;
    &lt;properties&gt;
      &lt;spring-cloud.version&gt;Chelsea.SR1&lt;/spring-cloud.version&gt;
    &lt;/properties&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
        &lt;artifactId&gt;spring-cloud-stream&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-messaging&lt;/artifactId&gt;
        &lt;version&gt;4.3.17.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
        &lt;version&gt;4.3.15.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
        &lt;version&gt;4.3.20.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
        &lt;version&gt;4.3.24.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
        &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-stream-dependencies&lt;/artifactId&gt;
          &lt;version&gt;${spring-cloud.version}&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
          &lt;scope&gt;import&lt;/scope&gt;
        &lt;/dependency&gt;
      &lt;/dependencies&gt;
    &lt;/dependencyManagement&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Application</p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan(basePackages = {
          "com.example.streams",
  })
  public class ExampleInfoProcessorApplication extends SpringBootServletInitializer {
      public static void main(String[] args) {
          new AggregateApplicationBuilder(ExampleInfoProcessor.class, args)
                  .from(ExampleInfoConsumer.class).via(ExampleInfoTransformer.class)
                  .to(ExampleInfoSink.class).run(args);
      }
  }
  </code></pre>
  
  <p>Source</p>
  
  <pre><code>@EnableBinding(Source.class)
  public class ExampleInfoConsumer {
      @Autowired
      private MyConsumer customConsumer;
  
      @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "30"))
      public List&lt;ExampleRecord&gt; consume() {
        //Read the available chunk from the source location
              .....
          return exampleRecordsList;
      }
  }
  </code></pre>
  
  <p>Transformer</p>
  
  <pre><code>@EnableBinding(Processor.class)
  public class ExampleInfoTransformer {
  
      @Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT)
      public Map&lt;String, List&lt;ExampleInfo&gt;&gt; transform(List&lt;ExampleRecord&gt; exampleRecords) {
          //transform the consumer records, store the list of ExampleInfo objects in a map using ExampleInfo key
          return map;
      }
  }
  </code></pre>
  
  <p>Sink</p>
  
  <pre><code>@EnableBinding(Sink.class)
  public class ExampleInfoSink {
  
      @ServiceActivator(inputChannel = Sink.INPUT)
      public void sink(Map&lt;String, List&lt;ExampleInfo&gt;&gt;  exampleInfoMap) {
          //Read from map and write to destination.
      }
  }
  </code></pre>