Skip to content

Commit

Permalink
Merge pull request #3 from ucraft-com/back-654bbe538299f06a13e5f5dbcf…
Browse files Browse the repository at this point in the history
…d622e356d9bd7a

change producer message type as string and convert it
  • Loading branch information
edgar-a77 authored Feb 5, 2024
2 parents 7e5f444 + 0058844 commit 01ac55d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion actions/kafka_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def run(self, topic, message, key=None, headers=None, partitioner=None):
'partitioner': str(partitioner),
}
producer = Producer(conf)
producer.produce(topic, value=json.dumps(message).encode('utf-8'), key=key, headers=headers)
json_msg = json.loads(message)
producer.produce(topic, value=json.dumps(json_msg).encode('utf-8'), key=key, headers=headers)
producer.flush()

except Exception as e:
Expand Down
3 changes: 2 additions & 1 deletion actions/kafka_producer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ parameters:
topic:
type: string
message:
type: object
type: string
description: Set json or array as string
key:
type: string
headers:
Expand Down

0 comments on commit 01ac55d

Please sign in to comment.