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

酒吧网站模板哈尔滨互联网公司

酒吧网站模板,哈尔滨互联网公司,什么网站的页面好看,工程公司管理系统原始状态的 activemq-client sdk 集成非常方便#xff0c;也更适合定制。就是有些同学#xff0c;可能对原始接口会比较陌生#xff0c;会希望有个具体的示例。 dependencygroupIdorg.apache.activemq/groupIdartifactIdactivemq-client也更适合定制。就是有些同学可能对原始接口会比较陌生会希望有个具体的示例。 dependencygroupIdorg.apache.activemq/groupIdartifactIdactivemq-client/artifactIdversion${activemq.version}/version /dependencydependencygroupIdorg.apache.activemq/groupIdartifactIdactivemq-pool/artifactIdversion${activemq.version}/version /dependency希望更加简化使用的同学可以使用 activemq-solon-cloud-plugin 使用更简单定制性弱些 1、添加集成配置 先使用 Solon 初始器 先生成一个 Solon Web 模板项目然后添加上面的 activemq-client 依赖。再做个配置约定也可按需定义 “solon.activemq”作为配置前缀 “properties”作为公共配置“producer”作为生态者专属配置估计用不到“consumer”作为消费者专属配置估计用不到 具体的配置属性参考自ActiveMQConnectionFactory solon.app:name: demo-appgroup: demo# 配置可以自由定义与 Bean 代码对应起来即可以下为参考 solon.activemq:properties: #公共配置配置项参考ActiveMQConnectionFactorybrokerURL: failover:tcp://localhost:61616redeliveryPolicy: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.hkea.cn/news/14414158/

相关文章:

  • 申请网站空间就是申请域名app网站开发费用
  • 建立一平台个网站需要多少钱阿里巴巴网站域名注册
  • 山东中恒建设集团网站西乡专业网站建设
  • 佛山做网站需要多少钱iis7搭建asp网站
  • 兴宁网站设计网站开发公司创业
  • 怎么建设自己网站首页ip做网站需要过白名单吗
  • 做类似知乎网站目前网站开发语言
  • 青岛网站建设找润商国外服务器怎么买
  • 天津网站建设icp备网站左侧固定代码
  • 投资建设一个网站多少钱网站页面设计具体步骤
  • 重庆建设科技培训中心官方网站百度账号登录中心
  • 购物网站开发什么是网站开发网站建设线上线下双服务器
  • 怎么做网站的图片跳转天津市工程建设招标信息网
  • 做企业网站 签合同要注意什么做电影资源网站服务器怎么选
  • 苏州实力做网站公司网站建设沧州
  • 昆明淘宝网站建设优化关键词推广
  • 网站建设费能入长期待摊吗seo优化运营专员
  • 域名网站建设方案书模板江门做网站公司
  • 360未经证实的网站如何做全球网站建设服务商
  • app会替代网站吗廊坊关键词优化
  • 简单asp网站源码现在有哪些推广平台
  • 长春自主建站模板互动吧网站模板
  • 网站中图片下移怎么做网站开发笔记本要多少钱的
  • 免费vip网站推广搜狗搜索引擎网页
  • 一起作业网站英语作业怎么做商品推广软文范例300字
  • 在演示文稿上网站怎么做网站制作公司去哪找客户
  • 网站建设培训费用应用公园下载
  • 什么是营销型网站江西最新新闻事件今天
  • 网站建设代码网站只做优化
  • 和平网站建设wordpress同时使用双主题