CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C Queue 2.x API

  • Project:
    • Queue
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 2.x
      • 2.x
      • 1.x

Namespaces

  • Cake\Queue
    • Command
    • Consumption
    • Job
    • Listener
    • Mailer
    • Model
    • Queue

Class LimitConsumedMessagesExtension

A consumer extension to limit the number of messages that are processed.

This is a place holder until the upstream enqueue project extension is merged.

Namespace: Cake\Queue\Consumption
See: https://github.com/php-enqueue/enqueue-dev/pull/1244

Property Summary

  • $messageConsumed protected
    int
  • $messageLimit protected
    int

Method Summary

  • __construct() public
  • onPostConsume() public

    The method is called after SubscriptionConsumer::consume method exits. The consumption could be interrupted at this point.

  • onPreConsume() public

    Executed at every new cycle before calling SubscriptionConsumer::consume method. The consumption could be interrupted at this step.

  • shouldBeStopped() protected

    Check if the consumer should be stopped.

Method Detail

__construct() ¶ public

__construct(int $messageLimit)
Parameters
int $messageLimit

The number of messages to process before exiting.

onPostConsume() ¶ public

onPostConsume(PostConsume $context): void

The method is called after SubscriptionConsumer::consume method exits. The consumption could be interrupted at this point.

Parameters
PostConsume $context

The PostConsume context.

Returns
void

onPreConsume() ¶ public

onPreConsume(PreConsume $context): void

Executed at every new cycle before calling SubscriptionConsumer::consume method. The consumption could be interrupted at this step.

Parameters
PreConsume $context

The PreConsume context.

Returns
void

shouldBeStopped() ¶ protected

shouldBeStopped(Psr\Log\LoggerInterface $logger): bool

Check if the consumer should be stopped.

Parameters
Psr\Log\LoggerInterface $logger

The logger where messages will be logged.

Returns
bool

Property Detail

$messageConsumed ¶ protected

Type
int

$messageLimit ¶ protected

Type
int
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs