In the U.K., in-play betting—the ability to wager on who the next football (soccer to us Americans) player to score a goal in a game will be, for example—is taking the online gambling establishment there by storm. The rise in popularity could not have occurred, though, without advances in technology. Specifically, real-time data distribution technology. Even more specifically, “reactive systems.”
“It’s vital that the odds are up to date. Information submission has to be done in a very timely way. As Michael Lewis says in his book on arbitrage (‘Flash Boys’), timely information is of the essence,” said Andy Piper, CTO of Push Technology, which has created a real-time data distribution platform used by U.K. bookmakers (and other types of financial services companies). Just don’t call it “middleware.”
“Most customers don’t want black boxes going from A to B,” he said, discussing traditional middleware that passes messages via a queue. “They want to know about the data inside the messages. If the stock price of Oracle goes up, down and up again, you want the current price. Don’t send the messages of up, down and up. If the network’s down, middleware queues it up on the server-side and blasts it when the network returns. But now that data is old.”
Push Technology’s platform, called Diffusion, weeds out the old data and only sends the current stock price when the connection returns. Customers, he pointed out, can record historical data if they want to in order to do analytics on the “up, down and up,” but that’s a choice and does not clog the flow of current information. In other words, the Diffusion platform does not send data that don’t need to be sent.
The online gaming systems, as well as other financial systems, tend to be event-driven. So is reactive programming. A stock price changes, or the odds on a bet change, and that information is pushed out—asynchronously—to clients who have signed up for the information. “Event-based and data streaming is on the lips of a lot of people today, especially developers,” Piper said. And that’s where reactive programming comes in.
The entertainment programming website Netflix is behind RxJava, the specification that takes an “iterator” (pull) model of data distribution and turns it into an asynchronous, stream-based model. Microsoft too has created “Observables” around data streams, Piper said.
On its blog, Netflix describes reactive programming as offering “efficient execution and composition by providing a collection of operators capable of filtering, selecting, transforming, combining and composing Observables. The Observable data type can be thought of as a ‘push’ equivalent to Iterable, which is ‘pull.’ With an Iterable, the consumer pulls values from the producer and the thread blocks until those values arrive. By contrast, with the Observable type, the producer pushes values to the consumer whenever values are available.”
Piper said the work being done around RxJava is happening outside of the Java Community Process. The JCP, he said, is more oriented toward single-server systems, while enterprises need the ability to scale to accommodate users. Lambdas, introduced in Java 8, “map well to reactive systems,” he said. “That’s what you need to support these APIs.” The Observable API allows developers to create observers that are notified when the state of the object they are observing changes, such as odds or stock prices.