Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for temporary queue with UUID queue name #26

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ..component_base import ComponentBase
from ...common.message import Message
from ...common.messaging.messaging_builder import MessagingServiceBuilder
import uuid

# TBD - at the moment, there is no connection sharing supported. It should be possible
# to share a connection between multiple components and even flows. The changes
Expand Down Expand Up @@ -138,3 +139,6 @@ def get_acknowledgement_callback(self):

def start(self):
pass

def generate_uuid(self):
return str(uuid.uuid4())
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
},
{
"name": "broker_queue_name",
"required": True,
"description": "Queue name for broker",
"required": False,
"description": "Queue name for broker, if not provided it will use a temporary queue",
},
{
"name": "temporary_queue",
"required": False,
"description": "Whether to create a temporary queue that will be deleted after disconnection",
"description": "Whether to create a temporary queue that will be deleted after disconnection, defaulted to True if broker_queue_name is not provided",
"default": False,
},
{
Expand Down Expand Up @@ -91,7 +91,12 @@ def __init__(self, **kwargs):
super().__init__(info, **kwargs)
self.need_acknowledgement = True
self.temporary_queue = self.get_config("temporary_queue", False)
self.broker_properties["temporary_queue"] = self.temporary_queue
# If broker_queue_name is not provided, use temporary queue
if not self.get_config("broker_queue_name"):
self.temporary_queue = True
self.broker_properties["temporary_queue"] = True
# Generating a UUID for the queue name
self.broker_properties["queue_name"] = self.generate_uuid()
self.connect()

def invoke(self, message, data):
Expand Down
Loading