We’re smarter together. Learn from this collection of community knowledge and add your expertise.

RTDM / ESP Integration: the Basics

by SAS Employee StephenFoerster on ‎05-24-2017 01:21 PM (755 Views)

There's a lot of interest in integrating SAS Real Time Decision Manager with SAS Event Stream Processing. So, let's shed some light on this subject. First, let's give a quick and dirty explanation of each product and what it does. (Please remember that I said "quick and dirty" so don't get offended if I over-simplify things)


  • RTDM creates targeted real time marketing campaigns triggered by web service calls.

  • ESP performs value-added transformation of real time event streams.

If you understood that, skip past the numbered list. If you're a little unsure about event streams, web services, value-added transformation, and targeted real time marketing campaigns, let's dig in a little more.


    1. First, what's an event stream? Well, its something like a message queue. In Fact, SAS ESP likes to read from and write to message queues. For a visual example, imagine one of those 1890's stock ticker machines spitting out stock prices. An event stream is feeding that machine. (Wall Street has been streaming events for a while now.)

    2. Next, what's a web service? A web service is a function that can be called anywhere by anything. If you're a SAS programmer, think of it as a SAS Macro that can be called by referencing a URL (~a machine name), a TCP/IP port, and the macro (function) name.

    3. Now, what's "value-added transformation?" This sounds like a throw-away buzz word and sometimes it is but the phrase actually has a meaning. For SAS ESP, it means that ESP transforms the incoming raw event streams (e.g. stock trades) into useful output event streams (e.g. "stocks you should buy" or "stocks you should sell").

    4. Finally, what's a targeted real time marketing campaign? Well, its an email, a text, a banner add, a phone call, etc. that you get because of something you did. Did you just put a JK Rowling book in your Amazon shopping cart? Then maybe you'll get a banner add for Cursed Child tickets. A great visual for real time marketing comes from Minority Report when Tom Cruise, walking through the subway, has his retinas scanned, and is shown personalized ads on nearby displays. 

OK, so we have SAS ESP that transforms event streams and RTDM that executes real time marketing when triggered by web services. How can we marry these two things? Well, I imagine there are lots of ways. People are creative. One great way, for sure, however, is to have ESP transform incoming customer-focused event streams into output web-services that trigger RTDM real time marketing. Let's look at an example: Imagine that a company (say Netflix) is going to raise its subscription price and they expect some of their customers to cancel their subscription because of it. They figure that cancellations will follow a certain pattern:

  1. The customer opens the email announcing the rate increase
  2. The customer opens the company's website
  3. The customer clicks the "Account" button
  4. The customer clicks the "Manage Subscription" button
  5. The customer hits the "Cancel" button

The company could modify their system to send a web service to RTDM when the customer hits "Cancel" (step 5) but that is too late. The customer has already cancelled. Assuming that we can capture all of the events described (Big Brother, I know), SAS ESP could look for the first three events (Open email -> Open Web Site -> Click "Account") with its Pattern Window and trigger RTDM preemptively. Maybe RTDM could send them a coupon or a list of really great movies that are coming next month. Regardless, as the example shows, ESP extends the capabilities of RTDM so it doesn't just react to a single event but to a pattern of events across an event stream.


So what's interface between ESP and RTDM?  As I mentioned earlier, RTDM campaigns are triggered by web services. So the interface is literally a simple REST or SOAP call. ESP comes with a REST Adapter (a simple command line executable) that subscribes to ESP models and publishes the output event streams to target REST URLs. ESP also has a robust REST API that allows for simple URL-based output event subscription. See the doc for more information. 

Your turn
Sign In!

Want to write an article? Sign in with your profile.

Looking for the Ask the Expert series? Find it in its new home: communities.sas.com/askexpert.