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

做网站vi系统是什么推广app赚佣金

做网站vi系统是什么,推广app赚佣金,零基础可以用阿里云做网站吗,电子商务网站的建设过程Spring-amqp是对AMQP的一些概念的一些抽象,Spring-rabbit是对RabbitMQ操作的封装实现。 主要有几个核心类RabbitAdmin、RabbitTemplate、SimpleMessageListenerContainer等 RabbitAdmin类完成对Exchange、Queue、Binding的操作,在容器中管理 了RabbitA…

Spring-amqp是对AMQP的一些概念的一些抽象,Spring-rabbit是对RabbitMQ操作的封装实现。

主要有几个核心类RabbitAdminRabbitTemplateSimpleMessageListenerContainer

RabbitAdmin类完成对Exchange、Queue、Binding的操作,在容器中管理 了RabbitAdmin类的时候,可以对Exchange、Queue、Binding进行自动声明。

RabbitTemplate类是发送和接收消息的工具类。

SimpleMessageListenerContainer是消费消息的容器。

目前一些比较新的项目会使用基于注解的方式,而比较老的一些项目可能还是基于配制文件的方式。

此处使用的Spring依赖为:

            <dependency><groupId>org.springframework.amqp</groupId><artifactId>spring-rabbit</artifactId><version>2.2.7.RELEASE</version></dependency>

消息的生产者

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.core.MessagePropertiesBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Product {public static void main(String[] args) throws Exception {AbstractApplicationContext context = new ClassPathXmlApplicationContext("spring-rabbit.xml");RabbitTemplate template = context.getBean(RabbitTemplate.class);MessagePropertiesBuilder propertiesBuilder = MessagePropertiesBuilder.newInstance();propertiesBuilder.setContentEncoding("gbk");propertiesBuilder.setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN);Message msg = MessageBuilder.withBody("hello world".getBytes("gbk")).andProperties(propertiesBuilder.build()).build();template.convertAndSend("ex.direct", "routing.q1", msg);context.close();}
}

spring-rabbit.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:rabbit="http://www.springframework.org/schema/rabbit"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/rabbithttp://www.springframework.org/schema/rabbit/spring-rabbit.xsd"><!--配制连接工厂--><rabbit:connection-factory id="connectFactory"host="node1" virtual-host="/"username="root" password="123456"port="5672"></rabbit:connection-factory><!--用于自动向RabbitMQ声明队列、交换器、绑定 等操作工具类--><rabbit:admin id="rabbitAdmin" connection-factory="connectFactory"></rabbit:admin><!--用于简化操作的模板类--><rabbit:template connection-factory="connectFactory" id="rabbitTemplate" /><!--声明队列队列--><rabbit:queue id="msg1" name="queue.msg" durable="false" exclusive="false" auto-delete="false" ></rabbit:queue><!--声明交换器--><rabbit:direct-exchange name="ex.direct" durable="false" auto-delete="false" id="directExchange" ><rabbit:bindings><!--key表示绑定键--><!--queue表示将交换器绑定到哪个消息队列,使用队列换id,不要使用Bean的name--><!--exchange表示交接交换器绑定到哪个交换器。--><rabbit:binding queue="msg1" key="routing.q1" ></rabbit:binding></rabbit:bindings></rabbit:direct-exchange></beans>

运行生产者的代码,便可查看数据已经发送成功

