-
Notifications
You must be signed in to change notification settings - Fork 53
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
api.consume against fedora endpoint hits permissions issue #171
Comments
Can you provide the code sample you're trying? |
starting from a fresh f30 container:
Then try to run the following: #!/usr/bin/python3
from fedora_messaging import api
def process_message(msg):
print(msg.topic)
def main():
# # Next, we need a queue to consume messages from. We can define
# # the queue and binding configurations in these dictionaries:
# queues = {
# 'demo': {
# 'durable': False, # Delete the queue on broker restart
# 'auto_delete': True, # Delete the queue when the client terminates
# 'exclusive': False, # Allow multiple simultaneous consumers
# 'arguments': {},
# },
# }
# binding = {
# 'exchange': 'amq.topic', # The AMQP exchange to bind our queue to
# 'queue': 'demo', # The unique name of our queue on the AMQP broker
# 'routing_keys': ['pungi.compose.status.change'] # The topics that should be delivered to the queue
# }
# Start consuming messages using our callback. This call will block until
# a KeyboardInterrupt is raised, or the process receives a SIGINT or SIGTERM
# signal.
api.consume(process_message)
if __name__ == '__main__':
main() |
And I assume there's no logging output (doesn't look like you're setting up logging). My guess is that the permissions on the Fedora broker are clashing with the way the synchronous API is declaring exchanges or queues (the async and sync code are currently completely different). Is there are reason you cannot use the CLI? It sets up logging, signal handlers, etc for you so you don't have to do that yourself. Obviously we need to fix |
yeah didn't realize it wouldn't log by default. I thought it would since those settings are in the conf file.
ok I set up logging and now I get more info:
I think that might be a good discussion for a separate ticket. I'll open one soon and edit this comment to link back to it. EDIT: Here is the issue I just opened: #173 |
Cool. That does look like a permissions issue. We should make the synchronous API behave the same as the async API in this respect. |
The CLI (by way of Twisted) does not declare exchanges when consuming, it assumes the exchange already exists. This seems reasonable, consumers will still learn about configuration mistakes during the binding process. This makes it impossible to consume from the public vhost in Fedora, so this is a quick bugfix release while the transition to Crochet and Twisted are worked on and polished. Fixes: fedora-infra#171 Signed-off-by: Jeremy Cline <jcline@redhat.com>
The CLI (by way of Twisted) does not declare exchanges when consuming, it assumes the exchange already exists. This seems reasonable, consumers will still learn about configuration mistakes during the binding process. This makes it impossible to consume from the public vhost in Fedora, so this is a quick bugfix release while the transition to Crochet and Twisted are worked on and polished. Fixes: #171 Signed-off-by: Jeremy Cline <jcline@redhat.com>
The CLI (by way of Twisted) does not declare exchanges when consuming, it assumes the exchange already exists. This seems reasonable, consumers will still learn about configuration mistakes during the binding process. This makes it impossible to consume from the public vhost in Fedora, so this is a quick bugfix release while the transition to Crochet and Twisted are worked on and polished. Fixes: #171 Signed-off-by: Jeremy Cline <jcline@redhat.com>
Can I get a very simple
api.consume
example that works with fedora's endpoint? I can get the cli to work with the default callback using the docs here but I can't seem to get a simpleapi.consume()
call working (not using twisted_consume) withfedora-messaging-1.6.0-1.fc30.noarch
python3-fedora-messaging-1.6.0-1.fc30.noarch
The text was updated successfully, but these errors were encountered: