@io-orkes/conductor-javascript 0.0.12 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,29 +19,42 @@ const client = new ConductorClient({
19
19
  });
20
20
 
21
21
  ```
22
- #### Using TLS
23
22
 
24
- The client uses `node-fetch` which supports node.js's [`httpsAgent` options](https://nodejs.org/api/https.html#new-agentoptions). For example:
23
+ ### Running Custom Workers
25
24
 
26
25
  ```typescript
27
- import {Agent} from "https"
28
- import {ConductorClient} from "@io-orkes/conductor-typescript";
29
26
 
30
- const agentOptions = {
31
- key: "<buffer>",
32
- cert: "<buffer>",
33
- ca: "<buffer>",
34
- servername: 'play.orkes.io',
35
- // ...
36
- }
27
+ import { OrkesApiConfig, orkesConductorClient, TaskRunner } from "@io-orkes/conductor-javascript";
37
28
 
38
- const client = new ConductorClient({
29
+ const clientPromise = orkesConductorClient({
39
30
  serverUrl: 'https://play.orkes.io/api',
40
- AGENT: new Agent(agentOptions)
41
31
  })
42
32
 
43
- const taskManager = new TaskManager(client, [ /* workers */ ])
44
- taskManager.startPolling()
33
+ const client = await clientPromise;
34
+
35
+ const taskManager = new TaskRunner({
36
+ taskResource: client.taskResource,
37
+ worker: {
38
+ taskDefName: "MyCustomWorker",
39
+ execute: async ({ inputData, taskId }) => {
40
+ return {
41
+ outputData: {
42
+ greeting: "Hello World",
43
+ },
44
+ status: "COMPLETED",
45
+ };
46
+ },
47
+ },
48
+ options: {
49
+ pollInterval: 10,
50
+ domain: undefined,
51
+ concurrency: 1,
52
+ workerID: "",
53
+ },
54
+ });
55
+
56
+ taskManager.startPolling();
57
+
45
58
  ```
46
59
 
47
60
  #### Connect to conductor using Orkes
@@ -53,7 +66,7 @@ taskManager.startPolling()
53
66
  * then edit and create Access Keys
54
67
  *
55
68
  */
56
- import { OrkesApiConfig, orkesConductorClient } from "@io-orkes/conductor-typescript";
69
+ import { OrkesApiConfig, orkesConductorClient } from "@io-orkes/conductor-javascript";
57
70
 
58
71
  const config: Partial<OrkesApiConfig> = {
59
72
  keyId: "XXX",