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.

Much of the work in Java 8 is similar to the work in RxJava. From the Apache Camel website: “You can think of RX as providing an API similar to Java 8/Groovy/Scala collections (methods like filter, foreach, map, reduce, zip, etc.), but which operates on an asynchronous stream of events rather than a collection. So you could think of RX as like working with asynchronous push-based collections (rather than the traditional synchronous pull-based collections).

“In RX, you work with an Observable<T>, which behaves quite like a Collection<T> in Java 8 so you can filter/map/concat and so forth. The Observable<T> then acts as a type-safe composable API for working with asynchronous events in a collection-like way.

“Once you have an Observable<T> you can then filter events, transform events, combine event streams, and use other utility methods.”

In fact, Push Technology is moving to a model under which Diffusion is deployed as services via the company’s client, rather than from a Java EE server, to be able to leverage the benefits of cloud environments.

Solid technologies all, which make in-event gambling and stock trading less of a crap shoot.