Comments (16)
Hello @thijsterlouw,
Thank you for reporting your use case. This issue really shows that we didn't solve the problem correctly. For instance we should probably pass the channel instance to ack this specific message.
Problem is: this channel is currently overflooded by incomming message and won't send any message to the server :/
from aioamqp.
Hi @dzen , thanks for your quick reply. I've created a little bit of Python code to test the idea, and it seems wrapping my code in Objects would be a good way to go forward. That way I can pass my context around in the objects and have the object just create a reply channel to ack the messages (like #39 suggested)
import asyncio
def tester():
print('tester')
x = MyClass(1)
y = MyClass(2)
print('created classes')
print(asyncio.iscoroutinefunction(x.f))
val_x = yield from x.f()
val_y = yield from y.f()
print('x: {0}, y: {1}'.format(val_x, val_y))
class MyClass:
def __init__(self, i):
self.i = i
@asyncio.coroutine
def f(self):
return 'hello world {0}'.format(self.i)
if __name__ == '__main__':
print('main')
loop = asyncio.get_event_loop()
loop.run_until_complete(tester())
loop.run_forever()
loop.stop()
from aioamqp.
I have everything setup nicely. One instance of a class for each server, which wraps the callback and provides the necessary context. Acking now works great (even when using the same channel). So for me: problem solved :)
Initially I had a small application bug where I didn't ack invalid events, but that was easily fixed.
from aioamqp.
Hi @thijsterlouw,
I tried a little thing: the callback is converted as a Task, and the channel instance is passed to the callback. This way it's possible to ack the message from the coroutine called when a message is received. The only problem is that we will create a Task for each received message. The eventloop could be very BIG if your coroutine is slow.
I've got a publisher which publish at 20k msg/s. My computer goes very slow :(
from aioamqp.
from aioamqp.
@mpaolini hello. Any thought on this PR / Issue ?
from aioamqp.
@dzen will have a look later this weekend
from aioamqp.
Hello @thijsterlouw,
Did you tried this branch against your code ?
beware, the definition of your callback should be like:
@asyncio.coroutine
def callback(channel, body, envelope, properties):
# stuff
yield from channel.basic_client_ack(envelope.delivery_tag)
from aioamqp.
Hi
I tried out that branch and I have a question. How to perform BASIC_ACK, because basic_client_ack and basic_server_ack both did not work?
from aioamqp.
do you have any problem using basic_client_ack ? what's the error generated ?
from aioamqp.
Yes I have, it does not work. No error, no ack, task still in queue.
from aioamqp.
Can you paste some code ?
from aioamqp.
@dzen sorry for missleading you, I forgot about yield from
and when use yield from ch.basic_client_ask...
it is working now. sorry again.
from aioamqp.
No problem. For now I didn't wrote enough documentation. It's planned
from aioamqp.
hello @thijsterlouw . Did you try the latest release ? (0.5.1, since we got a packaging problem) ?
from aioamqp.
@thijsterlouw you now have the channel handle to ack a message correctly.
from aioamqp.
Related Issues (20)
- rabbitmqctl list_queues via aioamqp HOT 1
- Cleanup login method HOT 1
- channel.basic_consume API docs HOT 2
- AttributeError: 'Channel' object has no attribute 'basic_ack' HOT 1
- Message Properties: 'type' property HOT 7
- If value passed to 'x-message-ttl' is greater than or equal 128, then invalid Negative value is sending to server HOT 3
- Channel publish requires a lock
- Python3.8
- Init login method default value 'AMQPLAIN' HOT 2
- Testing with pamqp 3.0 HOT 6
- Is there any usage example or tutorial documents HOT 1
- Publishing to a non-existing exchange does not raise errors HOT 1
- Republish the pypi docs to pick up Python3.9 HOT 3
- Support server-generated queue names
- AmazonMQ issues on `queue_declare` HOT 1
- Ready for release on pypi? HOT 1
- Channel.basic_server_ack doesn't respect `multiple` flag HOT 3
- Unable to subscribe to a queue with wildcard (asterisk) HOT 3
- using tag uri scheme for queue and exchange names are not longer possible HOT 1
- No longer handling CancelledError on protocol.run
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aioamqp.