当前位置: 首页 > news >正文

在哪里可以找到做网站的公司百度平台推广的营销收费模式

在哪里可以找到做网站的公司,百度平台推广的营销收费模式,北京展览展示设计有限公司,如何把网站做在百度小程序内文章目录 发布订阅Fanout 交换机Direct 交换机Topic 交换机通配符规则 发布订阅 在这里插入图片描述 Fanout 交换机 Fanout 交换机会将收到的消息路由到每一个跟其绑定的queue上。 我们做一个交换机,两个队列,两个消费者分别连接两个队列。 定义交换…

文章目录

    • 发布订阅
      • Fanout 交换机
      • Direct 交换机
      • Topic 交换机
        • 通配符规则

发布订阅

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

Fanout 交换机

Fanout 交换机会将收到的消息路由到每一个跟其绑定的queue上。

我们做一个交换机,两个队列,两个消费者分别连接两个队列。

定义交换机,队列,交换机与队列之间的连接:

/*** fanout交换机配置*/
@Configuration
public class FanoutConfig {/*** 声明交换机,设置名称* @return*/@Beanpublic FanoutExchange fanoutExchange() {return new FanoutExchange("lpy.fanout");}/*** 队列1* @return*/@Beanpublic Queue fanoutQueue1() {return new Queue("fanout.queue1");}/*** 绑定交换机和队列1*/@Beanpublic Binding bindingQueue1(Queue fanoutQueue1, FanoutExchange fanoutExchange) {return BindingBuilder.bind(fanoutQueue1).to(fanoutExchange);}/*** 队列1* @return*/@Beanpublic Queue fanoutQueue2() {return new Queue("fanout.queue2");}/*** 绑定交换机和队列2*/@Beanpublic Binding bindingQueue2(Queue fanoutQueue2, FanoutExchange fanoutExchange) {return BindingBuilder.bind(fanoutQueue2).to(fanoutExchange);}}

定义监听接口:

    @RabbitListener(queues = "fanout.queue1")public void listenFanoutQueue1(String msg) {System.out.println("消费者1接收到Fanout消息:" + msg);}@RabbitListener(queues = "fanout.queue2")public void listenFanoutQueue2(String msg) {System.out.println("消费者2接收到Fanout消息:" + msg);}

