Настройка Spring Cloud Rabbit

Сделал рабочую конфигурацию для реббита, суть которой перебрасывать из основной очереди в ожидающую (dead-letter) с заданным ttl и по его истечении забрасывать обратно:

@Configuration
@AllArgsConstructor
public class RabbitConfig {

public static final String QUEUE_MESSAGES = "demo-messages-queue";
public static final String QUEUE_MESSAGES_DLQ = QUEUE_MESSAGES + ".dlq";
public static final String EXCHANGE_MESSAGES = "demo-messages-exchange";

@Bean
public DirectExchange exchange() {
    return new DirectExchange(EXCHANGE_MESSAGES);
}

@Bean
public Queue mainQueue() {
    return QueueBuilder
            .durable(QUEUE_MESSAGES)
            .withArgument("x-dead-letter-exchange", EXCHANGE_MESSAGES)
            .withArgument("x-dead-letter-routing-key", QUEUE_MESSAGES_DLQ)
            .build();
}

@Bean
public Queue deadLetterQueue() {
    return QueueBuilder
            .durable(QUEUE_MESSAGES_DLQ)
            .withArgument("x-dead-letter-exchange", EXCHANGE_MESSAGES)
            .withArgument("x-dead-letter-routing-key", QUEUE_MESSAGES)
            .withArgument("x-message-ttl", 30000)
            .build();
}

@Bean
public Binding mainBinding() {
    return BindingBuilder
            .bind(mainQueue())
            .to(exchange())
            .with(QUEUE_MESSAGES);
}

@Bean
public Binding deadLetterBinding() {
    return BindingBuilder
            .bind(deadLetterQueue())
            .to(exchange())
            .with(QUEUE_MESSAGES_DLQ);
 }
}

не могу повторить такую же схему для spring cloud stream в application.yml

spring:
  cloud:
    stream:
      binders:
        rabbitAll:
          type: rabbit
          environment:
            spring:
              rabbitmq:
                host: localhost
                port: 5672
                virtual-host: test
                username: guest
                password: guest
      rabbit:
        bindings:
          demo-messages-push-input:
            consumer:
              bindingRoutingKey: demo-messages-queue
              routingKeyExpression: '''demo-messages-queue'''
              bindQueue: true
              autoBindDlq: true
              dlqTtl: 30000
      bindings:
        demo-messages-push-input:
          destination: demo-messages-queue
          binder: rabbitAll
        demo-messages-push-output:
          destination: demo-messages-queue
          binder: rabbitAll

буду благодарен за помощь и рабочий пример в application.yml


Ответы (0 шт):