Giriş
Açıklaması şöyle.
Şöyle yaparız.
simple listener AyarlarıAçıklaması şöyle.
RabbitMq uses Advanced Message Queuing Protocol (AMQP).
In rabbitmq.conf the tcp port provided takes the port of the RabbitMq from your Java Application.
listeners.tcp.default = 5672
RabbitMQ Management console or the Web Admin uses the 15672 (default) port.
rabbitmq Ayarları
rabbitmq.host AlanıŞöyle yaparız.
spring.rabbitmq.host=localhost
spring.rabbitmq.port=15672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
rabbitmq.virtual-host Alanı
Şöyle yaparız
spring.rabbitmq.addresses={rabbitmq_host}:5672spring.rabbitmq.virtual-host: app_vhostspring.rabbitmq.username=usernamespring.rabbitmq.password=password
concurrency Alanları
ÖrnekŞöyle yaparız
spring.rabbitmq.listener.simple.concurrency=4spring.rabbitmq.listener.simple.max-concurrency=8
default-requeue-rejected Alanı
Örnek
Açıklaması şöyle. spring.rabbitmq.listener.simple.default-requeue-rejected alanının açıklaması şöyle
By default, all failed messages will be immediately requeued at the head of the target queue over and over again.To change this behavior we have two options:- Set the default-requeue-rejected option to false on the listener side – spring.rabbitmq.listener.simple.default-requeue-rejected=false- Throw an AmqpRejectAndDontRequeueException – this might be useful for messages that won’t make sense in the future, so they can be discarded.
retry Alanları
Örnek
Açıklaması şöyle.
Açıklaması şöyle.
Here we enable the Spring Boot RabbitMQ retry mechanism and specify some more additional parameters:Şöyle yaparız
Initial interval: The message should be retried after an interval of 3s.
Max-attempts: The message should be retried maximum of 6 times. After which it will be sent to dead letter Queue.
Max-interval: The maximum time interval between two retries should never exceed 10s.
Multiplier: The interval between second retry gets multiplied by 2. But this interval can never exceed the max-interval. So the retry interval values will be 3s, 6s, 10s, 10s, 10s. As 10 sec is the max interval specified.
spring:
rabbitmq:
listener:
simple:
retry:
enabled: true
initial-interval: 3s
max-attempts: 6
max-interval: 10s
multiplier: 2
server:
port: 8081
ÖrnekŞöyle yaparız
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
spring.rabbitmq.listener.simple.retry.enabled=true
// the first time will wait 5 seconds to try again
spring.rabbitmq.listener.simple.retry.initial-interval=5000
//will try a maximum of 10 times
spring.rabbitmq.listener.simple.retry.max-attempts=10
// the maximum interval between attempts is 5 minutes
spring.rabbitmq.listener.simple.retry.max-interval=300000
// multiplies the range by 3
spring.rabbitmq.listener.simple.retry.multiplier=3.0
Hiç yorum yok:
Yorum Gönder