Request-Response sources and sinks
Http request as input and output to Nussknacker scenarios
Concepts
In Request-Response mode you interact with Nussknacker Lite runtime engine in a similar way as with any "server" in the Internet. You send request which contains request parameters and you get response from the server. The protocol for this communication is HTTP - the same protocol is used by browsers when they communicate with web servers. One of the differences is that the content of the communication with the Nussknacker Lite engine ("the server") is encoded as JSON, not HTML. Not very surprisingly, in Request-Response processing mode the only possible Source component is Request and the only Sink component is Response.
Request-Response schema
Each scenario needs to define two schemas in JSON Schema format:
- Input schema
- Output schema
Nussknacker uses those schema to detect how the request and response should look like.
Request-Response source
Thanks to the Input schema Nussknacker knows what data to expect in the request, so it will hint field names and will perform additional validations on SpEL expressions involving data from the selected topic.
Request-Response sink
The response
sink configuration form will show a list of fields defined in Input schema.
If you prefer to define the whole response as one expression containing value of the HTTP response instead of filling
separate autogenerated fields, you can do that by switching Raw editor
to true
.