package com.didispace; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.stream.annotation.EnableBinding; import org.springframework.cloud.stream.annotation.Output; import org.springframework.cloud.stream.messaging.Sink; import org.springframework.context.annotation.Bean; import org.springframework.integration.annotation.InboundChannelAdapter; import org.springframework.integration.annotation.Poller; import org.springframework.integration.core.MessageSource; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.support.GenericMessage; /** * 快速入门 * * @author 翟永超 * @create 2016/11/8. * @blog http://blog.didispace.com */ //@EnableBinding(value = {SinkSender2.SinkOutput.class}) public class SinkSender2 { private static Logger logger = LoggerFactory.getLogger(HelloApplication.class); @Bean @InboundChannelAdapter(value = Sink.INPUT, poller = @Poller(fixedDelay = "2000")) public MessageSource<String> timerMessageSource() { return () -> new GenericMessage<>("{\"name\":\"didi\", \"age\":30}"); } public interface SinkOutput { String OUTPUT = "input"; @Output(SinkOutput.OUTPUT) MessageChannel output(); } }