hapi-hemera
hapi-hemera is a Hemera micro-services plugin for Hapi 17+. The plugin integrates the Hemera functionality into hapi.
Plugin Registration
const server = await server
Plugin registration with a custom Hemera instance
const server = const hemeraInstance = await server
Use toolkit decorator
server
Use server decorator
server
Use request decorator
server
Server methods
serveraction'generate' topic: 'generator' cmd: 'id'const result = await servermethods
params
, query
and payload
as pattern
Use handler decorator and accept server
Gracefully shutdown
We hook into Hapi onPostStop
event to gracefully shutdown hemera.
Enrich pattern with contextual data
server // The basePattern is merged with the patternhemera // Results in following pattern a: 1 trace$: traceId: 123
zipkin-instrumentation-hapi
Example for { return trace$: traceId: requestpluginszipkintraceIdtraceId spanId: requestpluginszipkintraceIdspanId sampled: requestpluginszipkintraceIdsampled flags: requestpluginszipkintraceIdflags }