Saravanan666/pypi-org huggingface dataset:
Package: rabbitmq2psql-as-json
rabbitmq2psql-as-jsonrabbitmq2psql-as-json is ready to use, basic asynchronous RabbitMQ consumer job library for PostgreSQL. It stops when queue is empty, so it can be useful for cron jobs, unit tests, CI/CD environments and production environments has slow datastream.InstallationYou can install this library easily with pip.pip install rabbitmq2psql-as-jsonUsageAs a libraryimportosimportasyncioimportloggingfromrabbitmq2psql_as_jsonimportconsumeif__name__=='__main__':logger=logging.getLogger("rabbitmq2psql-as-json")logger.setLevel(os.environ.get('LOG_LEVEL',"DEBUG"))handler=logging.StreamHandler()handler.setFormatter(logging.Formatter(os.environ.get('LOG_FORMAT',"%(asctime)s[%(levelname)s]%(name)s:%(message)s")))logger.addHandler(handler)config={"mq_host":os.environ.get('MQ_HOST'),"mq_port":int(os.environ.get('MQ_PORT')),"mq_vhost":os.environ.get('MQ_VHOST'),"mq_user":os.environ.get('MQ_USER'),"mq_pass":os.environ.get('MQ_PASS'),"mq_queue":os.environ.get('MQ_QUEUE'),"mq_exchange":os.environ.get('MQ_EXCHANGE'),"mq_routing_key":os.environ.get('MQ_ROUTING_KEY'),"db_host":os.environ.get('DB_HOST'),"db_port":int(os.environ.get('DB_PORT')),"db_user":os.environ.get('DB_USER'),"db_pass":os.environ.get('DB_PASS'),"db_database":os.environ.get('DB_DATABASE')}sql_template="""insert into logs (body) values (%s);"""loop=asyncio.get_event_loop()loop.run_until_complete(consume(loop=loop,consumer_pool_size=10,sql_template=sql_template,config=config))loop.close()This library usesaio_pikaandaiopgpackages.StandaloneYou can also call this library as standalone consumer job command.  Just set required environment variables and runrabbitmq2psql-as-json. This usecase perfectly fits when you need run it on cronjobs or kubernetes jobs.Required environment variables:MQ_HOSTMQ_PORT (optional)MQ_VHOSTMQ_USERMQ_PASSMQ_QUEUEMQ_QUEUE_DURABLE (optional, default value: True)MQ_EXCHANGE (Exchange for dead letter queue, aka records with error queue)MQ_ROUTING_KEY (Routing key for dead letter queue)DB_HOSTDB_PORT (optional)DB_USERDB_PASSDB_DATABASESQL_TEMPLATE (DB Insert query template. Ex:insert into logs (body) values (%s);)CONSUMER_POOL_SIZE (optional, default value: 10)LOG_LEVEL (Logging level. See:Python logging module docs)Example Kubernetes job:You can see it tokube.yaml
Package: rabbitmq2solr
rabbitmq2solrrabbitmq2solr is a simple utility that consumes messages from a RabbitMQ queue and index to Solr.
Messages are expected to be JSON documents that send to Solr update endpoint. If indexing fails, the message is sent to a dead letter queue for later use.
The messages that sent to DLQ, delivered as persistent messages. This job will exit when the queue is empty.Environment VariablesMQ_HOST: The hostname of the RabbitMQ server.MQ_PORT: The port of the RabbitMQ server. Optional. Default: 5672.MQ_USER: The username to use when connecting to the RabbitMQ server.MQ_PASS: The password to use when connecting to the RabbitMQ server.MQ_VHOST: The virtual host to use when connecting to the RabbitMQ server.MQ_QUEUE: The name of the queue to consume messages from.MQ_QUEUE_DURABLE: Whether or not the queue should be durable. Optional. Default: True.MQ_DLQ_EXCHANGE: The exchange of the dead letter queue to use. If index errors occur, messages will be moved to this queue.MQ_DLQ_ROUTING_KEY: The routing key of the dead letter queue to use.SOLR_BASE_URL: The base url of the Solr server. Example:http://localhost:8983/solr(without trailing slash).SOLR_COLLECTION: The name of the Solr collection to index to. Optional. Default: Routing key of message.LOG_LEVEL: The log level to use. Optional. Default: DEBUG.CONSUMER_POOL_SIZE: The number of concurrent consumers to use.
Package: rabbitmq-admin
rabbitmq-adminThis project is a python wrapper around the RabbitMQ Management HTTP API.Example>>> from rabbitmq_admin import AdminAPI
>>> api = AdminAPI(url='http://192.168.99.100:15672', auth=('guest', 'guest'))
>>> api.create_vhost('second_vhost')
>>> api.create_user('second_user', 'password')
>>> api.create_user_permission('second_user', 'second_vhost')
>>> api.list_permission()
[{'configure': '.*',
  'read': '.*',
  'user': 'guest',
  'vhost': '/',
  'write': '.*'},
 {'configure': '.*',
  'read': '.*',
  'user': 'second_user',
  'vhost': 'second_vhost',
  'write': '.*'}]Unsupported Management API endpointsThis is a list of unsupported API endpoints. Please do not make issues for
