Building a Personalized Communication Platform using Open Standards

Created by Nick Van den Bleeken / @nvdbleek / Inventive Designers

Agenda

  • What is a Personalized Communication Platform?
  • Which standards are used in the platform?
    • What is its purpose in the platform?
    • What extensions were required?
    • What were the challenges?
    • Which implementation is used?
  • Conclusion

What is a Personalized Communication Platform?

Create unique and engaging communications

Document icon iPad icon iMac icon Twitter icon

Print

Printed document

E-mail

Email

SMS

SMS

Twitter

Twitter

Labels

Labels

Have full overview of all communications

  • What is sent when?
  • Is it delivered/opened?
  • Did the addressee interact with it and how?
Presentation icon

All types of communications

  • High-volume batch
  • On-demand
  • Interactive
Group icon Presonal icon Form icon

Which standards are used in the platform?

Overview

  • XML
  • SCXML
  • XQuery and XQuery update facility
  • XSLT
  • XSL-FO
  • XForms

XML

  • All data is XML
  • Easily transformed, merged and enriched
  • Pushed in the platform (folder drop, SOAP/REST endpoint)
  • Pulled by the platform (XQuery, SOAP/REST call)
XML icon

SCXML

SCXML diagram

SCXML code


<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:my="http://scxml.example.com/"
       version="1.0" initial="select-channel">
  <datamodel>
    <data id="communication.preference" expr="email" />
    <data id="email.address" />
  </datamodel>

  <state id="select-channel">
    <onentry>
      <if cond="${communication.preference eq 'email' && not empty email.address}">
        <transition target="email" />
        <else>
          <transition target="print" />
        </else>
      </if>
    </onentry>
  </state>

  <state id="email" initial="mail">
    <datamodel>
      <data id="email.retrycount" expr="${-1}" />
    </datamodel>
    <state id="mail">
      <onentry>
        <my:channel type="mail" />
      </onentry>
      <transition event="channel.mail.success" target="sent" />
      <transition event="channel.mail.error" target="print" />
    </state>
    <state id="sent">
      <onentry>
        <assign id="email.retrycount" expr="${email.retrycount + 1}" />
        <send id="mailed-timer" event="'schedule.timeout.response-timer'"
          delay="'2d'" />
      </onentry>
      <transition event="email.read" target="email-read" />
      <transition event="email.hardbounce" target="print" />
      <transition event="email.softbounce" target="soft-bounce" cond="${email.retrycount lte 3}" />
      <transition event="email.softbounce" target="print" cond="${email.retrycount gt 3}" />
      <transition event="schedule.timeout.response-timer"
        target="print" />
      <onexit>
        <cancel sendid="mailed-timer" />
      </onexit>
    </state>
    <state id="soft-bounce">
      <onentry>
        <send id="retry-timer" event="'email.retry'" delay="'12h'" />
      </onentry>
      <transition event="retry-timer" target="mail" />
      <onexit>
        <cancel sendid="retry-timer" />
      </onexit>
    </state>
    <final id="email.read" />

    <transition event="error" target="print" />
    <transition event="done.state.email" target="exit" />
  </state>

  <state id="print">
    <onentry>
      <my:channel type="print" />
    </onentry>
    <transition target="exit" />
  </state>
  
  <final id="exit" />
</scxml>						
						

SCXML extensions

  • Custom action: 'Send Communication'
    • Specify channel (print, e-mail, SMS, ...)
    • Delivery intervals
    • Expiration date
    • Sends back status information as events
Jigsaw icon

SCXML challenges

  • State machines stay alive for weeks
  • Implemented highly available event dispatcher:
    • Clustering of multiple servers
    • Automatic load balancing
Gym icon

SCXML implementation

  • Apache commons SCXML
  • Modifications:
    • Custom action: 'Send Communication'
    • Highly available event dispatcher
Feather icon

XQuery and XQuery update facility

  • Retrieve personalization data
  • Retrieve data for management UI
  • Store runtime information about communication
Search icon

XQuery sample queries


declare variable $sub-job-id as xs:string external;
declare variable $client-number as xs:string external;
declare variable $unit-status as xs:string external;
for $unit in /job/subJobs[@id = $sub-job-id]/unit
    [(contains(lower-case(@client-number), lower-case($client-number))
      and ($unit-status = 'all' or @status = $unit-status)]
order by $unit/@creation-date descending
return  element unit {$unit/@* }
						

XQuery extensions

  • None
Jigsaw icon

XQuery challenges

  • Customers prefer to store data in relational DB
  • Work around database quirks (eg: empty string Oracle)
  • One relational query for performance
  • Ongoing effort to support more of the XQuery spec
  • XQuery knowledge is not common
Gym icon

XQuery implementation

  • Wrote our own with pluggable data store
    • Relational database as back-end
    • Currently a subset of the XQuery spec
Inventive Designers logo

XSLT

  • Transform, merge and enrich personalization data
  • Conditional structural formatting of content
Shuffle icon

Designer

XSL Designers screenshot

XSLT extensions

  • Custom function libraries (abstract complex expressions and business logic)
  • Call other XSLT+XSL-FO stylesheets dynamically
Jigsaw icon

XSLT challenges

  • Memory consumption
    • Streaming mode will make life easier
    • Support streaming mode WYSIWYG XSL editor is challenging
Gym icon

XSLT implementation

  • Saxon PE
Michael Kay

XSL-FO

  • Markup language for XML document formatting
    • Citations and Cross-references
    • Headers/footers
    • Keep together, keep with next, keep with previous
    • Orphans and widows
    • Running totals
  • Powerful conditional formatting in combination with XSLT
  • 18 different output formats (PDF, PS, AFP, HTML5,...)
Document icon iPad icon iMac icon

Example document

One document displayd in different delivery channels

XSL-FO extensions

  • Mix-in SVG, XForms and Open Office Charts
  • Meta data (PDF annotations and TLE's in AFP)
  • Finishing features (Duplex printing, input and output trays)
  • Output specific features (AFP overlays)
  • BarcodeML
  • 'Page data'
Jigsaw icon

XSL-FO challenges

  • Performance, memory and quality requirements
    • Small on-demand and large batch
    • Nested tables which span hundreds of pages
  • Repeated markup (XSLT/XSL-FO formatting is separate)
    • Remove superfluous XSL-FO attributes
    • Optionally: Attribute group references
Gym icon

XSL-FO implementation

  • We created our own implementation
Inventive Designers logo

XForms

  • Interactive documents and management UI
  • Cross device (desktop and mobile)
  • host language independent (XSL-FO and HTML)
  • Model-view-controller
Form icon

XForms extensions

  • A lot which are standardized in XForms 2.0
  • Custom components based on XBL
Jigsaw icon

XForms challenges

  • A lot of different web browsers with their own quirks
Gym icon

XForms implementation

  • Chiba
  • Orbeon
    • Custom component support
    • Clever performance optimizations
Chiba logo Orbeon logo

Conclusion

  • The open standards and W3C membership ensured
    • Future proof
    • Easy to integrate with/in
    • A lot of good documentation available
    • Re-use of off-the-shelf components
    • Prevent vendor lock-in
  • Platforms is used today by enterprises worldwide
Brightness icon

Q&A

Question mark icon