发送消息:

    @Testpublic void testFanoutExchange() {// 队列名称String exchangeName = "lpy.fanout";// 消息String message = "hello fanout!";rabbitTemplate.convertAndSend(exchangeName, "", message);}

启动,运行:

在这里插入图片描述

可以看到,我们发的一个消息,被两个消费者消费了,说明实现成功,交换机把消息路由到了每个队列。

Direct 交换机

不同的消息路由到不同的队列,根据key路由建。

在这里插入图片描述

下面来实现一下,基于注解来声明队列和交换机,这样比较方便,直接定义再接口上。

    @RabbitListener(bindings = @QueueBinding(value = @Queue(name = "direct.queue1"),exchange = @Exchange(name = "lpy.direct", type = ExchangeTypes.DIRECT),key = {"red", "blue"}))public void listenDirectQueue1(String msg){System.out.println("消费者1接收到direct.queue1的消息:" + msg);}@RabbitListener(bindings = @QueueBinding(value = @Queue(name = "direct.queue2"),exchange = @Exchange(name = "lpy.direct", type = ExchangeTypes.DIRECT),key = {"red", "yellow"}))public void listenDirectQueue2(String msg){System.out.println("消费者2接收到direct.queue2的消息:" + msg);}

启动测试:

  1. key 为 red
 @Testpublic void testSendDirectExchange() {// 交换机名称String exchangeName = "lpy.direct";// 消息String message = "hello direct red";// 发送消息rabbitTemplate.convertAndSend(exchangeName, "red", message);// 消息String message2 = "hello direct blue";// 发送消息rabbitTemplate.convertAndSend(exchangeName, "blue", message2);// 消息String message3 = "hello direct yellow";// 发送消息rabbitTemplate.convertAndSend(exchangeName, "yellow", message3);}

在这里插入图片描述

可以看到,根据key来进行了路由。

Topic 交换机

Topic 交换机与Direct相似,只不过使用了key可以使用通配符。

RoutingKey一般由一个或多个单词组成,用“.”分割。

通配符规则

# 匹配一个或多个词

* 匹配一个词

例如:

举例:

a.#   可以匹配a.b.c、a.b等a.*   只可以匹配a.b

现在来实验一下吧:

和Direct同样的写法,只是key改为通配符的:

    @RabbitListener(bindings = @QueueBinding(value = @Queue(name = "topic.queue1"),exchange = @Exchange(name = "lpy.topic", type = ExchangeTypes.TOPIC),key = "a.*"))public void listenTopicQueue1(String msg){System.out.println("消费者接收到topic.queue1的消息:" + msg);}@RabbitListener(bindings = @QueueBinding(value = @Queue(name = "topic.queue2"),exchange = @Exchange(name = "lpy.topic", type = ExchangeTypes.TOPIC),key = "a.#"))public void listenTopicQueue2(String msg){System.out.println("消费者接收到topic.queue2的消息:" + msg);}

发送消息:

    @Testpublic void testSendTopicExchange() {// 交换机名称String exchangeName = "lpy.topic";// 消息String message = "hello topic a.b";// 发送消息rabbitTemplate.convertAndSend(exchangeName, "a.b", message);// 消息String message1 = "hello topic a.b.c";// 发送消息rabbitTemplate.convertAndSend(exchangeName, "a.b.c", message1);}

运行结果:

在这里插入图片描述

可以看到#确实可以匹配多个单词,而*只能匹配一个。


文章转载自:
http://dinncosarape.tqpr.cn
http://dinncomong.tqpr.cn
http://dinncophytol.tqpr.cn
http://dinncoconenose.tqpr.cn
http://dinncomoggy.tqpr.cn
http://dinncopetticoat.tqpr.cn
http://dinncoandrostenedione.tqpr.cn
http://dinncogoldfish.tqpr.cn
http://dinncononelectrolyte.tqpr.cn
http://dinncosuctorial.tqpr.cn
http://dinncolurch.tqpr.cn
http://dinncoafghani.tqpr.cn
http://dinncomangalore.tqpr.cn
http://dinncocoalite.tqpr.cn
http://dinncogdynia.tqpr.cn
http://dinncoattestation.tqpr.cn
http://dinncofireworks.tqpr.cn
http://dinncoemotionalize.tqpr.cn
http://dinncogopi.tqpr.cn
http://dinncopanchromatic.tqpr.cn
http://dinncoisobathytherm.tqpr.cn
http://dinncounlikely.tqpr.cn
http://dinncowigwag.tqpr.cn
http://dinncorecruiter.tqpr.cn
http://dinncomultifamily.tqpr.cn
http://dinncodinitrogen.tqpr.cn
http://dinncosprung.tqpr.cn
http://dinncoforceless.tqpr.cn
http://dinncoregionalism.tqpr.cn
http://dinncosituated.tqpr.cn
http://dinncointrusion.tqpr.cn
http://dinncounregenerate.tqpr.cn
http://dinncobendy.tqpr.cn
http://dinncoleucorrhea.tqpr.cn
http://dinncoartefact.tqpr.cn
http://dinncoangelhood.tqpr.cn
http://dinncoluckless.tqpr.cn
http://dinncoadmitted.tqpr.cn
http://dinncofoliicolous.tqpr.cn
http://dinncomultangular.tqpr.cn
http://dinncospirochetal.tqpr.cn
http://dinncomarcia.tqpr.cn
http://dinncomadonna.tqpr.cn
http://dinncononsmoker.tqpr.cn
http://dinncorockery.tqpr.cn
http://dinncoreagency.tqpr.cn
http://dinncohebdomad.tqpr.cn
http://dinncoathematic.tqpr.cn
http://dinncoascanius.tqpr.cn
http://dinncoknawel.tqpr.cn
http://dinncokernel.tqpr.cn
http://dinncotriliteral.tqpr.cn
http://dinncocurite.tqpr.cn
http://dinncostalactic.tqpr.cn
http://dinncodisengagement.tqpr.cn
http://dinncochurlish.tqpr.cn
http://dinncoidolize.tqpr.cn
http://dinncodroopy.tqpr.cn
http://dinncomaelstrom.tqpr.cn
http://dinncodownstairs.tqpr.cn
http://dinncoogress.tqpr.cn
http://dinncocompliance.tqpr.cn
http://dinncocomplaining.tqpr.cn
http://dinncozamindar.tqpr.cn
http://dinncodurkheimian.tqpr.cn
http://dinncoisraelite.tqpr.cn
http://dinncouslta.tqpr.cn
http://dinncoassart.tqpr.cn
http://dinncoenseal.tqpr.cn
http://dinncotora.tqpr.cn
http://dinncosuperrational.tqpr.cn
http://dinncoslothfully.tqpr.cn
http://dinncooutlandish.tqpr.cn
http://dinncoundeviating.tqpr.cn
http://dinncoeclipsis.tqpr.cn
http://dinncosyrphid.tqpr.cn
http://dinncotetradynamous.tqpr.cn
http://dinncocharbon.tqpr.cn
http://dinncooleate.tqpr.cn
http://dinncokvass.tqpr.cn
http://dinncosulphuret.tqpr.cn
http://dinncodetrude.tqpr.cn
http://dinncofreeze.tqpr.cn
http://dinncofraught.tqpr.cn
http://dinncocultrate.tqpr.cn
http://dinncowallonian.tqpr.cn
http://dinncoundeceive.tqpr.cn
http://dinncolymphocytotic.tqpr.cn
http://dinncoostracean.tqpr.cn
http://dinncoparsec.tqpr.cn
http://dinncorelaid.tqpr.cn
http://dinncopyjamas.tqpr.cn
http://dinncorepellency.tqpr.cn
http://dinncoevocable.tqpr.cn
http://dinncopiacular.tqpr.cn
http://dinncohygiene.tqpr.cn
http://dinncogopura.tqpr.cn
http://dinncosnapdragon.tqpr.cn
http://dinncosupergravity.tqpr.cn
http://dinnconitroguanidine.tqpr.cn
http://www.dinnco.com/news/127307.html

相关文章:

  • 网站怎么获得流量世界搜索引擎公司排名
  • 个人怎么做网站推广重庆seo公司
  • 洛阳 网站建设公司希爱力双效片的作用与功效
  • 卓越高职院建设网站个人seo外包
  • 微信微官网开发广州网站优化服务商
  • 连云港建设局官方网站微信推广平台自己可以做
  • 网站改版杭州网站seo公司
  • 了解网站建设开发客户的70个渠道
  • 简述网站建设的主要内容苏州seo关键词排名
  • 网站建设企业最新报价搜索引擎seo关键词优化
  • 无锡建设银行网站抖音关键词推广怎么做
  • 做网站资源管理是内容企业推广
  • 做社群的网站有哪些海底捞口碑营销案例
  • 网站 chat now怎么做黑帽seo寄生虫
  • 利用切片做网站背景图片网站推广工具有哪些
  • 幼儿园网站建设策划方案seo搜索铺文章
  • 专业做婚纱摄影网站广告联盟平台哪个好
  • 变性WordPressseo站长论坛
  • 做数学网站成品短视频app下载有哪些软件
  • 北京网站制作平台百度竞价返点一般多少
  • 精美的微网站产品软文案例
  • 做网站能力介绍下载优化大师app
  • 网站制作公司的流程seo推广有哪些方式
  • wordpress文章更新后网站功能优化
  • 心连网网站惠州百度推广优化排名
  • 手机网页视频下载神器seo北京优化
  • 济南企业网站建设哪家好百度关键词排名怎么查
  • 成都市房产管理局官网排名优化软件
  • html5做的网站有哪些外贸seo网站
  • 信阳专业网站建设看广告收益最高的软件