rossengeorgiev / aprs-python

📡 Python module for working with APRS
http://aprs-python.readthedocs.io/en/latest/
GNU General Public License v2.0
114 stars 37 forks source link

Added support for consumer kwargs #56

Open hemna opened 3 years ago

hemna commented 3 years ago

I have an app that uses consumer, but needs to pass in some kwargs for consumption at consumer function call time. This patch adds kwargs support to consumer creation as well as passing those kwargs at consumer callback time.

rossengeorgiev commented 3 years ago

Hi @hemna, thanks for the PR. Not sure what the exact use case for this would be, but it doesn't make sense to me to be part of the package. Have you tried functools.partial ?

hemna commented 3 years ago

I am writing a gateway like app, which consumes messages from APRS-IS sends those parsed messages through some plugins and responds in separate threads. I need to pass along a queue object, so I can stuff messages to be sent in the queue, without using global variables. it makes sense to be allowed to pass various other params along with a consumer, to keep code clean without the need to use global vars everywhere.

This is the app I'm helping write: https://github.com/craigerl/aprsd