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

Bug: RabbitMQ Tracing do not work, error internal must be false when creating amq.rabbitmq.trace exchange #948

Closed
hari01584 opened this issue Nov 14, 2023 · 1 comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@hari01584
Copy link

Describe the bug
RabbitMQ supports tracing, where a special exchange has to be binded where all the messages would be cloned over to, read more here, Using faststream, to create this special exchange has to creating itself with parameters
exch = RabbitExchange("amq.rabbitmq.trace", auto_delete=False, type=ExchangeType.TOPIC, durable=True, internal=True)

However the last part internal=True is not supported by dependent library implementation of pamqp, therefore when creating such an exchange, it throws this error of "internal must be false"

How to reproduce
Use this code

from faststream.rabbit import RabbitBroker, RabbitExchange, RabbitQueue, ExchangeType
from faststream import FastStream, Logger
broker = RabbitBroker("amqp://localhost:5672")
app = FastStream(broker)

exch = RabbitExchange("amq.rabbitmq.trace", auto_delete=False, type=ExchangeType.TOPIC, durable=True, internal=True)
logs_queue = RabbitQueue("logs", auto_delete=True, routing_key="#")

@broker.subscriber(queue=logs_queue, exchange=exch)
async def logs_handler(msg: dict, logger: Logger):
    logger.info("Received log message")
    logger.debug(msg)

@app.after_startup
async def test_logging():
    await broker.publish("Hello I should be logged!", "any-queue")

Expected behavior
A received message on logger stating Received log message, and then the msg string "Hello I should be logged!"

Observed behavior
Error when starting up the script, ValueError: internal must be False
``

Required Fix
I have even made changes to internal file to test if removing the Value() sanity check fixes the problem, to my surprise it does, for the same I created a PR at base repository but being inactive, I really don't think they will fix it, so for the time being I think FastStream should move away or use another fork of pamqp

@hari01584 hari01584 added the bug Something isn't working label Nov 14, 2023
@Lancetnik
Copy link
Member

@hari01584 thanks for the Issue and for PR to fix! https://github.com/gmr - as far as I can see, he sometimes goes to github, so he can merge it
Also, we can ping him by email/twitter to ask login and press "merge" btn 😄

@Lancetnik Lancetnik added the dependencies Pull requests that update a dependency file label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants