You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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

Adding a Publisher 


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

Step 1. Add a new Workflow

Request

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


Response

{
    "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"
                    }
                ]
            }
        }
    ]
}

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 a different sets of rules.


Step 2. Create an ElasticSearch Publisher Rule


Request

POST /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

{
    "workflow": {
        "id": "9bdf3efb-c266-46ac-ab59-eb8eda87d9e9",
        "type": "connector",
        "description": "Test Workflow",
        "checksum": "91a18e936fd07149bb29280a217df2be21f08f25f279884fa2aad88b92b53796",
        "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": "f91f8807-5081-450f-a210-d1f5db349f5d"
        }
    }
}


Step 3. Add ElasticSearch Rule to the onPublish event

Resquest

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


Response

{
    "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": "f91f8807-5081-450f-a210-d1f5db349f5d"
            }
        }
    }
}
  • No labels