I was pretty excited when I saw that the New York Times Tech team open-sourced their Microservice Toolkit named Gizmo. Its goal is to make microservice creation very simple by giving us flexible packages ready to be used. Let’s make a simple geocoder microservice with Gizmo.
Let’s geocode an IPv4, a real address and foobar via the ChainProvider with FreeGeoIpProvider and GoogleMapsProvider with the CurlHttpAdapter using the GeoJsonDumper dumper. Then we need to make the Bernard Client with the PredisDriver because we will use Redis as a persistent engine. Our geocoding messages are quite simple objects so we will use the NaiveSerializer. Then configurations change if it’s a producer or a consumer. We will look closer later.
Geotools supports now Redis, MongoDB and Memcached as cache engine. Read more in github – Well, Geotools is yet another project about geocoding tools, kit, library etc… Yes, but if you are a user of Geocoder you will appreciate it - I hope :) I started this, first of all, for my own needs and then because I was thinking how I could implement an easy way to batch geocoding and reverse geocondig requests in serie and especially in parallel.
As said we will use Reactphp especially the Async module. We will take the exemple from the post Geocoder php library simple batch requests and adapt it to make it asynchronous. The implementation will be very simple, it’s just to show how to use React with Geocoder in a very basic way.
This demo will run the
10 providers which can geocode this address
10 rue Gambetta, Paris, France. We will then transform, if available, result objects in standard format via the