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

网站优化哪家好yoast seo教程

网站优化哪家好,yoast seo教程,企业营销策划案例分析,印刷厂网站源码原始状态的 activemq-client sdk 集成非常方便&#xff0c;也更适合定制。就是有些同学&#xff0c;可能对原始接口会比较陌生&#xff0c;会希望有个具体的示例。 <dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-client&l…

原始状态的 activemq-client sdk 集成非常方便,也更适合定制。就是有些同学,可能对原始接口会比较陌生,会希望有个具体的示例。

<dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-client</artifactId><version>${activemq.version}</version>
</dependency><dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-pool</artifactId><version>${activemq.version}</version>
</dependency>

希望更加简化使用的同学,可以使用:

activemq-solon-cloud-plugin (使用更简单,定制性弱些)

1、添加集成配置

先使用 Solon 初始器 先生成一个 Solon Web 模板项目,然后添加上面的 activemq-client 依赖。再做个配置约定(也可按需定义):

  • “solon.activemq”,作为配置前缀
    • “properties”,作为公共配置
    • “producer”,作为生态者专属配置(估计用不到)
    • “consumer”,作为消费者专属配置(估计用不到)

具体的配置属性,参考自:ActiveMQConnectionFactory

solon.app:name: "demo-app"group: "demo"# 配置可以自由定义,与 @Bean 代码对应起来即可(以下为参考)
solon.activemq:properties:  #公共配置(配置项,参考:ActiveMQConnectionFactory)brokerURL: "failover:tcp://localhost:61616"redeliveryPolicy:initialRedeliveryDelay: 5000backOffMultiplier: 2useExponentialBackOff: truemaximumRedeliveries: -1maximumRedeliveryDelay: 3600_000

添加 java 配置器

@Configuration
public class ActivemqConfig {@Bean(destroyMethod = "stop")public Connection client(@Inject("${solon.activemq.properties}") Props common) throws Exception {String brokerURL = (String) common.remove("brokerURL");String userName = (String) common.remove("userName");String password = (String) common.remove("password");ActiveMQConnectionFactory factory;if (Utils.isEmpty(userName)) {factory = new ActiveMQConnectionFactory(brokerURL);} else {factory = new ActiveMQConnectionFactory(brokerURL, userName, password);}//绑定额外的配置并创建连接Connection connection = common.bindTo(factory).createConnection();connection.start();return connection;}@Beanpublic IProducer producer(Connection connection) throws Exception {return new IProducer(connection);}@Beanpublic void consumer(Connection connection,MessageListener messageListener) throws Exception {Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);Destination destination = session.createTopic("topic.test");MessageConsumer consumer = session.createConsumer(destination);consumer.setMessageListener(messageListener);}
}

activemq 的消息发送的代码比较复杂,所以我们可以做个包装处理(用于上面的配置构建),临时命名为 IProducer:

public class IProducer {private Connection connection;public IProducer(Connection connection) {this.connection = connection;}public void send(String topic, MessageBuilder messageBuilder) throws JMSException {Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);Destination destination = session.createTopic(topic);MessageProducer producer = session.createProducer(destination);producer.send(destination, messageBuilder.build(session));}@FunctionalInterfacepublic static interface MessageBuilder {Message build(Session session) throws JMSException;}
}

3、代码应用

发送(或生产),这里代控制器由用户请求再发送消息(仅供参考):

@Controller
public class DemoController {@Injectprivate IProducer producer;@Mapping("/send")public void send(String msg) throws Exception {//发送producer.send("topic.test", s -> s.createTextMessage("test"));}
}

监听(或消费),这里采用订阅回调的方式:(仅供参考)

@Component
public class DemoMessageListener implements MessageListener {@Overridepublic void onMessage(Message message) {System.out.println(message);RunUtil.runAndTry(message::acknowledge);}
}
http://www.hengruixuexiao.com/news/31572.html

相关文章:

  • 网站资源做缓存微帮推广平台怎么加入
  • WordPress配置路由跳转seo内容优化
  • 青岛官网建站关键词seo优化排名
  • 工信和信息化部网站软文营销的特点
  • 天津公司做网站杭州网站关键词排名优化
  • 21dove谁做的的网站seo外链推广工具下载
  • 网站建设与网页设计考试题河南网站建设
  • seo优化推广流程安卓优化大师老版本下载
  • 郑州住房城乡建设官网郑州seo顾问热狗
  • 网站开发翻译插件免费网络推广软件有哪些
  • 上海网站建设q.479185700棒百度退推广费是真的吗
  • 从事网站开发需要哪些知识南宁seo全网营销
  • 学做外挂上什么网站免费做网站怎么做网站
  • 为企业规划网站注意什么google引擎免费入口
  • 博物馆网站建设依据百度seo招聘
  • 新网站建设平台seo搜索引擎优化哪家好
  • 网站建设和运行管理办法发稿平台
  • 大淘客网站推广位怎么做全网推广方案
  • java做网站开发新型网络营销方式
  • 论企业网站建设的必要性百度答主招募入口官网
  • 网站后台漏洞百度网站打开
  • 重庆做网站设计免费优化网站
  • 政府网站flash拉新平台
  • 一般电商都是在哪些网站上做百度快照和广告的区别
  • 网站站内的seo怎么做网络优化大师app
  • 网站建设推广的广告语网店代运营和推广销售
  • 订做网站网站排名软件利搜
  • 桂林企业建站今日新闻国内大事件
  • php的网站模板app推广接单
  • 深圳网站建设好不好谷歌paypal官网下载