All Projects → nameko → nameko-amqp-retry

nameko / nameko-amqp-retry

Licence: other
No description or website provided.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to nameko-amqp-retry

micro-service-practice
OpenStack+Docker+RestAPI+OAuth/HMAC+RabbitMQ/ZMQ+OpenResty/HAProxy/Nginx/APIGateway+Bootstrap/AngularJS+Ansible+K8S/Mesos/Marathon构建/探索微服务最佳实践。
Stars: ✭ 25 (+19.05%)
Mutual labels:  nameko
tomodachi
💻 Microservice library / framework using Python's asyncio event loop with full support for HTTP + WebSockets, AWS SNS+SQS, RabbitMQ / AMQP, middleware, etc. Extendable for GraphQL, protobuf, gRPC, among other technologies.
Stars: ✭ 170 (+709.52%)
Mutual labels:  amqp
homebrew-extensions
🍻 Homebrew tap for PHP extensions
Stars: ✭ 264 (+1157.14%)
Mutual labels:  amqp
rejected
rejected is a consumer framework for RabbitMQ
Stars: ✭ 56 (+166.67%)
Mutual labels:  amqp
azure-event-hubs-java
☁️ Java client library for Azure Event Hubs
Stars: ✭ 49 (+133.33%)
Mutual labels:  amqp
postman
Reverse proxy for async microservice communication
Stars: ✭ 30 (+42.86%)
Mutual labels:  amqp
peniot
PENIOT: Penetration Testing Tool for IoT
Stars: ✭ 164 (+680.95%)
Mutual labels:  amqp
paStash
pastaʃ'ʃ = Spaghetti I/O Event Data Processing, Interpolation, Correlation and beyond 🍝
Stars: ✭ 89 (+323.81%)
Mutual labels:  amqp
azure-event-hubs-go
Golang client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
Stars: ✭ 80 (+280.95%)
Mutual labels:  amqp
go-mq
Declare AMQP entities like queues, producers, and consumers in a declarative way. Can be used to work with RabbitMQ.
Stars: ✭ 76 (+261.9%)
Mutual labels:  amqp
roger-rabbit
A module that makes the process of consuming and publishing messages in message brokers easier
Stars: ✭ 12 (-42.86%)
Mutual labels:  amqp
amqp-client.js
AMQP 0-9-1 TypeScript client both for Node.js and browsers (using WebSocket)
Stars: ✭ 106 (+404.76%)
Mutual labels:  amqp
moleculer-java
Java implementation of the Moleculer microservices framework
Stars: ✭ 39 (+85.71%)
Mutual labels:  amqp
azure-service-bus-go
Golang library for Azure Service Bus -- https://aka.ms/azsb
Stars: ✭ 67 (+219.05%)
Mutual labels:  amqp
cottontail
Capture all RabbitMQ messages being sent through a broker.
Stars: ✭ 23 (+9.52%)
Mutual labels:  amqp
SpringBoot-Examples
Spring boot 2.X version tutorial,Integrate various middleware to facilitate quick reference and use
Stars: ✭ 23 (+9.52%)
Mutual labels:  amqp
nestjs-rmq
A custom library for NestJS microservice. It allows you to use RabbitMQ or AMQP.
Stars: ✭ 182 (+766.67%)
Mutual labels:  amqp
snatch
An Erlang Lightweight XMPP Client library
Stars: ✭ 16 (-23.81%)
Mutual labels:  amqp
Carrot
Carrot is a .NET lightweight library that provides a couple of facilities over RabbitMQ.
Stars: ✭ 14 (-33.33%)
Mutual labels:  amqp
nest-rabbit-tasks
nest-rabbit-worker is a TaskQueue based upon RabbitMQ for NestJS
Stars: ✭ 29 (+38.1%)
Mutual labels:  amqp

nameko-amqp-retry

Extension for nameko that allows the built-in AMQP entrypoints to schedule a later retry via redelivery of a message.

RabbitMQ 3.5.4 or later is required.

Installation

Install the library from PyPI:

pip install nameko-amqp-retry

Usage

This library subclasses nameko's built-in entrypoints. Use these subclasses in your service definition, and then raise :class:`nameko_amqp_retry.Backoff` inside an entrypoint you wish to retry later:

from nameko_amqp_retry import Backoff
from nameko_amqp_retry.rpc import rpc

class Service:
    name = "service"

    @rpc
    def calculate(self):
        """ Calculate something, or schedule a retry if not ready yet.
        """
        if not_ready_yet:
            raise Backoff()

        return 42

The caller will see the final result, or a :class:`Backoff.Expired` exception if more than the allowed number of retries were made:

>>> n.rpc.service.calculate()
... # blocks for some time
>>> 42
>>> n.rpc.service.calculate()
Traceback (most recent call last):
  ...
nameko.exceptions.RemoteError: Expired Backoff aborted after ...

The retry schedule is controlled by attributes on the Backoff class. You should override them in a subclass to control the behaviour. For example:

Fixed schedule:

class RegularBackoff(Backoff):
    """ Retries every 1000ms until limit
    """
    schedule = (1000,)  # ms

No limit:

class InfiniteBackoff(Backoff):
    """ Retries forever
    """
    limit = 0

Custom schedule:

class ImpatientBackoff(Backoff):
    """ Retries after 100, then 200, then 500 milliseconds
    """
    schedule = (100, 200, 500)  # ms

Dynamic schedule:

class DynamicBackoff(Backoff):
    """ Calculates schedule dynamically
    """
    @classmethod
    def get_next_schedule_item(cls, index):
        ...

Alternatively, an entrypoint can be decorated with the entrypoint_retry decorator, to automatically retry the method if it raises certain exceptions:

from nameko_amqp_retry import entrypoint_retry
from nameko_amqp_retry.rpc import rpc

class Service:
    name = "service"

    @rpc
    @entrypoint_retry(retry_for=ValueError)
    def calculate(self):
        """ Calculate something, or schedule a retry if not ready yet.
        """
        if not_ready_yet:
            raise ValueError()

        return 42

    @rpc
    @entrypoint_retry(
        retry_for=(TypeError, ValueError),
        limit=5,
        schedule=(500, 600, 700, 800, 900),
    )
    def do_something(self):
        """ Calculate something else, or schedule a retry if not ready yet.
        """
        if type_not_ready_yet:
            raise TypeError()

        if value_not_ready_yet:
            raise ValueError()

        return 24

See docs/examples for more.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].