Java Magazine, Mar/Apr 2018
ORACLE COM JAVAMAGAZINE MARCH APRIL 2018 55 microservices and containers Wookiee Components Components are modular living libraries That is they spin up before your Service and allow you to set up and manage other libraries features or technologies A Service can have any number of Components and a Component can be designed to do anything The Wookiee community has already open sourced a few Components that add helpful features such as metrics In the Component code below I create a connection to a database and receive queries with it class MyDBQueryComponent name String extends Component name val dbConnection DBConnection config start def receive case DBQuery queryString run the query that was sent against the database connection that was initialized val dbQueryResult dbConnection query queryString sender dbQueryResult In this code I establish a connection to the database dbConnection and then I am ready to handle queries from the Akka Actor receive block which inflows messages Results return to their original sender which could exist anywhere in your Wookiee Service There are many other possible applications of Components which begin to become recognizable as you envision Wookiee based architectures Figure 1 demonstrates how a normal Wookiee architecture incorporates a set of Components that load in parallel before it starts the Service To imagine your next Component think back to a time you went to build a service that was accessible externally via HTTP First you selected a library that fit your needs Next you set up and configured an HTTP server class that needed to be passed around And most HTTP libraries would require you to compose complex routing trees that are dificult to split across classes
You must have JavaScript enabled to view digital editions.