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.
Property Summary
- 
        $messageConsumed protectedint
- 
        $messageLimit protectedint
Method Summary
- 
          __construct() public
- 
          onPostConsume() publicThe method is called after SubscriptionConsumer::consume method exits. The consumption could be interrupted at this point. 
- 
          onPreConsume() publicExecuted at every new cycle before calling SubscriptionConsumer::consume method. The consumption could be interrupted at this step. 
- 
          shouldBeStopped() protectedCheck 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): voidThe method is called after SubscriptionConsumer::consume method exits. The consumption could be interrupted at this point.
Parameters
- 
                PostConsume$context
- The PostConsume context. 
Returns
voidonPreConsume() ¶ public
onPreConsume(PreConsume $context): voidExecuted at every new cycle before calling SubscriptionConsumer::consume method. The consumption could be interrupted at this step.
Parameters
- 
                PreConsume$context
- The PreConsume context. 
Returns
voidshouldBeStopped() ¶ protected
shouldBeStopped(Psr\Log\LoggerInterface $logger): boolCheck if the consumer should be stopped.
Parameters
- 
                Psr\Log\LoggerInterface$logger
- The logger where messages will be logged. 
Returns
bool