Example 2 - Node Responds (HTTP)
Building upon Example 1 - Node with Transaction Mode (HTTP), this configuration demonstrates how to set up a complete request-response cycle using FlowSync. The service includes a mapping that processes incoming HTTP requests and generates defined responses. When a request arrives, the system automatically creates and publishes an appropriate response message, preventing the timeout scenario seen in the previous example.
To call the HttpNode in the example below, run the following command:
curl --insecure \
--location 'https://127.0.0.1/data/flowsync/example2' \
--header 'Authorization: Bearer <replace with your token>'For more information on the FlowSync configuration properties, see Cybus:Node.

description: FlowSync - Example 2
metadata:
  name: example 2
  version: 1.0.0
resources:
  testServer:
    type: Cybus::Server::Http
    properties:
      basePath: /FlowSync
  exampleNode:
    type: Cybus::Node::Http
    properties:
      parent: !ref testServer
      method: GET
      route: /example2
      operation: transaction
  exampleMappings:
    type: Cybus::Mapping
    properties:
      mappings:
        - subscribe:
            endpoint: !ref exampleNode
          publish:
            endpoint: !ref exampleNode
          rules:
            - transform:
                expression: >-
                  (
                    {
                      "id": $.id,
                      "timestamp": $.timestamp,
                      "value": {
                        "response" : "This is a response to your HTTP GET request."}
                    }
                  )Last updated
Was this helpful?

