Closed JarJak closed 7 years ago
looks like you have not registered the RetryProcessor
I have RetryProcessor registered.
processors_stack:
signal_handler: 'Swarrot\Processor\SignalHandler\SignalHandlerProcessor'
ack: 'Swarrot\Processor\Ack\AckProcessor'
max_messages: 'Swarrot\Processor\MaxMessages\MaxMessagesProcessor'
retry: 'Swarrot\Processor\Retry\RetryProcessor'
exception_catcher: 'Swarrot\Processor\ExceptionCatcher\ExceptionCatcherProcessor'
max_execution_time: 'Swarrot\Processor\MaxExecutionTime\MaxExecutionTimeProcessor'
Can you provide the output of this command app/console debug:config swarrot
?
Thanks.
swarrot:
provider: pecl
default_connection: rabbitmq
default_command: swarrot.command.base
connections:
rabbitmq:
[removed]
processors_stack:
signal_handler: Swarrot\Processor\SignalHandler\SignalHandlerProcessor
ack: Swarrot\Processor\Ack\AckProcessor
max_messages: Swarrot\Processor\MaxMessages\MaxMessagesProcessor
retry: Swarrot\Processor\Retry\RetryProcessor
exception_catcher: Swarrot\Processor\ExceptionCatcher\ExceptionCatcherProcessor
max_execution_time: Swarrot\Processor\MaxExecutionTime\MaxExecutionTimeProcessor
consumers:
inis:
processor: inis.processor.inis
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: retry_%%attempt%%
middleware_stack:
-
configurator: swarrot.processor.ack
first_arg_class: Swarrot\Processor\Ack\AckProcessor
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: retry_%%attempt%%
-
configurator: swarrot.processor.max_execution_time
first_arg_class: Swarrot\Processor\MaxExecutionTime\MaxExecutionTimeProcessor
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: retry_%%attempt%%
-
configurator: swarrot.processor.max_messages
first_arg_class: Swarrot\Processor\MaxMessages\MaxMessagesProcessor
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: retry_%%attempt%%
-
configurator: swarrot.processor.exception_catcher
first_arg_class: Swarrot\Processor\ExceptionCatcher\ExceptionCatcherProcessor
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: retry_%%attempt%%
-
configurator: swarrot.processor.retry
first_arg_class: Swarrot\Processor\Retry\RetryProcessor
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: retry_%%attempt%%
-
configurator: swarrot.processor.signal_handler
first_arg_class: Swarrot\Processor\SignalHandler\SignalHandlerProcessor
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: retry_%%attempt%%
command: null
connection: null
queue: null
messages_types:
inis_publisher:
exchange: inis_send
routing_key: inis_send
connection: null
extras: { }
logger: logger
enable_collector: true
Can you also copy your config please?
I don't understand why you have extra config at swarrot.consumers.inis.extras
, this configuration should be present only for the retry processor.
Just to be sure, can you also provide the output of this command: app/console debug:container --parameter=swarrot.command.base.class
?
Swarrot\SwarrotBundle\Command\SwarrotCommand
Extra config comes from my config.yml:
consumers:
inis:
processor: inis.processor.inis
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: 'retry_%%attempt%%'
Whole config looks like this:
swarrot:
provider: pecl # pecl or amqp_lib
default_connection: rabbitmq
default_command: swarrot.command.base # Swarrot\SwarrotBundle\Command\SwarrotCommand
connections:
rabbitmq:
host: "%rabbitmq_host%"
port: "%rabbitmq_port%"
login: "%rabbitmq_user%"
password: "%rabbitmq_password%"
vhost: '/'
processors_stack:
signal_handler: 'Swarrot\Processor\SignalHandler\SignalHandlerProcessor'
ack: 'Swarrot\Processor\Ack\AckProcessor'
max_messages: 'Swarrot\Processor\MaxMessages\MaxMessagesProcessor'
retry: 'Swarrot\Processor\Retry\RetryProcessor'
exception_catcher: 'Swarrot\Processor\ExceptionCatcher\ExceptionCatcherProcessor'
max_execution_time: 'Swarrot\Processor\MaxExecutionTime\MaxExecutionTimeProcessor'
consumers:
inis:
processor: inis.processor.inis
extras:
poll_interval: 500000
retry_attempts: 3
retry_key_pattern: 'retry_%%attempt%%'
messages_types:
inis_publisher:
exchange: inis_send
routing_key: inis_send
I have rewritten my config, now it works fine:
swarrot:
provider: pecl # pecl or amqp_lib
default_connection: rabbitmq
default_command: swarrot.command.base # Swarrot\SwarrotBundle\Command\SwarrotCommand
connections:
rabbitmq:
host: "%rabbitmq_host%"
port: "%rabbitmq_port%"
login: "%rabbitmq_user%"
password: "%rabbitmq_password%"
vhost: '/'
consumers:
inis:
processor: inis.processor.inis
extras:
poll_interval: 500000
middleware_stack:
- configurator: swarrot.processor.signal_handler
- configurator: swarrot.processor.max_messages
- configurator: swarrot.processor.exception_catcher
- configurator: swarrot.processor.max_execution_time
- configurator: swarrot.processor.ack
-
configurator: swarrot.processor.retry
extras:
retry_attempts: 3
retry_key_pattern: 'retry_%%attempt%%'
messages_types:
inis_publisher:
exchange: inis_send
routing_key: inis_send
I see consumers are 'invisible' as they jump in only when there are messages in queue, right? How can I run a consumer with more debug info, like when it consumes a message? Even with -vvv
it outputs nothing.
Yes, your config is way better. :)
Regarding log, it's probably linked to the config of your logger
service which is used by default.
Did you configured your logger to have the console output?
You should have something like this in your config_dev
file:
monolog:
handlers:
console:
type: console
This shows up when trying to run consumer with -R or --no-retry option:
[Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException]
The options "retry_attempts", "retry_key_pattern" do not exist. Defined options are: "connection", "max_execution_time", "max_messages", "poll_interval", "queue", "requeue_on_error", "signal_handler_signals".
Exception trace: () at /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php:685 Symfony\Component\OptionsResolver\OptionsResolver->resolve() at /var/www/symfony/vendor/swarrot/swarrot/src/Swarrot/Consumer.php:72 Swarrot\Consumer->consume() at /var/www/symfony/vendor/swarrot/swarrot-bundle/Command/SwarrotCommand.php:97