I am developing an application that will handle large stream of videos/images and process them.
I found nameko is quite easy to use and it is quite good so far.
But, I would like to further decrease the message processing time, and I have been reading threads related to this. What I am still trying to understand is to make the message non-persistent and therefore can make RabbitMQ runs faster.
I understand that the deliver_mode has been exposed in nameko library. But, I do not understand how to set this parameter when I use an RPC call by using ClusterRpcProxy.
I tried several things, but it did not achieve what I wanted (i.e. to make the message non-persistent).
Some of the things that I tried but not successful:
rpc = ClusterRpcProxy(config, delivery_mode = 1)
from kombu import Exchange
Exchange.delivery_mode = 1
In the current stable release it’s not possible to configured the standalone proxy in this way.
However, the standalone proxy has been significantly refactored by the work in https://github.com/nameko/nameko/pull/542. These changes are about to hit PyPI as a pre-release version.
Using the pre-release version you will be able to do exactly as in your first attempt:
rpc = ClusterRpcProxy(config, delivery_mode=1)
We would be grateful for some feedback if you start to use this pre-release version!
Ah, interesting. I had forgotten about this use-case.
In the refactored code you almost get the “dynamic” proxy behaviour for free. I say almost because the RpcProxy requires that you provide a target service name and pre-populates it on the object that is returned. If that argument became optional, you could use the normal RpcProxy “dynamically” by simply not providing a target service name when declaring it.
I think this is a sufficiently common request that we should make that change. I’ll try and get that done and cut a new pre-release.
If you need something in the mean time, take a look at overriding the constructor and get_dependency methods of the RpcProxy
I will wait for the new pre-release to enable me initialize RpcProxy by doing “proxy = RpcProxy()” in a service class.
In the mean time, I will look the constructor and get_dependency that you suggested. I suppose I only need to find the replacement of ServiceProxy in the __call__ function, is this correct?