Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Service Adapter is Component of a system, that mediate communication between Knot.x Service Knot and external services that deliver data injected into template. In short, Service Adapter acts as a element translating messages between external services and Knots.
How does it work?
Service Adapter accepts message with the following data:
clientRequest- object with all data of an original request,
params- all additional params defined in configuration.
Result generated by Action Adapter must be a JsonObject with the fields as below:
clientResponse- Json Object,
bodyfield of this response is suppose to carry on the actual response from the mocked service,
Find out more about contract described above in Service Knot section.
How to configure?
Configuration of Service Adapter is specific to its implementation. You may see example configuration of Http Service Adapter.
How to implement your own Service Adapter?
Implementing custom Service Adapter that meets your project requirements allows you to adopt request from Knot.x into request understandable by an endpoint service, and adopts responses from that service into unified message understandable by Knot.x.
For you convenience, Knot.x comes with implementation of a Service Adapter, that enables communication with external services using HTTP Protocol.
See Http Service Adapter for more information. Please note, that this implementation is very generic and we recommend to create project-specific adapters for your setup.
|Besides Verticle implementation itself, a custom implementation of your Service Adapter must be build as Knot.x module in order to be deployed as part of Knot.x. Follow the Knot.x Modules in order to see how to make your Service Adapter a module.|