-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathworkflow_status_listner.py
More file actions
32 lines (25 loc) · 1.12 KB
/
Copy pathworkflow_status_listner.py
File metadata and controls
32 lines (25 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import asyncio
from conductor.asyncio_client.adapters import ApiClient
from conductor.asyncio_client.configuration.configuration import Configuration
from conductor.asyncio_client.orkes.orkes_clients import OrkesClients
from conductor.asyncio_client.workflow.conductor_workflow import AsyncConductorWorkflow
from conductor.asyncio_client.workflow.task.http_task import HttpTask
async def main():
api_config = Configuration()
api_config.apply_logging_config()
async with ApiClient(api_config) as api_client:
clients = OrkesClients(api_client=api_client, configuration=api_config)
workflow = AsyncConductorWorkflow(
name="workflow_status_listener_demo",
version=1,
executor=clients.get_workflow_executor(),
)
workflow >> HttpTask(
task_ref_name="http_ref",
http_input={"uri": "https://orkes-api-tester.orkesconductor.com/api"},
)
workflow.enable_status_listener("kafka:abcd")
await workflow.register(overwrite=True)
print(f"Registered {workflow.name}")
if __name__ == "__main__":
asyncio.run(main())