Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Go to Workflow API for a detailed view of the different requests

Easy Heading Free
navigationTitleOn this Page
navigationExpandOptionexpand-all-by-default

Adding a Publisher 


The following steps will create a new workflow and then add a single Elasticsearch Publisher (In Progress) to the onPublish event.

Step 1. Add a new Workflow

Request


Saga_json
TitlePOST /aspire/_api/workflows?type=connector
{
    "description": "ES Workflow"
}


Response

Saga_json
{
    "workflow": [
        {
            "id": "9bdf3efb-c266-46ac-ab59-eb8eda87d9e9",
            "type": "connector",
            "description": "Test Workflow",
            "checksum": "e143d076aab367368474087d6ebf1d90377405b7c8ab227f5cb835380e6ccc4f",
            "templates": {
                "template": [
                    {
                        "id": "add-static-acl",
                        "type": "script",
                        "description": "Add static ACLs",
                        "ruleDescription": "Static ACL: Domain:\"${domain}\" Name:\"${name}\" Type:\"${entity}\" Access:\"${access}\"",
                        ...
                    },
                   ...
                ]
            },
            "events": {
                "event": [
                    {
                        "id": "onScan"
                    },
                    {
                        "id": "onAddUpdate"
                    },
                    {
                        "id": "onDelete"
                    },
                    {
                        "id": "onPublish"
                    },
                    {
                        "id": "onError"
                    },
                    {
                        "id": "onIdentity"
                    },
                    {
                        "id": "onIdentityError"
                    }
                ]
            }
        }
    ]
}

Note

Notice that by default when a new Workflow is created, all templates and events are added to it so they can be used to create different sets of rules.


Step 2. Create an ElasticSearch Publisher Rule


Request

Saga_json
TitlePOST /aspire/_api/workflows/9bdf3efb-c266-46ac-ab59-eb8eda87d9e9/rules
{
    "type": "application",
    "description": "Elastic",
    "config": "com.accenture.aspire:aspire-elasticsearch-publisher-source",
    "appType": "elasticsearch-publisher",
    "appName": "Elasticsearch Publisher",
    "properties": {
        "elasticNoUrl": false,
        "elasticUrl": "http://localhost:9200/_bulk",
        "elasticIndex": "index2",
        "authType": "none",
        "transformType": "JSON",
        "transformFile": "${component.home}/config/groovy/transform.groovy",
        "processClear": true,
        "deleteOnClear" : true,
        "connectionTimeout": 15000,
        "readTimeout": 15000,
        "maxRetries": 1,
        "retryDelay": 15000,
        "maxRetryDelay": 200000,
        "retryDelayMultiplier": 1,
        "maxResults": 1000000,
        "pageSize": 10000,
        "idField": "hits._id",
        "urlField": "hits.fields.url",
        "timestampField": "hits.fields.submitTime",
        "debug": false
    }
}


Response


Saga_json
{
    "workflow": {
        "id": "9bdf3efb-c266-46ac-ab59-eb8eda87d9e9",
        "type": "connector",
        "description": "Test Workflow",
        "checksum": "1b45ac011d1d489a880e3700b93ec07ff2c192e15f360befd00c952e127b05a691a18e936fd07149bb29280a217df2be21f08f25f279884fa2aad88b92b53796",
        "rule": {
            "type": "application",
            "_type": "publisher",
            "description": "ElasticES Publisher",
            "config": "com.accenture.aspire:aspire-elasticsearch-publisher-source",
            "appType": "elasticsearch-publisher",
            "appName": "Elasticsearch_Publisher",
            "properties": {
                "elasticNoUrl": falsetrue,
                "elasticUrlelasticHost": "http://localhost:9200/_bulk",
                "elasticIndexelasticPort": "index2"9200,
                "authTypeelasticIndex": "noneindex1",
                "transformTypeauthType": "JSONnone",
                "transformType": "JSON",
                "transformFile": "${component.home}/config/groovy/transform.groovy",
                "processClear": truefalse,
                "deleteOnClearidleConnectionTimeout": true3600000,
                "connectionTimeoutmaxConnections": 15000100,
                "readTimeoutmaxConnectionsPerRoute": 1500010,
                "maxRetriesconnectionTimeout": 115000,
                "retryDelaysocketTimeout": 15000,
                "maxRetryDelayuseThrottling": 200000false,
                "retryDelayMultipliermaxRetries": 13,
                "maxResultsretryWaitTime": 10000005000,
                "batchSize": 50,
                "simultaneousBatches": 5,
                "batchTimeout": 5000,
                "maxResults": 1000000,
                "pageSize": 10000,
                "idField": "hits._id",
                "urlField": "hits.fields.url",
                "timestampField": "hits.fields.submitTime",
                "debug": false
            },
            "id": "f91f8807-5081-450f-a210-d1f5db349f5d"
        }
    }
}


Step 3. Add ElasticSearch Rule to the onPublish event

Resquest

Saga_json
Title/aspire/_api/workflows/9bdf3efb-c266-46ac-ab59-eb8eda87d9e9/onPublish/reference
{
    "parentId": "",
    "orderId": 0,
    "ruleId": "f91f8807-5081-450f-a210-d1f5db349f5d",
    "enabled": true
}


Response

Saga_json
{
    "workflow": {
        "id": "9bdf3efb-c266-46ac-ab59-eb8eda87d9e9",
        "type": "connector",
        "description": "Test Workflow",
        "checksum": "f8bd68229db9ac05fb6bd98a2ef37bef696b4e6ece676a7b2dcbd093014fae14",
        "event": {
            "id": "onPublish",
            "itemId": "c80071e0-5b87-4578-b17c-63c7d7cea336",
            "rule": {
                "type": "application",
                "_type": "publisher",
                "description": "ES Publisher",
                "config": "com.accenture.aspire:aspire-elasticsearch-publisher-source",
                "appType": "elasticsearch-publisher",
                "appName": "Elasticsearch_Publisher",
                "properties": {
                    "elasticNoUrl": true,
                    "elasticHost": "localhost",
                    "elasticPort": 9200,
                    "elasticIndex": "index1",
                    "authType": "none",
                    "transformType": "JSON",
                    "transformFile": "${component.home}/config/groovy/transform.groovy",
                    "processClear": false,
                    "idleConnectionTimeout": 3600000,
                    "maxConnections": 100,
                    "maxConnectionsPerRoute": 10,
                    "connectionTimeout": 15000,
                    "socketTimeout": 15000,
                    "useThrottling": false,
                    "maxRetries": 3,
                    "retryWaitTime": 5000,
                    "batchSize": 50,
                    "simultaneousBatches": 5,
                    "batchTimeout": 5000,
                    "maxResults": 1000000,
                    "pageSize": 10000,
                    "idField": "hits._id",
                    "urlField": "hits.fields.url",
                    "timestampField": "hits.fields.submitTime",
                    "debug": false
                },
                "id": "64416781f91f8807-71585081-4c39450f-a862a210-f075bfc61444"d1f5db349f5d"
            }
        }
    }
}