Giter VIP home page Giter VIP logo

jobqueue.rabbitmq's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jobqueue.rabbitmq's Issues

Support for RabbitMQ Streams

Since RabbitMQ 3.9 there is a new Queue Type called Streams: https://www.rabbitmq.com/streams.html

Adding support for Streams is actually quite simple, since the Protocol remains AMQP. This package already works with Streams with one exception: The consumer does not track it's offset in a stream.

This has two downsides:

  • A new consumer that connects to an existing stream will not start from the beginning, but will only receive new messages
  • A consumer that already consumed a stream will not continue at the same offset after a restart

RabbitMQ Streams support server-side offset tracking: https://blog.rabbitmq.com/posts/2021/09/rabbitmq-streams-offset-tracking/

Unfortunately I did not find a way to save the offset using php-amqplib, as the IOStream is not exposed to the outside. Since the blog post for offset recommends to also store the offset client-side we can simply create a persistent flow cache to store the offset of our consumers.

Support for Dead Letter Exchanges

It should be possible to configure the RabbitQueue to use a DLX https://www.rabbitmq.com/dlx.html instead of the current requeueing mechanism.

Proposal: Add a configuration option to enable usage of a DLX.

If a DLX is in use, the release function could look like this:

public function release(string $messageId, array $options = []): void
{
    $this->channel->basic_nack($messageId);
}

This way, the message would not have to be requeued using the ReleaseService. Once that works, the x-death message header can be used to track the retry count of the message header.

Background:
I publish the jobs to a fanout exchange so multiple workers receive the same message. When a message fails, it is published to that exchange again, leading to duplicate messages in all worker queues.

RabbitQueue throws AMQPTimeoutException after timeout with `--exit-after`

The job:work command of the Flowpack.JobQueue.Common package supports the parameter --exit-after which allows to set a time limit after which the command exists.

If during that time no message is published to the RabbitMQ queue, an AMQPTimeoutException is thrown, setting the exit code of the job:work process to 1.

Expected behavior:
If no message is found in time, the RabbitQueue should return null as stated in the PHPDoc of the QueueInterface (See here).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.