components-contrib icon indicating copy to clipboard operation
components-contrib copied to clipboard

Allow Dapr to bind an exchange with a queue in RabbitMQ

Open pyjads opened this issue 1 year ago • 1 comments

Describe the feature

"In the current RabbitMQ pub/sub model, the topic functions as the exchange, but it doesn't automatically create and bind the queue to the exchange. This step must be performed manually. If the exchange isn't bound to any queue, the message gets lost. Although the exchange and queue binding occur automatically during subscription, there's no provision to define an exchange to a queue while publishing the event. The exchange is created, but the queue isn't automatically associated."

Below is the python code for subscribing to a queue.

# The topic 'some-topic-in' serves as the exchange and is bound to 'some-queue-name', even if neither the topic nor the queue currently exist.
@app.subscribe(pubsub_name=PUBSUBNAME, topic='some-topic0-in', metadata={"queueName": "some-queue-name"})
def process_events(event):
    logger.info('Event Received', raw_event=event)
# Although the exchange with the topic name 'some-topic-out' is automatically created, it doesn't bind to any queue by default. This binding is a manual step that must be performed to ensure proper functioning.
with DaprClient() as d:
    message = d.publish_event(pubsub_name=PUBSUBNAME,
                            topic_name='some-topic-out,
                            data=some_data,
                            metadata={"queueName": "other-queue-name"}, # this does not work
                            data_content_type='application/json')

Release Note

RELEASE NOTE:

pyjads avatar Jan 16 '24 09:01 pyjads

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 15 '24 09:02 github-actions[bot]

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

github-actions[bot] avatar Feb 22 '24 09:02 github-actions[bot]