Skip to content

How to create Endpoint ?

devsda edited this page May 18, 2019 · 2 revisions

To create endpoint, we need to define below things -

  1. Workflow details in xml format.
  2. Node details in json format.

Workflow details

This helps to create graph. It contains details of nodes, edges, and how edges connects two nodes. Client has to define in xml format.

Below is the sample workflow details -

<?xml version="1.0" encoding="UTF-8"?>
<workflow>

    <type>UNCONDITIONAL</type>

    <graph>

        <node>
            <name>ValidateOrder</name>
            <connections>
                <connection>
                    <edge>Yes</edge>
                    <node>GetOrderType</node>
                </connection>
            </connections>
            <owner>PummyAntyFoodShop</owner>
        </node>

        <node>
            <name>GetOrderType</name>
            <connections>
                <connection>
                    <edge>NonVeg</edge>
                    <node>AssignNonVegKitchen</node>
                </connection>
                <connection>
                    <edge>Veg</edge>
                    <node>AssignVegKitchen</node>
                </connection>
            </connections>
            <owner>PummyAntyFoodShop</owner>
        </node>

        <node>
            <name>AssignNonVegKitchen</name>
            <connections>
                <connection>
                    <edge>Yes</edge>
                    <node>AssignChef</node>
                </connection>
            </connections>
            <owner>PummyAntyFoodShop</owner>
        </node>

        <node>
            <name>AssignVegKitchen</name>
            <connections>
                <connection>
                    <edge>Yes</edge>
                    <node>AssignChef</node>
                </connection>
            </connections>
            <owner>PummyAntyFoodShop</owner>
        </node>

        <node>
            <name>AssignChef</name>
            <connections>
                <connection>
                    <edge>Yes</edge>
                    <node>GatherIngredients</node>
                </connection>
            </connections>
            <owner>PummyAntyFoodShop</owner>
        </node>

        <node>
            <name>GatherIngredients</name>
            <connections>
                <connection>
                    <edge>Yes</edge>
                    <node>CookFood</node>
                </connection>
            </connections>
            <owner>PummyAntyFoodShop</owner>
        </node>

        <node>
            <name>CookFood</name>
            <connections>
                <connection>
                    <edge>Yes</edge>
                    <node>NotifyClient</node>
                </connection>
            </connections>
            <owner>PummyAntyFoodShop</owner>
        </node>

        <node>
            <name>NotifyClient</name>
            <owner>PummyAntyFoodShop</owner>
        </node>

    </graph>

</workflow>

Tags details -

  1. type : UNCONDITIONAL/CONDITIONAL.
  2. graph : It contains all the nodes information.
    1. node : It contain single node information.
      1. name : Name of node.
      2. connections : List of connections to direct children.
        1. connection : Single connection information.
          1. edge : Edge name between parent and child node.
          2. name : name of child node.
      3. owner : owner of this node.
<?xml version="1.0" encoding="UTF-8"?>
<workflow>

    <type>UNCONDITIONAL/CONDITIONAL</type>

    <graph>

        <node>
            <name>NAME NAME</name>
            <connections>
                <connection>
                    <edge>EDGE NAME 1</edge>
                    <node>CHILD NODE 1</node>
                </connection>
                <connection>
                    <edge>EDGE NAME 2</edge>
                    <node>CHILD NODE 2</node>
                </connection>
            </connections>
            <owner>OWNER NAME (TEAM NAME)</owner>
        </node>

        <node>
           ....
        </node>

        <node>
           ....
        </node>

    </graph>

</workflow>

Node details

This helps to define details of Node. It contains endpoint details of Client. Client has to create it in json format.

Sample node details -

{
  "teamConfigurations": [
    {
      "owner": "PummyAntyFoodShop",
      "serverDetails": {
        "protocol": "http",
        "hostName": "3.95.163.243",
        "port": "9090"
      },
      "headers": {
        "content-type": "application/json",
        "X-PummyAntyFoodShop-API-Key": "XYZ",
        "X-PummyAntyFoodShop-Application-Id": "ABC",
        "Accept": "*/*"
      },
      "nodeConfigurations": [
        {
          "name": "ValidateOrder",
          "URI": "/dominos-shepherd-client/order-management-workflow/validateOrder",
          "httpMethod": "POST"
        },
        {
          "name": "GetOrderType",
          "URI": "/dominos-shepherd-client/order-management-workflow/getOrderType",
          "httpMethod": "POST"
        },
        {
          "name": "AssignNonVegKitchen",
          "URI": "/dominos-shepherd-client/order-management-workflow/assignNonVegKitchen",
          "httpMethod": "POST"
        },
        {
          "name": "AssignVegKitchen",
          "URI": "/dominos-shepherd-client/order-management-workflow/assignVegKitchen",
          "httpMethod": "POST"
        },
        {
          "name": "AssignChef",
          "URI": "/dominos-shepherd-client/order-management-workflow/assignChef",
          "httpMethod": "POST"
        },
        {
          "name": "GatherIngredients",
          "URI": "/dominos-shepherd-client/order-management-workflow/gatherIngredients",
          "httpMethod": "POST"
        },
        {
          "name": "CookFood",
          "URI": "/dominos-shepherd-client/order-management-workflow/cookFood",
          "httpMethod": "POST",
          "headers": {
            "content-type": "application/pdf"
          }
        },
        {
          "name": "NotifyClient",
          "URI": "/dominos-shepherd-client/order-management-workflow/notifyClient",
          "httpMethod": "POST"
        }
      ]
    }
  ]
}

Fields information

{
  # Single workflow can be owned by multiple teams. One team can own multiple nodes.
  # teamConfigurations : Every team need to define its information like below sample.
  "teamConfigurations": [
    {
      "owner": "OWNER NAME",
      "serverDetails": {
        "protocol": "http/https",
        "hostName": "HOSTNAME : localhost/x.y.z.w",
        "port": "PORT NUMBER"
      },
      # Global header details. By default, every node will use these headers. Node can also override any header that mentioned below.
      "headers": {
        "content-type": "application/json",
        "KEY": "VALUE",
        ....
      },
      # Information of nodes that is owned by this team.
      "nodeConfigurations": [
        {
          "name": "NODE NAME",
          "URI": "URI",
          "httpMethod": "POST",
          # Precedence of node level headers is higher than team level headers. Node can override any header, that is declared at team level.
          "headers": {
            "content-type": "application/pdf",
            ....
          }
        },
        ....
      ]
    },
    ....
  ]
}