簡體   English   中英

輸入通道訂戶未使用Spring Cloud數據流中的自定義接收器

[英]Input Channel subscriber not up for Custom Sink in Spring Cloud Data flow

我試圖將自己的定制的Spring Cloud數據流接收器部署到Cloud Foundry上。

我的依賴關系如下:

    <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);
        }
    }

部署此應用程序時,我看到的只是創建了錯誤通道訂戶,但沒有創建輸入訂戶。 因此,此應用程序上沒有收到任何消息。 該應用程序的源代碼是帶有rest控制器的自定義源代碼。 默認的開箱即用流媒體應用程序-LogSink成功運行。 但是我需要創建一個customink以在頂部構建事物。 有人看到我在這里缺少的問題嗎?

如果您的目標是創建一個全新的自定義接收器,則可以通過遵循Spring Initializr過程將其開發為獨立的應用程序。 這種方法很簡單,在這種情況下,您無需使用現有的log-sink啟動器。

如果您試圖修補任何OOTB應用程序,請執行以下操作: 在這種情況下,請執行log-sink 程序 ,然后按照修補程序進行操作 注意導入配置類。 除非您這樣做,否則相關的應用啟動器的行為將不會生效。

另外,似乎您正在使用舊版本的Rabbit-Binder。 最好依靠Spring Initializr生成的工件,而不是手工制作依賴版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM