Class MarketData

java.lang.Object
com.bank.trading.data.MarketData
All Implemented Interfaces:
Runnable

public class MarketData extends Object implements Runnable
This service takes market data from bloomberg and streams to lamport service. This service is run as a cluster with one active leader, the others on standby in case of failure.
  • Constructor Details

    • MarketData

      public MarketData(InetSocketAddress address, URI bloombergURI, InetSocketAddress LamportAddress, List<InetSocketAddress> peers)
      Constructor to initialize the market data service.
      Parameters:
      address - the address of this service.
      bloombergURI - the URI of the bloomberg service.
      LamportAddress - the address of the lamport service.
  • Method Details

    • run

      public void run()
      This method is responsible for streaming data from bloomberg to lamport service.
      Specified by:
      run in interface Runnable
    • changeLamportAddress

      public void changeLamportAddress(InetSocketAddress address)
      Change the lamport address to a new one. This is called when the lamport leader changes.
      Parameters:
      address - the new lamport address.
    • addMarketData

      public void addMarketData(String marketData)
      Add market data to the system.
      Parameters:
      marketData - the market data to be added.
    • sendMarketData

      public void sendMarketData(Event marketData)
      Send market data to the lamport service. This will be called to send the latest market data.
      Parameters:
      marketData - the market data event to be sent.