> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/1-11-0/documentation/services/flowsync/flowsync-example-6.md).

# Example 6 - Full Transactional Data Flow (OPC UA)

This example demonstrates a flow starting with an OPC UA method call, performing an HTTP request and giving back the HTTP request result as method call result via OPC UA.

The configuration connects dns.google on the north side with a custom OPC UA method on the south side. The OPC UA server provides a method `getIpForDomain` that accepts a domain name (e.g., cybus.io) as input and returns the corresponding IP address as output.

You can access the OPC UA server via `opc.tcp://127.0.0.1:4841/UA/CybusOpcuaServer`.

* If the domain is successfully resolved, the method returns the IP address.
* If no DNS record is found, it returns a BadNotFound error.

For more information on the FlowSync configuration properties, see [Cybus:Node](/1-11-0/documentation/services/service-commissioning-files/resources/cybus-node.md#operation).

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

{% file src="/files/7YkET7WzmDDLCl0cWSTH" %}

{% code title="flowsync-example-6-full-transactional-data-flow-opc-ua.yaml" lineNumbers="true" %}

```yaml
description: FlowSync - Example 6
metadata:
    name: example 6
    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 OPCUA Server and Nodes  (south side)
    # ---------------------------------------

    opcuaServer:
        type: Cybus::Server::Opcua
        properties:
            hostname: 127.0.0.1
            allowAnonymous: true
            securityPolicies: ['None']
            securityModes: ['None']

    rootNode:
        type: Cybus::Node::Opcua
        properties:
            browseName: Cybus
            nodeId: ns=1;s=Cybus
            parent: !ref opcuaServer
            nodeType: Object

    getIpForDomainNode:
        type: Cybus::Node::Opcua
        properties:
            topic: getIpForDomain
            browseName: getIpForDomain
            nodeId: ns=1;s=getIpForDomain
            parent: !ref rootNode
            nodeType: Method # mark node as method
            operation: transaction
            inputArguments:
                - name: domain
                  dataType: String
                  description: the domain to resolve
            outputArguments:
                - name: ip
                  dataType: String
                  description: the IP address of the domain

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

    Mapping:
        type: Cybus::Mapping
        properties:
            mappings:
                - subscribe:
                      endpoint: !ref getIpForDomainNode
                  publish:
                      endpoint: !ref dnsEndpoint
                  rules:
                      - transform:
                            expression: >-
                                (
                                  {
                                    "id": $.id,
                                    "query": {
                                       "name": $.value.inputArguments[0].value
                                    }
                                  }
                                )
                - subscribe:
                      endpoint: !ref dnsEndpoint
                  publish:
                      endpoint: !ref getIpForDomainNode
                  rules:
                      - transform:
                            expression: >-
                                (
                                  {
                                    "id": $.id,
                                    "timestamp": $.timestamp,
                                    "value" : $.value.Status = 0 ? { 
                                       "outputArguments": [
                                          {
                                            "value": $.value.Answer[0].data
                                          }
                                       ]
                                    } : undefined,
                                    "error" : $.value.Status != 0 ? {
                                      "code": "BadNotFound",
                                      "message": "Domain not found"
                                    } : undefined
                                  }
                                )
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cybus.io/1-11-0/documentation/services/flowsync/flowsync-example-6.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