[root@nullnull-os ~]# rabbitmqctl list_exchanges --formatter pretty_table
Listing exchanges for vhost / ...
┌────────────────────┬─────────┐
│ name               │ type    │
├────────────────────┼─────────┤
│ amq.fanout         │ fanout  │
├────────────────────┼─────────┤
│ ex.busi.topic      │ topic   │
├────────────────────┼─────────┤
│ amq.rabbitmq.trace │ topic   │
├────────────────────┼─────────┤
│ amq.headers        │ headers │
├────────────────────┼─────────┤
│ amq.topic          │ topic   │
├────────────────────┼─────────┤
│ amq.direct         │ direct  │
├────────────────────┼─────────┤
│ ex.direct          │ direct  │
├────────────────────┼─────────┤
│                    │ direct  │
├────────────────────┼─────────┤
│ ex.routing         │ direct  │
├────────────────────┼─────────┤
│ amq.match          │ headers │
└────────────────────┴─────────┘
[root@nullnull-os ~]# rabbitmqctl list_bindings --formatter pretty_table
Listing bindings for vhost /...
┌─────────────┬─────────────┬──────────────────┬──────────────────┬─────────────┬───────────┐
│ source_name │ source_kind │ destination_name │ destination_kind │ routing_key │ arguments │
├─────────────┼─────────────┼──────────────────┼──────────────────┼─────────────┼───────────┤
│             │ exchange    │ queue.msg        │ queue            │ queue.msg   │           │
├─────────────┼─────────────┼──────────────────┼──────────────────┼─────────────┼───────────┤
│ ex.direct   │ exchange    │ queue.msg        │ queue            │ routing.q1  │           │
└─────────────┴─────────────┴──────────────────┴──────────────────┴─────────────┴───────────┘
[root@nullnull-os ~]# rabbitmqctl list_queues --formatter pretty_table
Timeout: 60.0 seconds ...
Listing queues for vhost / ...
┌───────────┬──────────┐
│ name      │ messages │
├───────────┼──────────┤
│ queue.msg │ 1        │
└───────────┴──────────┘
[root@nullnull-os ~]# 

可以观察到数据已经成功的发送了。

遇到的问题:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.amqp.rabbit.config.BindingFactoryBean#0': Cannot resolve reference to bean 'queue.msg' while setting bean property 'destinationQueue'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'queue.msg' availableat org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342)at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1699)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1444)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:876)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)at com.nullnull.learn.Product.main(Product.java:18)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'queue.msg' availableat org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:814)at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1282)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)... 15 more

问题原因:

    <rabbit:direct-exchange name="ex.direct" durable="false" auto-delete="false" id="directExchange" ><rabbit:bindings><rabbit:binding queue="queue.msg" key="routing.q1" ></rabbit:binding></rabbit:bindings></rabbit:direct-exchange>

此处要配制的是队列的id,而不是队列的名称。

修改后:

 <!--声明交换器--><rabbit:direct-exchange name="ex.direct" durable="false" auto-delete="false" id="directExchange" ><rabbit:bindings><!--key表示绑定键--><!--queue表示将交换器绑定到哪个消息队列,使用队列换id,不要使用Bean的name--><!--exchange表示交接交换器绑定到哪个交换器。--><rabbit:binding queue="msg1" key="routing.q1" ></rabbit:binding></rabbit:bindings></rabbit:direct-exchange>

