0

I was trying to deploy my own custom sink of spring cloud data flow onto cloud foundry.

My Dependency are below :

    <dependencies>
    <dependency>
            <groupId>org.springframework.cloud.stream.app</groupId>
            <artifactId>spring-cloud-starter-stream-sink-log</artifactId>
        </dependency>       
           <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>         
           </dependency>        
            <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
            <version>1.2.0.RC1</version>        
           </dependency>    
   </dependencies>
    <dependencyManagement>      
        <dependencies>          
          <dependency>
                <groupId>org.springframework.cloud.stream.app</groupId>
                <artifactId>app-starters-core-dependencies</artifactId>
                <version>1.2.0.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>           
           </dependency>            
           <dependency>
                <groupId>org.springframework.cloud.stream.app</groupId>
                <artifactId>log-app-dependencies</artifactId>
                <version>1.2.0.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>           
             </dependency>      
          </dependencies>   
    </dependencyManagement>


And the custom code is very basic as below :

    @EnableBinding(Sink.class)
    public class SinkConfiguration {
        private static final Log logger = LogFactory.getLog(SinkConfiguration.class);

        @ServiceActivator(inputChannel=Sink.INPUT)
        public void loggerSink(String payload) {
            logger.info("Hello, Rahul. The time is: " + payload);
        }
    }

All I see when i deploy this application is that the Error channel subscriber is created , but no Input subscriber was created. Due to this no messages are being received on to this app. Source for this app is a custom source with rest controller. The default out of box streamer app -- LogSink works successfully. But i need to create a customsink to build things on top. Do anyone see an issue what I am missing here?

rahul
  • 71
  • 1
  • 1
  • 7

1 Answers1

1

If your goal is to create an entirely new custom sink, you would develop that as a standalone application by following the Spring Initializr procedure. It is simple this way and you don't need to use the existing log-sink starter in this case.

If you are trying to patch any of the OOTB application; in this case, the log-sink, then follow the patching procedure. Pay attention to importing the configuration class. Unless you do that, the associated app-starter's behavior won't kick in.

Also, it seems you're using an old release for rabbit-binder. It is better to rely on the Spring Initializr generated artifact as opposed to handcrafting dependency versions.

Sabby Anandan
  • 5,636
  • 2
  • 12
  • 21
  • I was able to finally follow the patching procedure. Made sure the configuration class is imported. Now it gives me the below error during startup. "Circular reference involving containing bean 'org.springframework.cloud.stream.app.log.sink.LogSinkConfiguration'. nested exception is java.lang.NoSuchMethodError: org.springframework.integration.handler.LoggingHandler.setExpression(Ljava/lang/String;). – rahul Jun 14 '17 at 16:07
  • Can you share the project? It might be easy to review it in GitHub or equivalent. – Sabby Anandan Jun 16 '17 at 21:09
  • Hello, Issue resolved after downgrading spring boot starter parent from : 2.0.0.M2 To : 1.5.3.RELEASE . I am any to successfully create an input subscriber by the importing the configuration class as you pointed out ! thanks a ton. – rahul Jun 19 '17 at 20:33