This example demonstrates a complete FlowSync implementation that creates a bridge between an external DNS service and a local endpoint. The configuration establishes a transaction flow where requests to resolve DNS entries are processed through dns.google. This request requires a name as the request parameter and returns dns details. The service exposes a south-side HTTP endpoint at ../dns/resolve that accepts DNS requests, forwards them to dns.google, and returns the results through the FlowSync mechanism.
To call the HttpNode in the example below, run the following command:
curl --insecure \--location 'https://127.0.0.1/data/flowsync/example5?entry=cybus.io' \--header 'Authorization:Bearer <replace with your token>'
For more information on the FlowSync configuration properties, see Cybus:Node.
description:FlowSync - Example 5metadata:name:example 5version:1.0.0resources:# ------------------------------------------------# Our Endpoints for dns.google (north side)# ------------------------------------------------googleDnsConnection:type:Cybus::Connectionproperties:protocol:Httpconnection:scheme:httpshost:dns.googlednsEndpoint:type:Cybus::Endpointproperties:topic:dnsprotocol:Httpconnection:!refgoogleDnsConnectionpublishError:trueread:path:/resolve# ---------------------------------------# Our HTTP Server and Nodes (south side)# ---------------------------------------server:type:Cybus::Server::Httpproperties:basePath:/flowsyncdnsNode:type:Cybus::Node::Httpproperties:parent:!refservermethod:GETroute:/example5operation:transaction# ------------------------------------------------# The mappings forwarding requests and responses# ------------------------------------------------Mapping:type:Cybus::Mappingproperties:mappings: - subscribe:endpoint:!refdnsNodepublish:endpoint:!refdnsEndpointrules: - transform:expression:>- ( { "id": $.id, "query": { "name": $.value.query.entry } } ) - subscribe:endpoint:!refdnsEndpointpublish:endpoint:!refdnsNoderules: - transform:expression:>- ( { "id": $.id, "timestamp": $.timestamp, "value" : $.value } )