Activiti in an Event- driven architecture Robin Bramley Chief Scientific Officer, Ixxus
Intro - RB
Intro - Ixxus
Activiti intro
Double entry considered harmful Increases risk of conflict
Integration is essential…
… in more connected times 7
Health warning 8
The fallacies of distributed computing Essentially everyone, when they first build a distributed application, makes the following eight assumptions. All prove to be false in the long run and all cause big trouble and painful learning experiences. 1.The network is reliable 2.Latency is zero 3.Bandwidth is infinite 4.The network is secure 5.Topology doesn't change 6.There is one administrator 7.Transport cost is zero 8.The network is homogeneous For more details, read the article by Arnon Rotem-Gal-Ozarticle 9
Integration styles 10
4 styles of integration File Transfer Database RPC Messaging
Integration criteria Application coupling Intrusiveness Technology selection Data format Data timeliness Data or functionality Remote communication Reliability Security (AAA, confidentiality, integrity, …) 12
Messaging Asynchronous messaging is inherently loosely coupled and helps to overcome latency & unreliability issues Can easily apply ‘pipes & filters’ approach for flexibility Frameworks such as Spring Integration mask a lot of the complexity from application developers (but ties you to their API) 13
Event-Driven Architecture A good way of loosely integrating systems using the observer pattern Systems emit events when something that may be of interest to other systems happens Systems can listen for events that are interested in and can then take action when they are triggered The emitting application is unaware of which applications are listening to its events – good for extensibility Can be used for near real time business intelligence / business activity monitoring (BAM), alerting, indexing etc. 14
Complex Event Processing Complex Event Processing involves monitoring an event stream to identify activity patterns or correlations (within time windows) Used in Financial Services trading systems for fraud detection Other uses include billing/metering, delayed shipment with RFID tracking
Enterprise Integration Patterns 16
EAI Patterns
White: Section Head
Event Driven Analytics Complex Event Processors are designed for correlating events – Business Activity Monitoring / near real-time dashboards are one application Time is often a factor applied through a sliding window E.g. number of failed login attempts in the last hours
Event Publishing in Spring 21 public class Xyz implements ApplicationEventPublisherAware {... public create(Map foo) {... XyzCreatedEvent evt = new XyzCreatedEvent(foo); applicationEventPublisher.publishEvent(evt); private ApplicationEventPublisher applicationEventPublisher; public setApplicationEventPublisher(ApplicationEventPublisher aep) { applicationEventPublisher = aep; }
Event Listener 22 public class IndexingListener implements ApplicationListener { public onApplicationEvent(ApplicationEvent event) { if (event instanceof XyzCreatedEvent) { XyzCreatedEvent evt = (XyzCreatedEvent) evt;... // handle created event } else if (event instanceof XyzDeletedEvent) {...
Overview
Sample Code { // extract avm store id and path var fullpath = url.extension.split("/"); if (fullpath.length == 0) { status.code = 400; status.message = "Store id has not been provided."; status.redirect = true; break script; } var storeid = fullpath[0]; var path = (fullpath.length == 1 ? "/" : "/" + fullpath.slice(1).join("/")); }
Sample Code { // extract avm store id and path var fullpath = url.extension.split("/"); if (fullpath.length == 0) { status.code = 400; status.message = "Store id has not been provided."; status.redirect = true; break script; } var storeid = fullpath[0]; var path = (fullpath.length == 1 ? "/" : "/" + fullpath.slice(1).join("/")); }
Demo
Asynchronous browser updates 27
Polling 28
Long polling 29
Streaming 30
HTML5 Web Sockets 31
Example EIP flow 32
Sample Code { // extract avm store id and path var fullpath = url.extension.split("/"); if (fullpath.length == 0) { status.code = 400; status.message = "Store id has not been provided."; status.redirect = true; break script; } var storeid = fullpath[0]; var path = (fullpath.length == 1 ? "/" : "/" + fullpath.slice(1).join("/")); }
Sample Code { // extract avm store id and path var fullpath = url.extension.split("/"); if (fullpath.length == 0) { status.code = 400; status.message = "Store id has not been provided."; status.redirect = true; break script; } var storeid = fullpath[0]; var path = (fullpath.length == 1 ? "/" : "/" + fullpath.slice(1).join("/")); }
Demo
Wrap-up Questions? Resources Hohpe & Woolf Enterprise Integration Patterns