these, but pull requests implementing them are welcome./api/exchanges/vhost/name/bindings/source [GET]/api/exchanges/vhost/name/bindings/destination [GET]/api/exchanges/vhost/name/publish [POST]/api/queues/vhost/name/bindings [GET]/api/queues/vhost/name/contents [DELETE]/api/queues/vhost/name/actions [POST]/api/queues/vhost/name/get [POST]/api/bindings/vhost/e/exchange/q/queue [GET, POST]/api/bindings/vhost/e/exchange/q/queue/props [GET, DELETE]/api/bindings/vhost/e/source/e/destination [GET, POST]/api/bindings/vhost/e/source/e/destination/props [GET, DELETE]/api/parameters [GET]/api/parameters/component [GET]/api/parameters/component/vhost [GET]/api/parameters/component/vhost/name [GET, PUT, DELETE]InstallationTo install the latest release, type:pip install rabbitmq-adminTo install the latest code directly from source, type:pip install git+git://github.com/ambitioninc/rabbitmq-admin.gitDocumentationFull documentation is available athttp://rabbitmq-admin.readthedocs.orgLicenseMIT License (see LICENSE)
Package: rabbitmq-alphamoon
rabbitqm-alphamoonpika-based RabbitMQ connector with built in JSON serialization/deserializationFeaturespublishing:publish(message)getting number of messages in the queue:message_countconsuming (forever, i.e. with a callback function):consume_forever(callback_fun)setting up a dead letter exchange (number of retries passed to the consumer in theinfoargument)See code examples in the "Examples" section.Requirementspika==1.2.0InstallationYou can install "rabbitmq-alphamoon" viapipfromPyPI:$ pip install rabbitmq-alphamoonExamplesInitializationimportpikafromrabbitmq_alphamoonimportRabbitMQConnectorparameters=pika.ConnectionParameters(host=rabbitmq_host,port=rabbitmq_port,credentials=pika.PlainCredentials(username=rabbitmq_username,password=rabbitmq_password,),)queue=RabbitMQConnector(connection_parameters=parameters,queue=queue_name,)Publishingmessage={'foo':'bar'}withqueue.open_connection():queue.publish(message)Getting a number of the messages in the queuemessage_count=queue.message_countConsumingdefprocess_message(message,info):print(message)print(info)withqueue.open_connection():queue.consume_forever(process_message_callback=process_message)Short form for one-time usage of connectorIf you do not need to reuse the connector, you can initialize and open connection without assignment of connector to a variable before callingopen_connectioncontext manager. This may come in handy especially in case of consuming, where connector is usually used only to callconsume_foreverfunction.withRabbitMQConnector(connection_parameters=parameters,queue=queue_name,).open_connection()asqueue:queue.consume_forever(process_message_callback=process_message)ContributingContributions are very welcome. Tests can be run withtox, please ensure the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theMITlicense, "rabbitmq-alphamoon" is free and open source softwareIssuesIf you encounter any problems, please email us atdev@alphamoon.ai, along with a detailed description.
Package: rabbitmq-api-client
Python library to interact with the RabbitMQ Admin API.DescriptionThis package provides a simple http client to manage Rabbitmq admin api.The package is based onhttpx.It also providespydanticmodels for request.Installationpipinstallrabbitmq-api-clientUsagefromrabbitmq_api_client.clientimportRabbitMQClientfromrabbitmq_api_client.schemasimportCreateUser# Initialize client with url and credentialsclient=RabbitMQClient('http://localhost:15672','user','password')# Define a user with pydantic modeluser=CreateUser(username='test',password='test',tags='administrator')# Create userclient.create_user(user)# Get user by nameuser_dict=client.get_user('test')
Package: rabbitmq-asynqp
rabbitmq_asynqpPython package for using rabbitmq using asynqpUsage:Both producer and consumer:rabbitmq_asynqp provides you ability to use rabbitmq messaging asynchronous non-blocking way by the use of asynqp and
asyncio with just few lines of code. Typical usage will be like this:from rabbitmq_asynqp.messaging import Messaging

      rabbitmq_config = dict(host="localhost", port=5672, username="guest", password="guest")
      queue_config = dict(
              exchange="sample_exchange",
              queues=["sample_queue1"],
              routing_key="sample.routing_key",
              exchange_type="direct",
              error_messaging=dict(
                  exchange="error_exchange",
                  queues=["error_queue"],
                  routing_key="error.key",
                  exchange_type="direct",
              )
          )

      queue_settings = {'reconnect_backoff_secs': 1, 'connection_check_polling_secs': 5} # Not compulsory

      def consumer_func(message: dict):
          # define your consumer func
          pass

      messaging = Messaging(rabbitmq_config: dict, queue_config: dict, consumer_func)use this messaging object globally for sending message like this:messaging.send_message(message) # To send single message
      messaging.send_messages(messages) # To send multiple bulk messagesOnly Consumer:To run only consumer use a separate thread or process and do following:from rabbitmq_asynqp.messaging import Consumer

      rabbitmq_config = dict(host="localhost", port=5672, username="guest", password="guest")
      queue = "queue_name"
      queue_settings = {'reconnect_backoff_secs': 1, 'connection_check_polling_secs': 5} # Not compulsory

      def consumer_func(message:dict):
          # define your consumer func
          pass

      consumer = Consumer(rabbitmq_config, queue, consumer_func, queue_settings)
      consumer()Only Producer:To run producer only for message production:from rabbitmq_asynqp.messaging import Producer

      rabbitmq_config = dict(host="localhost", port=5672, username="guest", password="guest")
      queue_config = dict(
              exchange="sample_exchange",
              queues=["sample_queue1"],
              routing_key="sample.routing_key",
              exchange_type="direct",
              error_messaging=dict(
                  exchange="error_exchange",
                  queues=["error_queue"],
                  routing_key="error.key",
                  exchange_type="direct",
              )
          )

      producer = Producer(rabbitmq_config, queue_config)
      producer.send_msg(message)Message sent must be dict.For any queries, mail toakshay2agarwal@gmail.com
