中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

公司網(wǎng)站設(shè)計費計入什么科目百度快照手機版

公司網(wǎng)站設(shè)計費計入什么科目,百度快照手機版,網(wǎng)網(wǎng)站制作開發(fā),網(wǎng)站后臺上傳文章格式rabbitMQ安裝插件rabbitmq-delayed-message-exchange 交換機由此type 表示組件安裝成功 生產(chǎn)者發(fā)送消息時設(shè)置延遲值 消息在交換機滯納至指定延遲后,進入隊列,被消費者消費。 組件注解類: package com.esint.configs;import org.springfra…

rabbitMQ安裝插件rabbitmq-delayed-message-exchange

交換機由此type 表示組件安裝成功
在這里插入圖片描述

在這里插入圖片描述

生產(chǎn)者發(fā)送消息時設(shè)置延遲值 消息在交換機滯納至指定延遲后,進入隊列,被消費者消費。

組件注解類:

package com.esint.configs;import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import java.util.HashMap;
import java.util.Map;@Configuration
public class DelayedQueueConfig {//交換機public static final String DELAYED_EXCHANGE_NAME = "delayed.exchange";//隊列public static final String DELAYED_QUEUE_NAME = "delayed.queue";//routingKeypublic static final String DELAYED_ROUTING_KEY = "delayed.routingkey";/*** 基于插件聲明一個自定義交換機* @return*/@Beanpublic  CustomExchange delayedExchange(){//String name, String type, boolean durable, boolean autoDelete, Map<String, Object> arguments) {Map<String, Object> arguments = new HashMap<>();arguments.put("x-delayed-type","direct");return new CustomExchange(DELAYED_EXCHANGE_NAME,"x-delayed-message",true, false,arguments);}@Beanpublic Queue delayedQueue(){return QueueBuilder.durable(DELAYED_QUEUE_NAME).build();}@Beanpublic Binding delayedQueueBindingDelayedExchange(@Qualifier("delayedQueue") Queue delayedQueue,@Qualifier("delayedExchange") CustomExchange delayedExchange){return BindingBuilder.bind(delayedQueue).to(delayedExchange).with(DELAYED_ROUTING_KEY).noargs();}
}

生產(chǎn)者代碼實現(xiàn):

package com.esint.controller;//發(fā)送延遲消息import com.esint.configs.DelayedQueueConfig;
import lombok.extern.slf4j.Slf4j;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.Date;@Slf4j
@RestController
@RequestMapping("/ttl")
public class SendMesController {@Autowiredprivate RabbitTemplate rabbitTemplate;@GetMapping("/sendDelayMsg/{message}/{delayTime}")public void sendMsg(@PathVariable String message,@PathVariable Integer delayTime){log.info("當(dāng)前時間:{},發(fā)送一條ttl為{}ms的消息給延遲交換機轉(zhuǎn)隊列:{}",new Date().toString(),delayTime,message);rabbitTemplate.convertAndSend(DelayedQueueConfig.DELAYED_EXCHANGE_NAME,DelayedQueueConfig.DELAYED_ROUTING_KEY,message, mes->{mes.getMessageProperties().setDelay(delayTime);return mes;});}}

消費者實現(xiàn):

package com.esint.consumer;import com.esint.configs.DelayedQueueConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;import java.util.Date;/*** 基于插件的延時消息*/
@Slf4j
@Component
public class DelayQueueConsumer {//監(jiān)聽消息隊列@RabbitListener(queues = DelayedQueueConfig.DELAYED_QUEUE_NAME)public void receiveDelayQueue(Message message){String msg = new String(message.getBody());log.info("當(dāng)前時間{} 收到延遲消息:{}",new Date().toString(),msg);}
}

測試:

http://127.0.0.1:19092/ttl/sendDelayMsg/helloDelay1/30000
http://127.0.0.1:19092/ttl/sendDelayMsg/helloDelay2/3000

發(fā)送第一條消息:helloDelay1 延遲30s
發(fā)送第二條消息:helloDelay2 延遲3s

在這里插入圖片描述

滿足條件。

總結(jié):
阻塞層在交換機。
發(fā)送消息靈活設(shè)置時間,現(xiàn)達(dá)到時間先被消費。
需要安裝延時插件。

http://www.risenshineclean.com/news/7425.html

相關(guān)文章:

  • 別人幫做的網(wǎng)站到期續(xù)費企業(yè)網(wǎng)絡(luò)營銷策略
  • 免費做網(wǎng)站電話市場營銷策略有哪些
  • 網(wǎng)站下載的軟件怎么安裝如何做百度競價推廣
  • mvc 網(wǎng)站建設(shè)線上運營推廣
  • 貴州高端網(wǎng)站建設(shè)seo管理系統(tǒng)創(chuàng)作
  • 手機網(wǎng)站建設(shè)官網(wǎng)seo優(yōu)化網(wǎng)站技術(shù)排名百度推廣
  • 江門網(wǎng)站建設(shè)公司百度平臺客服聯(lián)系方式
  • 餐飲官網(wǎng)建站模板網(wǎng)站推廣及seo方案
  • 網(wǎng)站左下角廣告代碼百度瀏覽器網(wǎng)址鏈接
  • wordpress商城插件收費seo優(yōu)化論壇
  • 推廣網(wǎng)站有多少家鄭州seo公司哪家好
  • 怎樣做天貓網(wǎng)站視頻李江seo
  • 一級造價工程師報名網(wǎng)站軟文是指什么
  • 中山商城型網(wǎng)站建設(shè)企業(yè)模板建站
  • com網(wǎng)站建設(shè)app開發(fā)費用一覽表
  • 帝國新聞網(wǎng)站模板近一周的新聞大事熱點
  • 網(wǎng)站建設(shè) php東莞seo網(wǎng)絡(luò)公司
  • 橙色企業(yè)網(wǎng)站模板網(wǎng)店推廣有哪些
  • 廣西欽州有人幫做網(wǎng)站的公司嗎百度地圖3d實景地圖
  • 綏化市建設(shè)工程網(wǎng)站招投標(biāo)app推廣公司怎么對接業(yè)務(wù)
  • 新蒲建設(shè)集團網(wǎng)站數(shù)據(jù)交換平臺
  • 如何做視頻網(wǎng)站技術(shù)指標(biāo)網(wǎng)絡(luò)營銷策劃的流程
  • 大安移動網(wǎng)站建設(shè)西安企業(yè)seo
  • 展示型手機網(wǎng)站模板seo就業(yè)
  • 湖南省建設(shè)廳網(wǎng)站首頁網(wǎng)絡(luò)顧問
  • 幫企業(yè)外賣網(wǎng)站做推移動網(wǎng)站優(yōu)化排名
  • 網(wǎng)站免費優(yōu)化工具怎樣宣傳網(wǎng)站
  • 在建設(shè)政府門戶網(wǎng)站時要充分考慮到引流推廣是什么意思
  • 廈門網(wǎng)紅鄭州seo技術(shù)
  • 網(wǎng)站建設(shè) 網(wǎng)站優(yōu)化5118數(shù)據(jù)分析平臺官網(wǎng)