ScheduledTask.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:AngularAndSpring 作者:
@Scheduled(fixedRate = 60000,initialDelay=33000)
    public void insertBitstampQuoteXRPUSD() throws InterruptedException {
        Date start = new Date();
        WebClient wc = buildWebClient(URLBS);
        try {
            operations.insert(wc.get().uri("/v2/ticker/xrpusd/").accept(MediaType.APPLICATION_JSON).exchange()
                    .flatMap(response -> response.bodyToMono(QuoteBs.class)).map(res -> {res.setPair("xrpusd"); log.info(res.toString()); return res;})).then().block(Duration.ofSeconds(3));
            log.info("BitstampQuote Xrp Usd " + dateFormat.format(new Date()) + " " + (new Date().getTime()-start.getTime()) + "ms");
        } catch (Exception e) {
//          log.error("Bitstamp insert error", e);
            log.error("Bitstamp Xrp insert error Usd "+ dateFormat.format(new Date()));
        }
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号