Package: rabbitmq-broker
RabbitMQ BrokerНе зависящий от фреймворков пакет для общения между микросервисами. Пакет предоставляет интерфейс для работы с брокером сообщенийRabbitMQи базовый класс цепочки обработчиков.Пакет реализует паттерн цепочка обязанностей в синхронном и асинхронном виде.КонфигурацияПеременная окруженияОписаниеЗначение по умолчаниюMICROSERVICE_SETTINGSПуть к модулю настроек проекта отно-"settings"-сительно корня проекта. (Разделениечерез точку: module1.module2.settings)ИспользованиеЦепочка обработчиковДля использования цепочки обязанностей нужно импортировать базовый класс звена и унаследоваться от него. Необходимо установить параметрrequest_type. Обязательно должен быть переопределен абстрактный методBaseChain.get_response_body(self, data):from rmq_broker.chains.base import BaseChain


class LoginChain(BaseChain):
    request_type = "login"

    def get_response_body(self, data: dict) -> dict:
        ...Также, можно унаследоваться от асинхронного варианта реализации:from rmq_broker.async_chains.base import BaseChain


class LoginChain(BaseChain):
    request_type = "login"

    async def get_response_body(self, data: dict) -> dict:
        ...Метод должен содержать логику обработки запроса и вызывать родительский методBaseChain.form_response(data, body, code, message)class LoginChain(BaseChain):
    request_type = "login"

    async def get_response_body(self, data):
        # Обработка запроса
        ...
        return super().form_response(data, response, status.HTTP_200_OK, "OK")data: Изначальное сообщение.body: Обработанное тело запроса.code: HTTP код ответа.message: Сообщение к ответу.МоделиДоработанные pydantic модели - могут быть использованы как для валидации,
