AdmRabbitConfig.java 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.persagy.bdtp.adm.config;
  2. import com.persagy.bdtp.adm.common.AdmMessageConst;
  3. import lombok.extern.slf4j.Slf4j;
  4. import org.springframework.amqp.core.Binding;
  5. import org.springframework.amqp.core.BindingBuilder;
  6. import org.springframework.amqp.core.Queue;
  7. import org.springframework.amqp.core.TopicExchange;
  8. import org.springframework.context.annotation.Bean;
  9. import org.springframework.context.annotation.Configuration;
  10. @Slf4j
  11. @Configuration
  12. public class AdmRabbitConfig {
  13. @Bean
  14. public TopicExchange m2dExchange() {
  15. return new TopicExchange(AdmMessageConst.M2D_EXCHANGE);
  16. }
  17. @Bean
  18. public Queue m2dQueue(){
  19. return new Queue(AdmMessageConst.M2D_QUEUE);
  20. }
  21. @Bean
  22. public Binding m2dBinding() {
  23. return BindingBuilder.bind(m2dQueue()).to(m2dExchange()).with(AdmMessageConst.M2D_ROUTING);
  24. }
  25. @Bean
  26. public TopicExchange admExchange() {
  27. return new TopicExchange(AdmMessageConst.ADM_EXCHANGE);
  28. }
  29. @Bean
  30. public Queue admD2mQueue(){
  31. return new Queue(AdmMessageConst.ADM_D2M_QUEUE);
  32. }
  33. @Bean
  34. public Binding admD2mBinding() {
  35. return BindingBuilder.bind(admD2mQueue()).to(admExchange()).with(AdmMessageConst.ADM_D2M_ROUTING);
  36. }
  37. }