RabbitConfiguration.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package cn.gygxzc.envir.bus;
  2. import cn.gygxzc.tina.cloud.bus.constant.QueueName;
  3. import cn.gygxzc.tina.cloud.bus.framweork.receiver.LoggerReceiver;
  4. import cn.gygxzc.tina.cloud.bus.messager.sender.IMessagerSender;
  5. import cn.gygxzc.tina.cloud.bus.messager.sender.impl.MessagerSender;
  6. import org.springframework.amqp.core.AmqpTemplate;
  7. import org.springframework.amqp.core.Queue;
  8. import org.springframework.context.annotation.Bean;
  9. import org.springframework.context.annotation.ComponentScan;
  10. import org.springframework.context.annotation.Configuration;
  11. /**
  12. * Created by niantuo on 2018/9/29.
  13. * rabbit配置.
  14. * 暂时对这个不了解,暂时使用自动配置结果
  15. * 注意分包方式。
  16. * 只要导入该包,即可自动配置,无需再用注解。
  17. */
  18. @Configuration
  19. @ComponentScan
  20. public class RabbitConfiguration {
  21. /***
  22. * 这个如果需要使用,改成自己项目的名称
  23. * @return 消息队列
  24. */
  25. @Bean
  26. public Queue frameworkQueue() {
  27. return new Queue(QueueName.Framework);
  28. }
  29. @Bean
  30. public IMessagerSender messagerSender(AmqpTemplate template){
  31. return new MessagerSender(template);
  32. }
  33. // @Bean
  34. // public Queue logQueue(){
  35. // return new Queue(QueueName.LOG);
  36. // }
  37. //
  38. //
  39. // @Bean
  40. // public LoggerReceiver loggerReceiver(){
  41. // return new LoggerReceiver();
  42. // }
  43. }