так и для генерации сообщения.Валидация сообщения происходит так же, как и в обычной pydantic модели:ProcessedMessage(**message_dict)Для генерации сообщения необходимо создать объект модели, не передавая аргументы
при инициализации, и вызвать метод generate. В аргументы метода generate можно
передавать любой из ключей структуры сообщения, в том числе code, message,
dst и src. Вложенная структура(header, status) формируется сама:>>> ProcessedMessage().generate(dst="destination", code=201, request_type="creation")
>>> {"header": {"src": "", "dst": "destination"}, "request_type": "creation"...}RPC брокерЗапуск прослушки и автоматического ответа на сообщения.
В файлеconsumer.py:from app.chains import your_chain
from rmq_broker.queues.rabbitmq import AsyncRabbitMessageQueue

async def broker_runner():
    async with AsyncRabbitMessageQueue() as provider:
        await provider.register_tasks("rpc_queue_name", your_chain.handle)
        await provider.consume()


asyncio.run(broker_runner())Далее:python3 consumer.py
Package: rabbitmq-cli
Custom RabbitMQ CLIIntroductionThis Command Line Tools (CLI) allows to interact with a RabbitMQ Broker instance througth HTTP RESTFul API and offers one case for continous publishing througth AMQPS.API Ref:https://pulse.mozilla.org/api/index.htmlInstallInstall using At the command prompt, typepippip install rabbitmqcliAdd onYou can use an AWS Secrets Manager secret to store connection credentials. For this must define values for variablesaws.regionandaws.secret-name, this secret name can contains an "environment" key to change in runtime, this key must be named "env". And aditionally, enable this feature changingdefault.credentials-from-secretvariable value toTrue.Simple secret nameyour-secret-nameSecret name composed by envyour-secret-{env}-nameFor the secret structures is required the following two keys:usernameandpassword. For example:{... "username": "guest", "password": "guest" ...}Configuration fileYou can create a config file, or CLI will create it. This file must be named and located like this:~/.rabbitmq-cli/configSectionsVariablesDefault valueDescriptiondefaulthostnamelocalhost.vhost/.usernameguest.passwordguest.exchangedomainEvents.queuesubsEvents.credentials-from-secretFalse.httpport15671.sslTrue.amqpport5671.sslTrue.awsregionus-east-1.secret-nameyour-{env}-secret-name.
Package: rabbitmq-consume
rabbitmq_consumeprojectTherabbitmq_consumeproject contains both therabbitmq_consumepackage that provides a simpleConsumerclass for processing messages from a RabbitMQ queue,rmq-consumethat is an executable that can be used to run that class andrmq-injectthat cna be used to inject messages into the originating RabbitMQ queue.rmq-consumeexecutableMore details about thermq-consumeexecutable can be found using its help optionrmq-consume -hThe typical usage is the following:rmq-consume <queue> <module>[.<class>]where<queue>is that name of the RabbitMQ queue from which the XML messages should be consumed and<class>is a python class in the<module>python module that will actually process the messages. If the `. is omitted from the comand line, the class whose name matches the module name will be used.The "consumption" class need to derived from theConsumption.Consumptionas shown in the following trivial example.from Consumption import Consumption

class TrivialConsumption(Consumption):

    def __init__(self,
                 properties,
                 body,
                 redelivered):

    def consume(self):
        passMost real implementations will save theproperties,bodyandredeliveredarguments for use in theconsumemethod.rmq-injectexecutableMore details about thermq-injectexecutable can be found using its help optionrmq-inject -hThe typical usage is the following:rmq-inject -l <queue>This injects a "stop listening message" into the queue and when the consumer encounters this it will stop listening for an more messages and shut down.
Package: rabbitmq-decorator
RabbitMQ DecoratorWork in progressEasily send and receive messages to and from RabbitMQ message broker.Installationpipinstallrabbitmq-decoratorUsageOptional:exportRABBITMQ_HOST=localhostexportRABBITMQ_PORT=5672exportRABBITMQ_USERNAME=usernameexportRABBITMQ_PASSWORD=passwordExample:importasynciofromtypingimportDict,Anyfromrabbitmq_decoratorimportRabbitMQHandler,RabbitMQConsumer,RabbitMQProducer,RabbitMQMessage,Exchangeevent_loop=asyncio.get_event_loop()# If environment variables was setrabbit_handler=RabbitMQHandler(event_loop=event_loop)# Or if environment variables wasn't setrabbit_handler=RabbitMQHandler(event_loop=event_loop,rabbitmq_host="localhost",rabbitmq_port=5672,rabbitmq_username="username",rabbitmq_password="password")@rabbit_handlerclassSomeClass:EXCHANGE=Exchange("test_exchange",durable=True)_producer:RabbitMQProducer=rabbit_handler.get_new_producer(EXCHANGE)defsome_unrelated_function(self):pass@RabbitMQConsumer(EXCHANGE)asyncdefconsumer_1(self,body:Dict[str,Any]):print("I'm getting all the messages on test_exchange")self._producer.publish(RabbitMQMessage(routing_key="response.consumer1",body={"status":"Success"}))@RabbitMQConsumer(EXCHANGE,route="*.*.*")asyncdefconsumer_2(self,body:Dict[str,Any]):print("I'm getting only the messages on test_exchange with *.*.* as routing-key ")response_exchange=Exchange("response_exchanges",durable=True)self._producer.publish(exchange=response_exchange,message=RabbitMQMessage(routing_key="response.consumer2",body={"status":"Success"}))# ================ main ================asyncdefmain():"""do something"""if__name__=='__main__':some_class=SomeClass()rabbit_handler.start(some_class)event_loop.run_until_complete(main())rabbit_handler.stop_consume(some_class)
Package: rabbitmq-metrics-to-graphite
rabbitmq-metrics-to-graphiteRead datas from RABBITMQ and send metrics to GraphiteHow to installUsingpippip install rabbitmq-metrics-to-graphiteFrom git rpogit clone https://github.com/orachide/rabbitmq-metrics-to-graphite.git
cd rabbitmq-metrics-to-graphite
python setup.py build
python setup.py installConfigurationExample configuration file:{"graphite_servers":[{"host":"localhost","port":2003,"prefix":"mycustomprefix.rabbitmq"}],"rabbitmq_clusters":[{"cluster_name":"DC1","host":"localhost","port":15672,"username":"guest","password":"guest","vhost":"/"},{"cluster_name":"DC2","host":"localhost","port":15672,"username":"guest","password":"guest","vhost":"/"}]}Execute programrabbitmq-metrics-to-graphite/path/to/configfile# Verboserabbitmq-metrics-to-graphite/path/to/configfile-vGrafana dashboardUsinggrafana-rabbitmq-metrics.jsonwe can obtain the following dashboard
Package: rabbitmq-munin
A simple plugin for munin to monitor the number of messages in a queue.By default monitors the celery queue for the user ‘guest’InstallationThe easiest way to install the code is to usepip.Install the newest version fromPyPI.:pip install rabbitmq-muninInstall the latest development version:pip install git+https://github.com/freyes/rabbitmq_munin.git#egg=rabbitmq-muninThe other option is to download and uncompress the code manually and execute the
includedsetup.pyscript for installation:./setup.py installTo make the plugin available to the munin-node you can run the following commands:ln -s $(which rabbitmq_munin) /etc/munin/plugins/Once munin can run the plugin, you can configure it as any other munin plugin
(in /etc/munin/plugin-conf.d/munin-node) and the config will look like this:[rabbitmq_munin]
env.username guest
env.password guest
env.server localhost:15672
env.vhost /
env.queue celeryThe config above is using the default values of the plugin, your environment may require different values.DependenciesPython packages:pyrabbitRabbitmq plugins:Management Plugin, you can install it with the following command:rabbitmq-plugins enable rabbitmq_management
Package: rabbitmq-pdfparser
rabbitmq_pdfparserrabbitmq_pdfparser is asynchronous job library that consume RabbitMQ for PDF urls and publish pdf text back to RabbitMQ. It stops when queue is empty.InstallationYou can install this library easily with pip.pip install rabbitmq-pdfparserUsageData must send to source queue should this format:{"id": "foo", "url": "http://example.com/foo/bar.pdf"}As a libraryimportosimportasynciofromrabbitmq_pdfparserimportconsumeif__name__=='__main__':logger=logging.getLogger("rabbitmq_pdfparser")logger.setLevel(os.environ.get('LOG_LEVEL',"DEBUG"))handler=logging.StreamHandler()handler.setFormatter(logging.Formatter(os.environ.get('LOG_FORMAT',"%(asctime)s[%(levelname)s]%(name)s:%(message)s")))logger.addHandler(handler)config={"mq_host":os.environ.get('MQ_HOST'),"mq_port":int(os.environ.get('MQ_PORT')),"mq_vhost":os.environ.get('MQ_VHOST'),"mq_user":os.environ.get('MQ_USER'),"mq_pass":os.environ.get('MQ_PASS'),"mq_source_queue":os.environ.get('MQ_SOURCE_QUEUE'),"mq_target_exchange":os.environ.get('MQ_TARGET_EXCHANGE'),"mq_target_routing_key":os.environ.get('MQ_TARGET_ROUTING_KEY')}loop=asyncio.get_event_loop()loop.run_until_complete(consume(loop=loop,consumer_pool_size=10,config=config))loop.close()This library usesPyPDF2,aio_pikaandaiohttppackages.StandaloneYou can also call this library as standalone PDF parser job.  Just set required environment variables and runrabbitmq_pdfparser. This usecase perfectly fits when you need run it on cronjobs or kubernetes jobs.Required environment variables:MQ_HOSTMQ_PORT (optional)MQ_VHOSTMQ_USERMQ_PASSMQ_SOURCE_QUEUE (Queue that job consume urls)MQ_TARGET_EXCHANGE (Exchange that job publish texts)MQ_TARGET_ROUTING_KEY (Routing key that job publish texts)MQ_QUEUE_DURABLE (optional, default value: True)CONSUMER_POOL_SIZE (optional, default value: 10)LOG_LEVEL (Logging level. See:Python logging module docs)Example Kubernetes job:You can see it tokube.yaml
Package: rabbitmq-request-response
rabbitmq-request-response介绍把lycium包对rabbitmq的封装独立出来，同时加上兼容金蝶的mq中的rabbitmq 功能。要使用金蝶mq，要配置环境变量 _jindie_mq=1软件架构软件架构说明安装教程xxxxxxxxxxxx使用说明xxxxxxxxxxxx参与贡献Fork 本仓库新建 Feat_xxx 分支提交代码新建 Pull Request特技使用 Readme_XXX.md 来支持不同的语言，例如 Readme_en.md, Readme_zh.mdGitee 官方博客blog.gitee.com你可以https://gitee.com/explore这个地址来了解 Gitee 上的优秀开源项目GVP全称是 Gitee 最有价值开源项目，是综合评定出的优秀开源项目Gitee 官方提供的使用手册https://gitee.com/helpGitee 封面人物是一档用来展示 Gitee 会员风采的栏目https://gitee.com/gitee-stars/