trustgraph/trustgraph-flow/trustgraph/gateway/dispatch/document_load.py
cybermaggedon a4e2f67cb1
Feature/translator classes (#414)
Pull the JSON/Pulsar message translation into a separate module, will be useful for other comms channels
2025-06-20 16:59:55 +01:00

23 lines
574 B
Python

import base64
from ... schema import Document, Metadata
from ... messaging import TranslatorRegistry
from . sender import ServiceSender
class DocumentLoad(ServiceSender):
def __init__(self, pulsar_client, queue):
super(DocumentLoad, self).__init__(
pulsar_client = pulsar_client,
queue = queue,
schema = Document,
)
self.translator = TranslatorRegistry.get_request_translator("document")
def to_request(self, body):
print("Document received")
return self.translator.to_pulsar(body)