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

网站开发优惠活动方案sem是什么工作

网站开发优惠活动方案,sem是什么工作,一般购物网站项目,新手学做网站要多久0、知识点 1、创建项目-生产者 默认官方start.spring.io已不支持自动生成低版本jkd的Spring项目,自定义用阿里云的starter即可:https://start.aliyun.com 2、创建配置类 package com.wym.rabbitmqprovider.utils;import org.springframework.amqp.core.…

0、知识点

1、创建项目-生产者

        默认官方start.spring.io已不支持自动生成低版本jkd的Spring项目,自定义用阿里云的starter即可:https://start.aliyun.com

2、创建配置类

package com.wym.rabbitmqprovider.utils;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.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class DirectRabbitConfig {//队列 起名:TestDirectQueue@Beanpublic Queue TestDirectQueue() {// durable:是否持久化,默认是false,持久化队列:会被存储在磁盘上,当消息代理重启时仍然存在,暂存队列:当前连接有效// exclusive:默认也是false,只能被当前创建的连接使用,而且当连接关闭后队列即被删除。此参考优先级高于durable// autoDelete:是否自动删除,当没有生产者或者消费者使用此队列,该队列会自动删除。//   return new Queue("TestDirectQueue",true,true,false);//一般设置一下队列的持久化就好,其余两个就是默认falsereturn new Queue("TestDirectQueue",true);}//Direct交换机 起名:TestDirectExchange@BeanDirectExchange TestDirectExchange() {//  return new DirectExchange("TestDirectExchange",true,true);return new DirectExchange("TestDirectExchange",true,false);}//绑定  将队列和交换机绑定, 并设置用于匹配键:TestDirectRouting@BeanBinding bindingDirect() {return BindingBuilder.bind(TestDirectQueue()).to(TestDirectExchange()).with("TestDirectRouting");}@BeanDirectExchange lonelyDirectExchange() {return new DirectExchange("lonelyDirectExchange");}}

3、创建消息发送接口

package com.wym.rabbitmqprovider.controller;import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;@RestController
public class SendMessageController {@AutowiredRabbitTemplate rabbitTemplate;  //使用RabbitTemplate,这提供了接收/发送等等方法@GetMapping("/sendDirectMessage")public String sendDirectMessage() {String messageId = String.valueOf(UUID.randomUUID());String messageData = "test message, hello!";String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));Map<String,Object> map=new HashMap<>();map.put("messageId",messageId);map.put("messageData",messageData);map.put("createTime",createTime);//将消息携带绑定键值:TestDirectRouting 发送到交换机TestDirectExchangerabbitTemplate.convertAndSend("TestDirectExchange", "TestDirectRouting", map);return "ok";}
}

4、使用postapi测试

 5、查看客户端

 queues中也有了

 6、补充:导包、yml配置

 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-amqp</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
server:port: 8081
spring:#给项目来个名字application:name: rabbitmq-provider#配置rabbitMq 服务器rabbitmq:host: 127.0.0.1port: 5672username: guestpassword: guest#虚拟host 可以不设置,使用server默认host#-host: host

OK,接下来做消费者:Springboot集成RabbitMq二-CSDN博客

http://www.ds6.com.cn/news/105599.html

相关文章:

  • 娱乐类网站开发附近电脑培训班零基础
  • 网络新闻专题做的最好的网站网站优化查询代码
  • 现在建设一个网站还能够赚钱吗海外推广方案
  • 网站做百度排名最新腾讯新闻
  • 网站蜘蛛池怎么做的长春seo推广
  • 制作一个简单的网站微信朋友圈广告推广
  • 未来中森网站建设计算机培训课程
  • 网站建设预付费入什么科目制作小程序的软件
  • 百度网站考核期全专业优化公司
  • 网站开发外包维护合同成都网站seo技术
  • 澧县网站设计百度官网客服
  • 网页设计的流程ui整站优化深圳
  • 毕业设计代做网站java2024年的新闻
  • 清新网站设计seo技术软件
  • 支付宝手机网站网络推广怎么做
  • 页面排版seo网站排名推广
  • asp评价网站开发文档免费web服务器网站
  • 青岛做网站建设的公司微商营销技巧
  • 部门网站建设情况总结百度今日数据
  • 呼和浩特做网站哪家好网络服务包括哪些内容
  • 山东德州如何网站建设教程临沂网站建设公司哪家好
  • 网站仿制公司互联网+营销策略怎么写
  • 买域名后 怎么做网站天津百度推广排名
  • 上虞做网站seo综合查询接口
  • 企业做网页还是网站重庆seo软件
  • 网站搜索排优化怎么做宁波seo优化费用
  • 网站推广平台如何建立自己的网站?
  • b2c网站建设方案免费网站做seo
  • 网站开发图片加载过慢如何优化品牌营销策略有哪些方法
  • 怎么做电子商务网站百度推广管理