Eventdriven Microservices Jeremy Deane http jeremydeane net Eventdriven

  • Slides: 16
Download presentation
Event-driven Microservices Jeremy Deane http: //jeremydeane. net

Event-driven Microservices Jeremy Deane http: //jeremydeane. net

Event-driven Architecture Events § Events represent a snapshot in time of an occurrence within

Event-driven Architecture Events § Events represent a snapshot in time of an occurrence within a system § Information (noise) to Actionable (signal) Enterprise Integration Patterns (EIP) § Event Message, Command Event, Event Sourcing Middleware Solutions § Active. MQ, Rabbit. MQ (JMS-AMPQ) § Kafka, Zero. MQ § Akka, Storm

Microservices Architectural Style …an approach to developing a single application as a suite of

Microservices Architectural Style …an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. http: //martinfowler. com/articles/microservices. htm l …you must be this tall to use. - Neal Ford

Event-driven Microservices

Event-driven Microservices

Apache Active. MQ Integration Options Java Message Service (JMS) Advanced Message Queuing Protocol (AMQP)

Apache Active. MQ Integration Options Java Message Service (JMS) Advanced Message Queuing Protocol (AMQP) Deployment Flexibility Stand-alone Embedded Advanced Topologies Master-Slave High Availability (HA) Federated Network Support Active Open Source Community Commercial 24 X 7 Options Languages - Transport • Java-Scala – TCP/NIO • Ruby, Perl, Python – Stomp • C# (NMS) –TCP/NIO

Active. MQ High Availability (HA) Messaging Backbone failover: (tcp: //Primary. Broker: 61616, tcp: //Secondary.

Active. MQ High Availability (HA) Messaging Backbone failover: (tcp: //Primary. Broker: 61616, tcp: //Secondary. Broker: 61616)? randomize=false

Active. MQ Federated Topologies Web Security Network Segment Service Security Network Segment § Network

Active. MQ Federated Topologies Web Security Network Segment Service Security Network Segment § Network § Business § Other Data Security Network Segment

Apache Camel – Enterprise Integration Library Camel In Action by Claus Ibsen and Jonathan

Apache Camel – Enterprise Integration Library Camel In Action by Claus Ibsen and Jonathan Anstey § Domain Specific Languages (DSL) – Java, Scala, Spring DSL § Route Builders – create Endpoints (i. e. from & to) using Components (e. g. protocol) and Processors (e. g. Mediation, Enrichment § Route Engine – Loads and executes Routes

Spring Boot – Apache Camel Route Processing /** * Splitter - xpath expression */

Spring Boot – Apache Camel Route Processing /** * Splitter - xpath expression */ from("activemq: emagic. orders"). split(split. XPath). parallel. Processing( ). wire. Tap("direct: ministry"). to("activemq: emagic. order"); /** Spring Boot – Camel Route Application */ @Configuration @Import. Resource("classpath: camel-route-spring. xml") public class Magic. Router. Application { public static void main(String[] args) { Spring. Application. run(Magic. Router. Application. class, args); } }

Apache Camel – Deployment Options § Single Event-driven Microservice per VM § Multiple Event-Driven

Apache Camel – Deployment Options § Single Event-driven Microservice per VM § Multiple Event-Driven Microservices per VM § Single Event-driven Microservices Container (e. g. Docker or Rocket)

Apache Camel – Active. MQ Integration

Apache Camel – Active. MQ Integration

Event-driven Microservices: Demo

Event-driven Microservices: Demo

Event-driven Microservices: Quality Assurance @Override protected Camel. Context create. Camel. Context() throws Exception {

Event-driven Microservices: Quality Assurance @Override protected Camel. Context create. Camel. Context() throws Exception { § Source. Camel. Context Control Management - Git context = super. create. Camel. Context(); //setup routes to Mock Endpoints § Functional Tests - Camel Test{ Support context. add. Routes(new Route. Builder() public void configure() { § Continuous Integration (CI) – Team City @Test }); } //test xpath split public void test. Split. Logic() throws Exception { from ("direct: split"). split(new XPath. Builder (Magic. Route. Builder. split. Xpath)). to("mock: order"); //Set expectations Mock. Endpoint order = get. Mock. Endpoint("mock: order"); order. expected. Message. Count(3); //read in a small batch String xml = IOUtils. to. String(this. get. Class(). get. Resource. As. Stream("batch. xml"), "UTF-8"); return context; //execute the test template. send. Body("direct: split", xml); } //should be three orders in the batch order. assert. Is. Satisfied();

Event-driven Microservices: Release Engineering § Convention over Configuration § Deployment and Configuration Directory Structure

Event-driven Microservices: Release Engineering § Convention over Configuration § Deployment and Configuration Directory Structure § Linux init. d Symbolic Link § Git Hooks § Trigger Release Process and Functional Regression § Chef Recipes § Instantiate Linux VM § Provision Linux VM (Java Runtime Environment) § Deploy Executable JAR and Configurations

Event-Driven Microservices: Operations § Logging (e. g. Splunk, Logstash) § Standard Format § Alerts

Event-Driven Microservices: Operations § Logging (e. g. Splunk, Logstash) § Standard Format § Alerts § Processes (e. g. Zabbix, Nagios, Hyperic) § JMX § REST WS § Command Events § Synthetic Transactions § Tracking Identifier § Correlate activities across systems § Rapidly identify problems and performance bottlenecks § Command Consoles (e. g. Active. MQ, Java Console, Zabbix, Splunk)

Questions & Feedback My Contact information: Jeremy Deane Director of Software Architecture Navi. Net

Questions & Feedback My Contact information: Jeremy Deane Director of Software Architecture Navi. Net jeremy. deane@gmail. com http: //jeremydeane. net https: //github. com/jtdeane/event-driven-microservices https: //github. com/jtdeane/camel-standalone-router