More Related Content Similar to Push-Enabling RESTful Business Processes (20) More from Cesare Pautasso (20) Push-Enabling RESTful Business Processes2. RESTful Business Processes
Cesare Pautasso Erik Wilde
Faculty of Informatics, EMC
University of Lugano, Switzerland
dret@dret.net
c.pautasso@ieee.org
http://dret.net
http://www.pautasso.info
@dret
@pautasso
6.12.2011
3. Abstract
Representational State Transfer (REST) as an architectural
style for service design has seen substantial uptake in the
past years. However, some areas such as Business
Process Modeling (BPM) and push services so far have
not been addressed in the context of REST principles.
In this work, we look at how both BPM and push can be
combined so that business processes can be modeled
and observed in a RESTful way. Based on this approach,
clients can subscribe to be notied when certain states in a
business process are reached. Our goal is to design an
architecture that brings REST's claims of loose coupling
and good scalability to the area of BPM, and still allow
process-driven composition and interaction between
resources to be modeled.
©2011 - Cesare Pautasso 3
4. BPM REST
©2011 - Cesare Pautasso 4
5. Business
RESTful
Process
Web Services
Management
©2011 - Cesare Pautasso 5
9. WS-* Standards Stack
BPM Management
Interoperability
Metadata
Reliability
Transactions
Security
State
Messaging
©2009-2010 - Cesare Pautasso - 30.6.2010 9
10. BPM Management
Interoperability
Metadata
Reliability
Transactions
Security
State
Messaging
Can you do it
with REST?
©2011 - Cesare Pautasso 10
11. From REST-*
“ We believe there is huge potential to
marrying REST with workflow and BPM.
http://www.jboss.org/reststar/specifications/workflow.html
[…]
Combined with the architecture of the Web,
a workflow service can provide both a truly
simple, portable, and flexible way to build
workflow driven integrations and
”
applications.
©2011 - Cesare Pautasso 11
12. REST in one slide
Web Services expose their
data and functionality trough PUT
resources identified by URI
R
Uniform Interface constraint: GET
Clients interact with resources POST
through a fix set of verbs. DELETE
Example HTTP:
GET (read), POST (create), PUT (update), DELETE
Multiple representations for the same resource
Hyperlinks model resource relationships and valid
state transitions for dynamic protocol description
and discovery
©2011 - Cesare Pautasso 12
13. From REST-*
“ We believe there is huge potential to
marrying REST with workflow and BPM.
http://www.jboss.org/reststar/specifications/workflow.html
The HATEOAS (hypermedia and linking)
principal of REST is logically a dynamic state
machine and fits very well with how
workflow and BPM systems are designed.
Combined with the architecture of the Web,
a workflow service can provide both a truly
simple, portable, and flexible way to build
workflow driven integrations and
applications.
©2011 - Cesare Pautasso 13
14. Business Process Management
Workflow Workflow
Process Model Users/Clients Participants
Act 2 Act 4
Act 1 Act 5 Act 7
Act 3 Act 6
RESTful Workflow Management Engine
PUT
GET
R Adapters Bus
Applications Web
Services
POST
DELETE Databases
©2011 - Cesare Pautasso 14
15. BPM with REST
Process Model
Publishing
Act 2 Act 4 R Processes
Act 1 Act 5 Act 7
as Resources
Act 3 Act 6
RESTful Workflow Management Engine
RESTful
Service
R R R Composition
©2011 - Cesare Pautasso 15
16. BPM with REST
Publishing
BPEL for REST R Processes
BPMN for REST as Resources
RESTful Workflow Management Engine
RESTful
Service
R R R Composition
©2011 - Cesare Pautasso 16
17. BPM with REST
Publishing
We are here R Processes
as Resources
RESTful Workflow Management Engine
RESTful
Service
R R R Composition
©2011 - Cesare Pautasso 17
18. BPM REST
Processes Resources/URIs
Tasks Uniform
Control Flow Interface
Data Flow Representations
… Hypermedia
©2011 - Cesare Pautasso 18
19. Everything is a resource
/process/X /process/X/1
Process
Process
Instance
Task
Task
Instance
/task/Y
/task/Y/1
©2011 - Cesare Pautasso 19
20. Hypermedia
/process Process
Process
Instance
GET
/process/name Task
Task
Instance
GET
/process/name/instance
GET
/process/name/instance/taskname
Follow links to discover the processes
deployed as resources
©2011 - Cesare Pautasso 20
21. Representations
Web page
with form to start BPMN2.0 process
a new process source code
instance ContentType: ContentType:
text/html application/bpmn+xml
GET /process/name
ContentType: ContentType:
text/plain application/json
ContentType:
Basic textual Process
description image/svg+xml metadata
of the process in JSON
©2011 - Cesare Pautasso 21
22. Uniform Interface and Hypermedia
List the
GET /process deployed Get a form
processes describing how
GET /process/name to start the
process
Start a new
POST /process/name process
instance Check what
is the state
GET /process/name/instance of the
instance
DELETE /process/name/instance
Clean up
(once it is done)
©2011 - Cesare Pautasso 22
23. Starting or Running processes?
/process Should the client be kept
waiting for the process to run
until completion?
POST /process
200 OK Clients may want to block until
(Process the whole process has
Finished completed its execution
Reply) (or it decides to reply to them)
©2011 - Cesare Pautasso 23
24. Starting or Running processes?
/process The client starting a long
running process is redirected to
a location x representing the
POST /process newly started process instance
The process and the client run
202 Accepted asynchronously
Location: x
The client may retrieve the
current state of the process
GET /process/x instance at any time
200 OK
©2011 - Cesare Pautasso 24
25. Push vs. Pull Notification
/process Problem: how can the process
instance tell the client that it
has reached a certain state?
GET /process/x
200 OK
PULL
Easy to use a PULL-based event
notification with HTTP
PUSH
Can we also support PUSH-
based event notification with
HTTP?
©2011 - Cesare Pautasso 25
27. What is your SOA connector?
RPC BUS
REST/HTTP
©2011 - Cesare Pautasso 27
28. REST as a new connector
RPC BUS
Publish/Subscribe
Call
REST/HTTP
Get/Put/Post/Delete
©2011 - Cesare Pautasso 28
29. What about event notifications?
RPC BUS
Publish/Subscribe
Callback
REST/HTTP
?
Get/Put/Post/Delete
©2011 - Cesare Pautasso 29
30. Solutions
1.Web Feeds (PubSubHubbub)
2.HTTP Long Polling
3.Inverted REST (HTTP Callbacks)
4.WebSockets
5.(XMPP)
©2011 - Cesare Pautasso 30
31. Representations
GET /process/name
ContentType:
application/atom+xml
Web feed representing
the collection of
process instances with
links to each instance
31
32. Representations
GET /process/name/instance
ContentType:
application/atom+xml
Web feed representing
the current state of the
process instance
(collection of task instances)
32
33. Loan Approval Example
Process
Published as External
a Resource Resources
Task
Published as
a Resource
©2011 - Cesare Pautasso 33
34. Process as a Web Feed
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Loan Approval Process</title>
<subtitle>Instance x</subtitle>
<link href="http://rest.jopera.org/loan/x" rel="self" />
<link href="http://rest.jopera.org/loan" rel="template" />
<link href="http://pubsubhubbub.appspot.com/" rel="hub" />
<id>http://rest.jopera.org/loan/x</id>
<updated>2011-06-10T11:11:30Z</updated>
<author><name>Cesare Pautasso</name><email>cp@jopera.org</email></author>
<entry>
<title>Choose Task (Ready)</title>
<link href="http://rest.jopera.org/loan/x/choose" />
<id>http://rest.jopera.org/loan/x/choose</id>
<updated>2011-06-10T11:12:20Z</updated>
<summary>State: ready</summary>
</entry>
<entry>
<title>Approve Task (Waiting)</title>
<link href="http://rest.jopera.org/loan/x/approve" />
<id>http://rest.jopera.org/loan/x/approve</id>
<updated>2011-06-10T11:11:30Z</updated>
<summary>State: waiting</summary>
</entry>
</feed>
©2011 - Cesare Pautasso 34
35. BPM Feed
Process Instance Feed
Task Feed Entry
Process User Feed Author
Task State Summary
Task Timestamp Updated
Task Instance URI Link
©2011 - Cesare Pautasso 35
36. Link Relations
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Loan Approval Process</title>
<subtitle>Instance x</subtitle>
<link href="http://rest.jopera.org/loan/x" rel="self"/>
<link href="http://rest.jopera.org/loan" rel="template”/>
<link href="http://pubsubhubbub.appspot.com/" rel="hub“/>
<id>http://rest.jopera.org/loan/x</id>
</feed>
Template
Self
Process
Process
Instance
©2011 - Cesare Pautasso 36
37. PubSubHubbub
Get
Feed Feed Feed
Consumer Producer
Hub
Ping
Subscribe
Hub
Notify/Poll
©2011 - Cesare Pautasso 37
38. Architecture
http://www.jopera.org/
©2011 - Cesare Pautasso 38
39. Conclusion
Thanks to hypermedia, URIs and the HTTP
uniform interface, REST resources are a very
good abstraction to publish executable business
processes on the Web
RESTful HTTP is good enough to interact without
any extension with process execution engines to
drive the execution of process and task
instances and to deliver notifications
The state of a process instance can be projected
to be represented as a standard Web feed
The PubSubHubbub protocol can be used as an
optimization to scale the corresponding delivery
of notication callbacks
©2011 - Cesare Pautasso 39
40. References
Roy Fielding, Architectural Styles and the Design of Network-based
Software Architectures, PhD Thesis, University of California, Irvine,
2000
Leonard Richardson, Sam Ruby, RESTful Web Services, O’Reilly,
May 2007
Jim Webber, Savas Parastatidis, Ian Robinson, REST in Practice:
Hypermedia and Systems Architecture, O‘Reilly, 2010
Subbu Allamaraju, RESTful Web Services Cookbook: Solutions for
Improving Scalability and Simplicity, O’Reilly, 2010
Stevan Tilkov, HTTP und REST, dpunkt Verlag, 2009,
http://rest-http.info/
Thomas Erl, Raj Balasubramanians, Cesare Pautasso, Benjamin
Carlyle, SOA with REST, Prentice Hall, end of 2010
Martin Fowler,
Richardson Maturity Model: steps toward the glory of REST,
http://martinfowler.com/articles/richardsonMaturityModel.html
©2009-2010 - Cesare Pautasso, Erik Wilde 40
41. Self-References
Cesare Pautasso, Olaf Zimmermann, Frank Leymann,
RESTful Web Services vs. Big Web Services: Making the Right Architectural
Decision, Proc. of the 17th International World Wide Web Conference
(WWW2008), Bejing, China, April 2008.
Cesare Pautasso and Erik Wilde. Why is the Web Loosely Coupled? A Multi-
Faceted Metric for Service Design, Proc of the 18th International World
Wide Web Conference (WWW2009), Madrid, Spain, April 2009.
Cesare Pautasso, BPEL for REST, Proc. of the 6th International Conference
on Business Process Management (BPM 2008), Milan, Italy, September
2008.
Cesare Pautasso, BPMN for REST, Proc. of the 3rd BPMN Workshop (BPMN
2011), Luzern, Switzerland, November 2011
Cesare Pautasso, RESTful Web Service Composition with JOpera,
Proc. Of the International Conference on Software Composition (SC 2009),
Zurich, Switzerland, July 2009.
Cesare Pautasso, Gustavo Alonso: From Web Service Composition to
Megaprogramming In: Proceedings of the 5th VLDB Workshop on
Technologies for E-Services (TES-04), Toronto, Canada, August 2004.
©2009-2010 - Cesare Pautasso, Erik Wilde 41
42. Raj Balasubramanians,
Benjamin Carlyle,
Thomas Erl,
Cesare Pautasso,
SOA with REST,
Prentice Hall, 2012
©2011 - Cesare Pautasso 42
43. 10th International Conference on
Business Process Management
(BPM 2012)
September 3-6 2012, Tallinn, Estonia
http://bpm2012.ut.ee
©2011 - Cesare Pautasso 43
44. 16-20 April 2012, Lyon, France
http://ws-rest.org/2012
©2011 - Cesare Pautasso 44