Skip to content
Snippets Groups Projects
Commit 8fc34949 authored by Nathan Hertz's avatar Nathan Hertz
Browse files

Added some comments

parent d2297066
No related branches found
No related tags found
No related merge requests found
......@@ -92,10 +92,17 @@ class Channel(Protocol[T]):
self.definition.declarations(self.CHANNEL)
def close(self):
"""
Close connection to RabbitMQ server, if it's open
"""
if self.CONNECTION:
self.CONNECTION.close()
def send(self, event: WorkflowEventSchema):
"""
Send a given WorkflowEvent to the exchange
:param event: The marshmallow schema of the event to be sent
"""
rendered = self.definition.schema.dump(event)
routing_key = self.definition.routing_key_for(event)
self.CHANNEL.basic_publish(routing_key=routing_key, body=rendered)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment