0

我有以下代码:

 @Bean
    @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
    public MessageSource<String> timerMessageSource() {
        logger.info("Sending Message");
        return () -> new GenericMessage<>(new SimpleDateFormat().format(new Date()));
    }

我希望禁用轮询器,以便我可以发送一条消息。我怎么做?

4

2 回答 2

0

那不会使这个应用程序成为一个stream:-) 您可能只是编写一个发送单个消息的任务。

于 2016-05-09T14:35:51.200 回答
-1

代码:

 public interface MessageChannels {

   @Output("activationMsgQueue")
    MessageChannel save();
 }

代码:

@Service
@EnableBinding(MessageChannels.class)
public class CloudStreamProducer implements MessageSender {

    private static final Logger LOGGER = LoggerFactory
        .getLogger(CloudStreamProducer.class);

    @Autowired
    MessageChannels msgChannel;

    public void sendMessage(ActivationDataInfo msg) {
        msgChannel.save().send(MessageBuilder.withPayload(msg).build());
        LOGGER.info("Sent Activation Message to apt Topic : Acct NO = " + msg.getAcctNo()
            + " TN = " + msg.getTn() + " FlowType = " + msg.getFlowType());
    }

}
于 2016-06-14T19:56:13.570 回答