我有以下代码:
@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()));
}
我希望禁用轮询器,以便我可以发送一条消息。我该怎么做?
答案 0 :(得分:0)
这不会使这个应用程序成为stream
:-)你可能只写一个发送单个消息的task。
答案 1 :(得分:-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());
}
}