Package org.springframework.amqp.rabbit.stocks.domain

Examples of org.springframework.amqp.rabbit.stocks.domain.Quote


  public void handleQuote(Quote message) {
    logger.info("Client received: " + message);
    long timestamp = System.currentTimeMillis() - timeout;
    for (Iterator<Quote> iterator = quotes.iterator(); iterator.hasNext();) {
      Quote quote = iterator.next();
      if (quote.getTimestamp() < timestamp) {
        iterator.remove();
      }
    }
    quotes.add(message);
  }
View Full Code Here


    this.stocks.add(new MockStock("TM", StockExchange.nyse, 76));
  }


  public void sendMarketData() {
    Quote quote = generateFakeQuote();
    Stock stock = quote.getStock();
    logger.info("Sending Market Data for " + stock.getTicker());
    String routingKey = "app.stock.quotes."+ stock.getStockExchange() + "." + stock.getTicker();
    getRabbitTemplate().convertAndSend(routingKey, quote);
  }
View Full Code Here

  }

  private Quote generateFakeQuote() {
    MockStock stock = this.stocks.get(random.nextInt(this.stocks.size()));
    String price = stock.randomPrice()
    return new Quote(stock, price);
  }
View Full Code Here

TOP

Related Classes of org.springframework.amqp.rabbit.stocks.domain.Quote

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.