2d9a12ed344f95f6e9536855df01a8008d9f31e2.svn-base 868 B

123456789101112131415161718192021222324252627282930313233
  1. package org.jeecg.boot.starter.rabbitmq.exchange;
  2. import org.springframework.amqp.core.CustomExchange;
  3. import java.util.HashMap;
  4. import java.util.Map;
  5. /**
  6. * 延迟交换器构造器
  7. * @author: zyf
  8. * @date: 2019/3/8 13:31
  9. * @description:
  10. */
  11. public class DelayExchangeBuilder {
  12. /**
  13. * 默认延迟消息交换器
  14. */
  15. public final static String DEFAULT_DELAY_EXCHANGE = "jeecg.delayed.exchange";
  16. /**
  17. * 普通交换器
  18. */
  19. public final static String DELAY_EXCHANGE = "jeecg.direct.exchange";
  20. /**
  21. * 构建延迟消息交换器
  22. * @return
  23. */
  24. public static CustomExchange buildExchange() {
  25. Map<String, Object> args = new HashMap<String, Object>();
  26. args.put("x-delayed-type", "direct");
  27. return new CustomExchange(DEFAULT_DELAY_EXCHANGE, "x-delayed-message", true, false, args);
  28. }
  29. }