Skip to content

Commit

Permalink
convert producer message to json
Browse files Browse the repository at this point in the history
  • Loading branch information
dspeck1 committed Oct 1, 2024
1 parent ebbda39 commit 7efcdbf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def fan_out_msg(
data
):
logging.info(f"sending msg {data}")
await producer.send_and_wait(fan_out_topic, data)
await producer.send_and_wait(fan_out_topic, json.dumps(data))


async def main() -> None:
Expand Down Expand Up @@ -227,6 +227,9 @@ async def main() -> None:
logging.info("Message does not have an instrument. Assuming "
"it's not an observation.")
continue

'''
# Temporary disable so we can see older messages for testing.
# efdStamp is visit publication, in seconds since 1970-01-01 UTC
if next_visit_message_initial["message"]["private_efdStamp"]:
Expand All @@ -240,7 +243,7 @@ async def main() -> None:
continue
else:
logging.warning("Message does not have private_efdStamp, can't determine age.")

'''
next_visit_message_updated = NextVisitModel(
salIndex=next_visit_message_initial["message"]["salIndex"],
scriptSalIndex=next_visit_message_initial["message"][
Expand Down Expand Up @@ -369,8 +372,6 @@ async def main() -> None:
await producer.start()
logging.info ("started kafka producer")

#for fan_out_message in fan_out_message_list:

for fan_out_message in fan_out_message_list:

task = asyncio.create_task(
Expand Down

0 comments on commit 7efcdbf

Please sign in to comment.