Clone this wiki locally
vFabric’s Reference Application, SpringTrader (previously named Nanotrader), provides customers with an end-to-end solution for developing, provisioning, and managing a distributed application in a cloud environment. The reference application and architecture provide customers and partners with a blueprint for development, infrastructure, and operations teams.
The SpringTrader application is based on the web based Trading application, Day Trader. The legacy Day Trader application provides context for application modernization by representing the “before” picture while SpringTrader provides developers with a blueprint for achieving the “after” picture. Functionally, both applications allow users to login, view their portfolio, lookup stock quotes, and buy or sell stock shares. However, this is where their similarity ends. The following table describes key high-level differences in the application design:
High Level Architecture Overview
B. Application Services – Application functionality is exposed through lightweight, REST style services that expose JSON. The Application Services interact with the Data Tier to retrieve information on behalf of the client. For long running processes (such as buying and selling stocks), these services place a message onto the Message Broker for asynchronous processing.
C. Message Broker – The Message Broker is used for asynchronous processing and for inter-JVM processing between the Application Services and Integration Services. The Message Broker also decouples these services, allowing the Integration Services to be taken offline for maintenance while the Nanotrader application remains online.
D. Integration Services – The Integration Services are responsible for processing long running business transactions. These services listen for messages that arrive at the Messaging Broker and perform the required integration. In the case of Nanotrader, buy/sell operations perform the following multi-step process: orders are created, account balance updated, holdings updated, and stock volatility simulated.
E. Data Tier – By default, SpringTrader leverages an in-memory, SQL based database, which is built on a “shared nothing” architecture eliminating disk I/O which plagues traditional databases. SpringTrader can also run with PostgreSQL.
SpringTrader Development Architecture: Spring and vFabric
SpringTrader leverages “state of the art” client side technologies such as HTML 5, CSS 3, JQuery, Backbone, and Bootstrap. Static resources are served from vFabric Web Server (for local development these static resources can be deployed to tcServer).
The Application Services leverage the enterprise proven Spring Framework to expose REST style services to the browser. Spring Data JPA provides simplified access to SQLFire, Spring Integration provides code free connectivity with RabbitMQ, and Spring GEMFire combined with Spring’s Cache Abstraction provides declarative, application tier caching. Specifically, the Application Services embed a peer-to-peer GEMFire Cache in the deployment unit to allow caching of authorization tokens for the REST API. Spring Security is used to protect the services from unauthorized access.
RabbitMQ provides the inter JVM connectivity between the Application Services and Integration Services.
The Integration Services primarily leverage Spring Integration to receive messages from RabbitMQ. The framework also choreographs multi-step transaction with SQLFire.
SQLFire provides a low latency, highly scalable in-memory database. SpringTrader leverages SQLFire’s advanced partitioning capabilities to achieve web scale and eliminate the database as the performance bottleneck. Of course, other data services (e.g. vFabric Postgres or legacy RDBMS) could be used within the architecture.