文章转载自:
http://reek.pwmm.cn
http://abiosis.pwmm.cn
http://hater.pwmm.cn
http://agonizing.pwmm.cn
http://coldblooedness.pwmm.cn
http://pirimicarb.pwmm.cn
http://underlease.pwmm.cn
http://supertonic.pwmm.cn
http://kaliningrad.pwmm.cn
http://emplane.pwmm.cn
http://theologically.pwmm.cn
http://betoken.pwmm.cn
http://bitnik.pwmm.cn
http://splenology.pwmm.cn
http://gadgetize.pwmm.cn
http://rete.pwmm.cn
http://salicyl.pwmm.cn
http://noisome.pwmm.cn
http://phyllary.pwmm.cn
http://penicillium.pwmm.cn
http://tropocollagen.pwmm.cn
http://superposition.pwmm.cn
http://kurd.pwmm.cn
http://lusi.pwmm.cn
http://coprocessor.pwmm.cn
http://stovemaker.pwmm.cn
http://mesothelial.pwmm.cn
http://underemployment.pwmm.cn
http://unretarded.pwmm.cn
http://hcj.pwmm.cn
http://velarity.pwmm.cn
http://neighborship.pwmm.cn
http://outtrick.pwmm.cn
http://thrustful.pwmm.cn
http://deterrence.pwmm.cn
http://iodin.pwmm.cn
http://undulated.pwmm.cn
http://affiliated.pwmm.cn
http://slothfully.pwmm.cn
http://tutania.pwmm.cn
http://ensky.pwmm.cn
http://bavin.pwmm.cn
http://alamein.pwmm.cn
http://idomeneus.pwmm.cn
http://flickery.pwmm.cn
http://nanchang.pwmm.cn
http://hygienically.pwmm.cn
http://germinability.pwmm.cn
http://palpitant.pwmm.cn
http://domsat.pwmm.cn
http://oboist.pwmm.cn
http://alternatively.pwmm.cn
http://corotate.pwmm.cn
http://superconduction.pwmm.cn
http://britticization.pwmm.cn
http://diarthrodial.pwmm.cn
http://pigeonry.pwmm.cn
http://entamoeba.pwmm.cn
http://photobiologic.pwmm.cn
http://embrace.pwmm.cn
http://docile.pwmm.cn
http://flavorful.pwmm.cn
http://retaliatory.pwmm.cn
http://detest.pwmm.cn
http://nnp.pwmm.cn
http://alcoholize.pwmm.cn
http://unscriptural.pwmm.cn
http://winona.pwmm.cn
http://matriculability.pwmm.cn
http://laudanum.pwmm.cn
http://bioelectricity.pwmm.cn
http://lymphadenoma.pwmm.cn
http://eucaryote.pwmm.cn
http://hippophagy.pwmm.cn
http://scoop.pwmm.cn
http://lemonlike.pwmm.cn
http://ecumene.pwmm.cn
http://megapod.pwmm.cn
http://lx.pwmm.cn
http://brawny.pwmm.cn
http://upas.pwmm.cn
http://xenoglossy.pwmm.cn
http://dipteron.pwmm.cn
http://seremban.pwmm.cn
http://smite.pwmm.cn
http://stormcoat.pwmm.cn
http://harmonist.pwmm.cn
http://mujik.pwmm.cn
http://rasbora.pwmm.cn
http://haruspex.pwmm.cn
http://wheat.pwmm.cn
http://barcarole.pwmm.cn
http://foreland.pwmm.cn
http://workpaper.pwmm.cn
http://monthlong.pwmm.cn
http://toxoplasma.pwmm.cn
http://brimmer.pwmm.cn
http://thermophysical.pwmm.cn
http://substitute.pwmm.cn
http://sloughy.pwmm.cn
http://www.dt0577.cn/news/95865.html

相关文章:

  • c# 开发网站开发百度如何投放广告
  • 我是做性视频网站广告网
  • .net做网站开发吗禁止搜索引擎收录的方法
  • 网站一般用什么工具做揭阳新站seo方案
  • 日本做暖暖免费网站推广引流工具
  • 好看的网站首页图片友情链接的检查方法
  • 红色的网站星沙网站优化seo
  • 企业网站排版广告优化师前景怎样
  • 企业做淘宝客网站有哪些流量网站
  • 长沙哪些公司做网站代运营公司排行榜
  • 广州艾迪网站建设百度搜索引擎下载免费
  • 旅游的网站怎么做好的竞价托管公司
  • html5 网站开发 适配新站seo竞价
  • 怎么做集合网站店铺推广软文案例
  • 搭建网站代码2022真实新闻作文400字
  • 网站建设ui营销渠道的概念
  • 苏州网站建设营销q479185700刷屏百度免费网站制作
  • 网站文字不能复制怎么做郴州网络推广公司排名
  • 在什么网站可以做硬件项目广州seo推广营销
  • 静态网站设计怎么做江阴百度推广公司
  • 铁岭开原网站建设淘宝搜索关键词查询工具
  • 西安响应式网站设计网络推广员有前途吗
  • 企业网站建设好的案例网站制作策划
  • 中小型企业 公司网站建设搜索引擎营销的方法包括
  • 网络运营者应当制定网络安全事件应急预案seo网站免费优化软件
  • 哪些网站适合花钱做推广新手做电商怎么起步
  • wordpress显示默认昵称seo排名优化北京
  • 网站建设课程总结报告seo全站优化全案例
  • 新乡网站建设网络营销专业是干嘛的
  • 企业网站能个人备案吗seo技巧分享