# Example 5 - Full Transactional Data Flow (HTTP)

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:

{% code lineNumbers="true" %}

```yaml
curl --insecure \
--location 'https://127.0.0.1/data/flowsync/example5?entry=cybus.io' \
--header 'Authorization: Bearer <replace with your token>'
```

{% endcode %}

For more information on the FlowSync configuration properties, see [Cybus:Node](https://docs.cybus.io/1-10-1/documentation/service-commissioning-files/resources/cybus-node#operation).

<figure><img src="https://1495428842-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPRxCI5iN2a8F6qzT9n0T%2Fuploads%2Fgit-blob-f9323460385e5caf473280eba474e1f4c0ebf2fb%2Fflowsync-example-5.png?alt=media" alt=""><figcaption></figcaption></figure>

{% file src="<https://1495428842-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPRxCI5iN2a8F6qzT9n0T%2Fuploads%2Fgit-blob-90d2738474f60281cfce332d9734de1d743d7393%2Fflowsync-example-5-full-transactional-data-flow-http.yaml?alt=media>" %}

{% code lineNumbers="true" %}

```yaml
description: FlowSync - Example 5
metadata:
    name: example 5
    version: 1.0.0
resources:
    # ------------------------------------------------
    # Our Endpoints for dns.google (north side)
    # ------------------------------------------------

    googleDnsConnection:
        type: Cybus::Connection
        properties:
            protocol: Http
            connection:
                scheme: https
                host: dns.google

    dnsEndpoint:
        type: Cybus::Endpoint
        properties:
            topic: dns
            protocol: Http
            connection: !ref googleDnsConnection
            publishError: true
            read:
                path: /resolve

    # ---------------------------------------
    # Our HTTP Server and Nodes  (south side)
    # ---------------------------------------

    server:
        type: Cybus::Server::Http
        properties:
            basePath: /flowsync

    dnsNode:
        type: Cybus::Node::Http
        properties:
            parent: !ref server
            method: GET
            route: /example5
            operation: transaction

    # ------------------------------------------------
    # The mappings forwarding requests and responses
    # ------------------------------------------------

    Mapping:
        type: Cybus::Mapping
        properties:
            mappings:
                - subscribe:
                      endpoint: !ref dnsNode
                  publish:
                      endpoint: !ref dnsEndpoint
                  rules:
                      - transform:
                            expression: >-
                                (
                                  {
                                    "id": $.id,
                                    "query": {
                                       "name": $.value.query.entry
                                    }
                                  }
                                )
                - subscribe:
                      endpoint: !ref dnsEndpoint
                  publish:
                      endpoint: !ref dnsNode
                  rules:
                      - transform:
                            expression: >-
                                (
                                  {
                                    "id": $.id,
                                    "timestamp": $.timestamp,
                                    "value" : $.value
                                  }
                                )
```

{% endcode %}
