Marcin Czeczko edited this page Jan 19, 2018 · 6 revisions

Service Adapter

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, body field 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.

Writing custom Service Adapter requires fulfilling Service Knot contract. Please refer also to Adapter.

! Note
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.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.