| | |
| | | package cc.mrbird.febs.rabbit; |
| | | |
| | | import org.springframework.amqp.core.Binding; |
| | | import org.springframework.amqp.core.BindingBuilder; |
| | | import org.springframework.amqp.core.DirectExchange; |
| | | import org.springframework.amqp.core.Queue; |
| | | import org.springframework.amqp.core.*; |
| | | import org.springframework.amqp.rabbit.connection.ConnectionFactory; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.config.ConfigurableBeanFactory; |
| | |
| | | public Binding distribProfitBind() { |
| | | return BindingBuilder.bind(distribProfitQueue()).to(distribProfitExchange()).with(QueueEnum.DISTRIB_PROFIT.getRoute()); |
| | | } |
| | | |
| | | // === 用户购买奖励 start === |
| | | @Bean |
| | | public DirectExchange userBuyRewardExchange() { |
| | | return new DirectExchange(QueueEnum.USER_BUY_REWARD.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue userBuyRewardQueue() { |
| | | return new Queue(QueueEnum.USER_BUY_REWARD.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding userBuyRewardBind() { |
| | | return BindingBuilder.bind(userBuyRewardQueue()).to(userBuyRewardExchange()).with(QueueEnum.USER_BUY_REWARD.getRoute()); |
| | | } |
| | | // === 用户购买奖励 end === |
| | | |
| | | |
| | | // === 延时产出 start === |
| | | @Bean |
| | | public DirectExchange delayExchangeTtl() { |
| | | return new DirectExchange(QueueEnum.GFA_ZY_TIME_TTL.getExchange()); |
| | | } |
| | | @Bean |
| | | public Binding orderDelayBindTtl() { |
| | | return BindingBuilder.bind(orderDelayQueueTtl()).to(delayExchangeTtl()).with(QueueEnum.GFA_ZY_TIME_TTL.getRoute()); |
| | | } |
| | | @Bean |
| | | public Queue orderDelayQueueTtl() { |
| | | return QueueBuilder.durable(QueueEnum.GFA_ZY_TIME_TTL.getQueue()) |
| | | //到期后转发的交换机 |
| | | .withArgument("x-dead-letter-exchange", QueueEnum.GFA_ZY_TIME.getExchange()) |
| | | //到期后转发的路由键 |
| | | .withArgument("x-dead-letter-routing-key", QueueEnum.GFA_ZY_TIME.getRoute()) |
| | | .build(); |
| | | } |
| | | @Bean |
| | | public DirectExchange orderDelayExchange() { |
| | | return new DirectExchange(QueueEnum.GFA_ZY_TIME.getExchange()); |
| | | } |
| | | @Bean |
| | | public Queue orderDelayQueue() { |
| | | return new Queue(QueueEnum.GFA_ZY_TIME.getQueue()); |
| | | } |
| | | @Bean |
| | | public Binding orderDelayBind() { |
| | | return BindingBuilder.bind(orderDelayQueue()).to(orderDelayExchange()).with(QueueEnum.GFA_ZY_TIME.getRoute()); |
| | | } |
| | | // === 延时产出 end === |
| | | |
| | | |
| | | // === 延时产出 start === |
| | | @Bean |
| | | public DirectExchange delayExchangeTtlFlow() { |
| | | return new DirectExchange(QueueEnum.GFA_ZY_TIME_TTL_FLOW.getExchange()); |
| | | } |
| | | @Bean |
| | | public Binding orderDelayBindTtlFlow() { |
| | | return BindingBuilder.bind(orderDelayQueueTtlFlow()).to(delayExchangeTtlFlow()).with(QueueEnum.GFA_ZY_TIME_TTL_FLOW.getRoute()); |
| | | } |
| | | @Bean |
| | | public Queue orderDelayQueueTtlFlow() { |
| | | return QueueBuilder.durable(QueueEnum.GFA_ZY_TIME_TTL_FLOW.getQueue()) |
| | | //到期后转发的交换机 |
| | | .withArgument("x-dead-letter-exchange", QueueEnum.GFA_ZY_TIME_FLOW.getExchange()) |
| | | //到期后转发的路由键 |
| | | .withArgument("x-dead-letter-routing-key", QueueEnum.GFA_ZY_TIME_FLOW.getRoute()) |
| | | .build(); |
| | | } |
| | | @Bean |
| | | public DirectExchange orderDelayExchangeFlow() { |
| | | return new DirectExchange(QueueEnum.GFA_ZY_TIME_FLOW.getExchange()); |
| | | } |
| | | @Bean |
| | | public Queue orderDelayQueueFlow() { |
| | | return new Queue(QueueEnum.GFA_ZY_TIME_FLOW.getQueue()); |
| | | } |
| | | @Bean |
| | | public Binding orderDelayBindFlow() { |
| | | return BindingBuilder.bind(orderDelayQueueFlow()).to(orderDelayExchangeFlow()).with(QueueEnum.GFA_ZY_TIME_FLOW.getRoute()); |
| | | } |
| | | // === 延时产出 end === |
| | | |
| | | |
| | | |
| | | //滑点 start |
| | | @Bean |
| | | public DirectExchange gfaZhiYaHuaDianExchange() { |
| | | return new DirectExchange(QueueEnum.GFA_ZY_HUA_DIAN.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue gfaZhiYaHuaDianQueue() { |
| | | return new Queue(QueueEnum.GFA_ZY_HUA_DIAN.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding gfaZhiYaHuaDianBind() { |
| | | return BindingBuilder.bind(gfaZhiYaHuaDianQueue()).to(gfaZhiYaHuaDianExchange()).with(QueueEnum.GFA_ZY_HUA_DIAN.getRoute()); |
| | | } |
| | | //滑点 end |
| | | } |