Events, Picos, and
Microservices
Phillip J. Windley, PhD
Enterprise Architecture, BYU
CTO, Kynetx, Inc.
@windley
This APIs in this
talk aren’t
RESTful
Internet of Things
The Internet of Things will
lead to a computing
experience that is immersive
& pervasive.
Ambient Computing
vs
The Current #IoT Model
Won’t Scale
Me
GE
Internet 

of

My Things
Me
GE
The Internet of My Things
The Internet of My Things
	 leads to
The API of Me
Events vs Requests
“this happened” vs “do this”
Event System Properties
Events are autonomous
Event-driven system are more loosely coupled
Downstream (receiver) driven flow control
Near real-time propagation
Fuse is Three Things
http://joinfuse.com
picos
Picos are online computers
Identity—they represent a specific entity
Storage—they persistently encapsulate both structured
and unstructured data
Open event network—they respond to events
Processing—they run applications autonomously
Event Channels—they have connections to other picos
Services—The provide a consistent set of services
APIs—they provide access to and access other online
services
Owner
Pico
Fleet Pico
Vehicle
Pico
Vehicle
Pico
Vehicle
Pico
Web
Application
Application
Data
Browser
Web
Application
Application
Data
Browser
Vehicle's
Pico
iCalendar
Web
Mobile
Rather than a model where a system
presents an API for a collection of
resources….
Rather than a model where a system
presents an API for a collection of
resources….
Picos present a model wherein each
pico presents it’s own, customizable
API
Phil's Pico
owner
Phil's Pico
owner
Lynne's Pico
owner
Phil's Pico Tom's Pico
owner
Lynne's Pico
owner
Phil's Pico Tom's Pico
owner
Lynne's Pico
owner
Phil's Pico Tom's Pico
owner
Lynne's Pico
owner
Phil's Pico Tom's Pico
owner
Lynne's Pico
owner borrower
Phil's Pico
Phil's Pico
Picos Support A Familiar Model
Kynetx Rules Engine
Other
Data
Sources
Web
Services
APIs
Rulesets
Persistent
Data
APIs
container
Picos Support A Familiar Model
Kynetx Rules Engine
Other
Data
Sources
Web
Services
APIs
Rulesets
Persistent
Data
APIs
container
Persistent Compute Object
object
Picos Support A Familiar Model
Kynetx Rules Engine
Other
Data
Sources
Web
Services
APIs
Rulesets
Persistent
Data
APIs
container
Persistent Compute Object
object
CloudOS
Configuration
Management
CloudOS
Service
Notification
Service
PersonalData
Service
UISupport
File
Social
Social
Fuse
Library
Guard
Tour
Library
libraries
Picos Support A Familiar Model
Kynetx Rules Engine
Other
Data
Sources
Web
Services
APIs
Rulesets
Persistent
Data
APIs
container
Persistent Compute Object
object
Forevr.us
(contact)
Timeline
(social)
ToDo&
Reminders
Vehicle
Manangement
Home
Management
Intentcasting
Fuse
Guard
Tour
applications
CloudOS
Configuration
Management
CloudOS
Service
Notification
Service
PersonalData
Service
UISupport
File
Social
Social
Fuse
Library
Guard
Tour
Library
libraries
Picos Are Decentralized & Networked
pico
pico
Hosting
Space
Pico
Space
Hosting
Company A
Hosting
Company B
Self
Hosted
pico
pico
pico
pico
pico
pico
pico
KRE KRE KRE
Pico
Containers
Built on open standards
Built on open source
But it’s not just about
manufactured things...
This can get complex…
Institution
Tour
Index
Location
Index
Report
Index
Tour
"LUFX"
Tour
"KUFF"
Location
"R7RK"
Report
"1"
Location
"G5YH"
Report
"current"
Location
"T67G"
Managers
Guards
Guard
"Frank"
Subscriptions
permanent
temporary
Report
"2"Report
"2"Report
"2"Reports
Tours
Tours
Tours
Tours
Locations
Locations
Locations
Locations
Picos Use an Event Query API
pico
functions
rules
persistent
storage
or CancelDone
User Interface
name
email
phone
query API
event API
user makes change in UI
resulting in an event
UI updates presentation
using query API
rules validate and process event,
often updating model
functions return results based
on persistent data
Programming Model
Program in any language you like
OAuth access to pico
Pico provides
user data
processing
API and inter-pico communications
Microservices
Organized around a single business
capability
Small, generally less than 1000 lines and
code and usually much smaller
Event-based and asynchronous
Run in their own process
Independently deployable
Decentralized data storage
carvoyant:
numeric_data_key
vehicle event bus
carvoyant:
numeric_data_key
vehicle event bus
fuel level
low
carvoyant:
numeric_data_key
fuse:
update_fuel_level
vehicle event bus
fuel level
low
carvoyant:
numeric_data_key
fuse:
update_fuel_level
vehicle event bus
fuel level
low
create
alert
fuse:
new_alert
carvoyant:
numeric_data_key
fuse:
update_fuel_level
vehicle event bus
fuel level
low
create
alert
fuse:
new_alert
send
notification
notification:
status
carvoyant:
numeric_data_key
fuse:
update_fuel_level
vehicle event bus
fuel level
low
create
alert
fuse:
new_alert
record
new fuel
send
notification
notification:
status
carvoyant:
numeric_data_key
fuse:
update_fuel_level
vehicle event bus
fuel level
low
create
alert
fuse:
new_alert
record
new fuel
IFTTT
send
notification
notification:
status
carvoyant:
numeric_data_key
fuse:
update_fuel_level
vehicle event bus
fuel level
low
create
alert
fuse:
new_alert
record
new fuel
save trip IFTTT
send
notification
notification:
status
carvoyant:
numeric_data_key
fuse:
update_fuel_level
vehicle event bus
fuel level
low
create
alert
fuse:
new_alert
record
new fuel
save trip IFTTT
send
notification
notification:
status
record
brand data
Healing Subscriptions
rule check_subscriptions {
select when pds profile_updated
pre {
vid = carvoyant:vehicle_id();
my_subs = carvoyant:getSubscription(vid);
should_have = required_subscription_list.length();
}
if(my_subs.length() < should_have) then
send_directive("not enough subscriptions")
fired {
log ">>>> vehicle #{vid} needs subscription check";
raise fuse event need_initial_carvoyant_subscriptions;
}
}
Healing Subscriptions
rule check_subscriptions {
select when pds profile_updated
pre {
vid = carvoyant:vehicle_id();
my_subs = carvoyant:getSubscription(vid);
should_have = required_subscription_list.length();
}
if(my_subs.length() < should_have) then
send_directive("not enough subscriptions")
fired {
log ">>>> vehicle #{vid} needs subscription check";
raise fuse event need_initial_carvoyant_subscriptions;
}
}
Healing Subscriptions
rule check_subscriptions {
select when pds profile_updated
pre {
vid = carvoyant:vehicle_id();
my_subs = carvoyant:getSubscription(vid);
should_have = required_subscription_list.length();
}
if(my_subs.length() < should_have) then
send_directive("not enough subscriptions")
fired {
log ">>>> vehicle #{vid} needs subscription check";
raise fuse event need_initial_carvoyant_subscriptions;
}
}
Healing Subscriptions
rule check_subscriptions {
select when pds profile_updated
pre {
vid = carvoyant:vehicle_id();
my_subs = carvoyant:getSubscription(vid);
should_have = required_subscription_list.length();
}
if(my_subs.length() < should_have) then
send_directive("not enough subscriptions")
fired {
log ">>>> vehicle #{vid} needs subscription check";
raise fuse event need_initial_carvoyant_subscriptions;
}
}
Healing Subscriptions
rule check_subscriptions {
select when pds profile_updated
pre {
vid = carvoyant:vehicle_id();
my_subs = carvoyant:getSubscription(vid);
should_have = required_subscription_list.length();
}
if(my_subs.length() < should_have) then
send_directive("not enough subscriptions")
fired {
log ">>>> vehicle #{vid} needs subscription check";
raise fuse event need_initial_carvoyant_subscriptions;
}
}
KRL
Rules
Runs in picos
Built for microservices
Complex event expressions
Persistent variables
Side-effects are quarantined
Developer Tools
Self Healing
f(f(x)) = f(x)
Idempotent
Asynchrony
Accretive
Systems
Why do this?
Orthogonality and modularity are
powerful: network effects!
Loose coupling
Simple services are easier to get right
More private
My book on
event
programming
http://joinfuse.com
Internet Identity
Workshop
Contact info:
Phil Windley
pjw@kynetx.com
www.windley.com
@windley
Events, Picos, and
Microservices

Events, Picos, and Microservices