mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Flow management API + various flow management commands trustgraph-cli/scripts/tg-delete-flow-class trustgraph-cli/scripts/tg-get-flow-class trustgraph-cli/scripts/tg-put-flow-class trustgraph-cli/scripts/tg-show-flow-classes trustgraph-cli/scripts/tg-show-flows trustgraph-cli/scripts/tg-start-flow trustgraph-cli/scripts/tg-stop-flow
25 lines
635 B
Python
25 lines
635 B
Python
|
|
from . producer import Producer
|
|
from . metrics import ProducerMetrics
|
|
from . spec import Spec
|
|
|
|
class ProducerSpec(Spec):
|
|
def __init__(self, name, schema):
|
|
self.name = name
|
|
self.schema = schema
|
|
|
|
def add(self, flow, processor, definition):
|
|
|
|
producer_metrics = ProducerMetrics(
|
|
processor = flow.id, flow = flow.name, name = self.name
|
|
)
|
|
|
|
producer = Producer(
|
|
client = processor.pulsar_client,
|
|
topic = definition[self.name],
|
|
schema = self.schema,
|
|
metrics = producer_metrics,
|
|
)
|
|
|
|
flow.producer[self.name] = producer
|
|
|