The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XAS::Service - A set of modules and utilities to implement Micro Services

DESCRIPTION

A Micro Service is software architectural design for software development and deployment. If you do a google search, you will find many different opinions on how they should work and function.

XAS is a cross platform suite of modules and procedures. So a XAS based micro service would also have to be the same. Our micro services are based on standard Web technologies. Their interfaces are accessed over HTTP. That interface will be REST based. They will return either HTML or JSON depending on HTTP headers. The HTML interface will be a simple layer to the underlaying api. They have simple embedded HTTP servers. That server understands just enough HTTP to implement the api. It is not a full fledged HTTP server, nor do you need one to run a XAS micro service. They will run as daemons or services depending on platform and this will be transparent to the code base.

HTTP SERVER

The HTTP server uses XAS::Lib::Net::Server with the appropriate POE filter. The filter that we are using is POE::Filter::HTTP::Parser. which seems to be the most up to date.

PLACK

Plack is the glue between the web interface and the web application. XAS depends on POE for the multi-tasking in our daemons. Surprisingly, there is no supported glue module between the two environmnets. So the HTTP Server provides that glue. This "glue" also allows us to control the service with the standard XAS methods. A XAS micro service can be stopped, started, paused and resumed.

HTTP ENGINE

Once the HTTP request has been received and translated into a Plack request, it needs to be acted upon. This is done by XAS::Service::Resource which is a wrapper around Web::Machine. Web::Machine is the Perl5 port of the Erlang Webmachine, which was developed to handle the normal flow of processing for REST based applications.

VALIDATION

You also need to validate your input. Any posted JSON data is converted into a Hash::MultiValue object. This is then used to validate the input using Date::FormValidator. A predefined profile for the search capibility has been included. This profile can be combined with other profiles with XAS::Service::Profile and checked with the mixin XAS::Service::CheckParameters.

Any mirco service that involves a database needs search capability. XAS::Service::Search provides that capability.

With the combination of these modules, you can build reliable micro services quickly and easily.

SEE ALSO

Plack
Web::Machine
Erlang Webmachine
POE::Filter::HTTP::Parser
Hash::MultiValue
Data::FormValidator
XAS::Lib::Net::Server
XAS::Service::Server
XAS::Service::Profile
XAS::Service::CheckParameters
XAS::Service::Search
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

LICENSE AND COPYRIGHT

Copyright (c) 2012-2016 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.