消息中间件-ActiveMQ支持的消息协议
























package com.study.mq.a1_example.helloworld.queue;
import org.apache.activemq.ActiveMQConnectionFactory;
import javax.jms.*;
/**
简单生产者
*/
public class Producer {
public static void main(String[] args) {
new ProducerThread("tcp://10.201.157.250:61616", "queue1").start();
} static class ProducerThread extends Thread {
String brokerUrl;
String destinationUrl;public ProducerThread(String brokerUrl, String destinationUrl) {
this.brokerUrl = brokerUrl;
this.destinationUrl = destinationUrl;
} @Override
public void run() {
ActiveMQConnectionFactory connectionFactory;
Connection conn;
Session session; try {
// 1、创建连接工厂
connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
// 2、创建连接对象md
conn = connectionFactory.createConnection();
conn.start();
// 3、创建会话,表示是否支持事务
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
// 4、创建点对点发送的目标
Destination destination = session.createQueue(destinationUrl);
// 5、创建生产者消息
MessageProducer producer = session.createProducer(destination);
// 设置生产者的模式,有两种可选 持久化 / 不持久化
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
// 6、创建一条文本消息
String text = "Hello world!";
TextMessage message = session.createTextMessage(text);
for (int i = 0; i < 1; i++) {
// 7、发送消息
producer.send(message);
}
// 8、 关闭连接
session.close();
conn.close();
} catch (JMSException e) {
e.printStackTrace();
}
}
}
}

1、可以通过log4j.properties可以记录log信息
阅读下面的文档就可以添加修改相应的参数
http://activemq.apache.org/tcp-transport-reference
vi activemq.xml



2、传输协议改成UDP

package com.study.mq.a1_example.transport; import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.*; // UDP示例 http://activemq.apache.org/udp-transport-reference.html
public class ConsumerAndProducerUDP {
public static void main(String[] args) {
ActiveMQConnectionFactory connectionFactory = null;
Connection conn = null;
Session session = null;
MessageConsumer consumer = null;try {
// 1、创建连接工厂
connectionFactory = new ActiveMQConnectionFactory("udp://activemq.tony.com:61616");
// 2、创建连接对象
conn = connectionFactory.createConnection("admin", "admin");
conn.start(); session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); // 4、创建点对点接收的目标
Destination destination = session.createQueue("queue1"); // 5、创建生产者消息
MessageProducer producer = session.createProducer(destination);
// 设置生产者的模式,有两种可选
// DeliveryMode.PERSISTENT 当activemq关闭的时候,队列数据将会被保存
// DeliveryMode.NON_PERSISTENT 当activemq关闭的时候,队列里面的数据将会被清空
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); // 6、创建一条消息
String text = "Hello world!";
TextMessage message = session.createTextMessage(text);
// 7、发送消息
producer.send(message); // 8、创建消费者消息
consumer = session.createConsumer(destination); // 9、接收消息
Message consumerMessage = consumer.receive();
if (consumerMessage instanceof TextMessage) {
System.out.println("收到文本消息:" + ((TextMessage) consumerMessage).getText());
} else {
System.out.println(consumerMessage);
}
} catch (JMSException e) {
e.printStackTrace();
} finally {
if (consumer != null) {
try {
consumer.close();
} catch (JMSException e) {
e.printStackTrace();
}
} if (session != null) {
try {
session.close();
} catch (JMSException e1) {
e1.printStackTrace();
}
} if (conn != null) {
try {
conn.close();
} catch (JMSException e1) {
e1.printStackTrace();
}
}
}
}
}
3、SSL修改
ssl客户端: http://activemq.apache.org/ssl-transport-reference.html
http://activemq.apache.org/how-do-i-use-ssl.html
package com.study.mq.a1_example.transport; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQSslConnectionFactory; import javax.jms.*; // ssl客户端: http://activemq.apache.org/ssl-transport-reference.html
// http://activemq.apache.org/how-do-i-use-ssl.html
public class ConsumerAndProducerSSL {
public static void main(String[] args) {
// ssl
ActiveMQSslConnectionFactory connectionFactory = null;
Connection conn = null;
Session session = null;
MessageConsumer consumer = null;try {
// 1、创建连接工厂
connectionFactory = new ActiveMQSslConnectionFactory("ssl://activemq.tony.com:61617?socket.verifyHostName=false");
connectionFactory.setTrustStore("activemq-client.ts");
connectionFactory.setTrustStorePassword("netease");
// 2、创建连接对象
conn = connectionFactory.createConnection();
conn.start();
// 3、 创建session
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
// 4、创建点对点接收的目标
Destination destination = session.createQueue("queue1");
// 5、创建生产者消息
MessageProducer producer = session.createProducer(destination);
// 设置生产者的模式,有两种可选
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
// 6、创建一条消息
String text = "Hello world!";
TextMessage message = session.createTextMessage(text);
// 7、发送消息
producer.send(message);
// 8、创建消费者消息
consumer = session.createConsumer(destination);
// 9、接收消息
Message consumerMessage = consumer.receive();
if (consumerMessage instanceof TextMessage) {
System.out.println("收到文本消息:" + ((TextMessage) consumerMessage).getText());
} else {
System.out.println(consumerMessage);
} consumer.close();
session.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
4、NIO
http://activemq.apache.org/configuring-transports.html
http://activemq.apache.org/tcp-transport-reference.html
package com.study.mq.a1_example.transport; import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.*; // http://activemq.apache.org/configuring-transports.html
// http://activemq.apache.org/tcp-transport-reference.html
public class ConsumerAndProducerNIO {
public static void main(String[] args) {
ActiveMQConnectionFactory connectionFactory = null;
Connection conn = null;
Session session = null;
MessageConsumer consumer = null;try {
// 1、创建连接工厂
connectionFactory = new ActiveMQConnectionFactory("nio://activemq.tony.com:61616");
// 2、创建连接对象
conn = connectionFactory.createConnection();
conn.start();
// 3、 创建session
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
// 4、创建点对点接收的目标
Destination destination = session.createQueue("queue1");
// 5、创建生产者消息
MessageProducer producer = session.createProducer(destination);
// 设置生产者的模式,有两种可选
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
// 6、创建一条消息
String text = "Hello world!";
TextMessage message = session.createTextMessage(text);
// 7、发送消息
producer.send(message);
// 8、创建消费者消息
consumer = session.createConsumer(destination);
// 9、接收消息
Message consumerMessage = consumer.receive();
if (consumerMessage instanceof TextMessage) {
System.out.println("收到文本消息:" + ((TextMessage) consumerMessage).getText());
} else {
System.out.println(consumerMessage);
} consumer.close();
session.close();
conn.close();
} catch (JMSException e) {
e.printStackTrace();
}
}
}
5、组播形式,自动发现服务器
- 组播的形式自动发现服务器: http://activemq.apache.org/multicast-transport-reference.html
 - 自己电脑上启动一个activemq,在activemq.xml connector加上
 - <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?trace=true&maximumConnections=1000&wireFormat.maxFrameSize=104857600" discoveryUri="multicast://default"/>
 - 玩一玩就行,跨网络啥的,要配置网络.客户端不用这个,一般是服务器集群用得到
 
package com.study.mq.a1_example.discovery; import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.*; // 组播的形式自动发现服务器: http://activemq.apache.org/multicast-transport-reference.html
// 自己电脑上启动一个activemq,在activemq.xml connector加上
// <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?trace=true&maximumConnections=1000&wireFormat.maxFrameSize=104857600" discoveryUri="multicast://default"/>
// 玩一玩就行,跨网络啥的,要配置网络.客户端不用这个,一般是服务器集群用得到
public class ConsumerAndProducerMulticastDiscovery {
public static void main(String[] args) {
ActiveMQConnectionFactory connectionFactory = null;
Connection conn = null;
Session session = null;
MessageConsumer consumer = null;try {
// 1、创建连接工厂(不需要手动指定,自动发现)
connectionFactory = new ActiveMQConnectionFactory("discovery:(multicast://default)");
// 2、创建连接对象
conn = connectionFactory.createConnection();
conn.start();
// 3、 创建session
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
// 4、创建点对点接收的目标
Destination destination = session.createQueue("queue1");
// 5、创建生产者消息
MessageProducer producer = session.createProducer(destination);
// 设置生产者的模式,有两种可选
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
// 6、创建一条消息
String text = "Hello world!";
TextMessage message = session.createTextMessage(text);
// 7、发送消息
producer.send(message);
// 8、创建消费者消息
consumer = session.createConsumer(destination);
// 9、接收消息
Message consumerMessage = consumer.receive();
if (consumerMessage instanceof TextMessage) {
System.out.println("收到文本消息:" + ((TextMessage) consumerMessage).getText());
} else {
System.out.println(consumerMessage);
} consumer.close();
session.close();
conn.close();
} catch (JMSException e) {
e.printStackTrace();
}
}
}
6、AMQP协议

7、MQTT协议







没收到消息会进行重发


有一个去重的操作,并且性能很差





MQTT实际操作
是一种发布订阅模式
        <dependency>
            <groupId>org.eclipse.paho</groupId>
            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
            <version>1.2.0</version>
        </dependency>
package com.study.mq.a2_mqtt; import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; public class MqttProducer {
private static int qos = 1;
private static String broker = "tcp://activemq.tony.com:1883";
private static String userName = "admin";
private static String passWord = "admin";private static MqttClient connect(String clientId, String userName,
String password) throws MqttException {
MemoryPersistence persistence = new MemoryPersistence();
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setCleanSession(true);
connOpts.setUserName(userName);
connOpts.setPassword(password.toCharArray());
connOpts.setConnectionTimeout(10);
connOpts.setKeepAliveInterval(20);
// String[] uris = {"tcp://10.100.124.206:1883","tcp://10.100.124.207:1883"};
// connOpts.setServerURIs(uris); //这个是mqtt客户端实现的负载均衡和容错
MqttClient mqttClient = new MqttClient(broker, clientId, persistence);
mqttClient.setCallback(new PushCallback("test"));
mqttClient.connect(connOpts);
return mqttClient;
} private static void pub(MqttClient sampleClient, String msg, String topic)
throws Exception {
MqttMessage message = new MqttMessage(msg.getBytes());
message.setQos(qos);
message.setRetained(false);
sampleClient.publish(topic, message);
} private static void publish(String str, String clientId, String topic) throws Exception {
MqttClient mqttClient = connect(clientId, userName, passWord);
if (mqttClient != null) {
pub(mqttClient, str, topic);
System.out.println("pub-->" + str);
}
if (mqttClient != null) {
mqttClient.disconnect();
}
} public static void main(String[] args) throws Exception {
publish("message content", "producer-client-id-0", "x/y/z");
}
}
class PushCallback implements MqttCallback {
private String threadId;public PushCallback(String threadId) {
this.threadId = threadId;
} public void connectionLost(Throwable cause) {
cause.printStackTrace();
} public void deliveryComplete(IMqttDeliveryToken token) {
System.out.println("服务器是否正确接收---------" + token.isComplete());
} public void messageArrived(String topic, MqttMessage message) throws Exception {
String msg = new String(message.getPayload());
System.out.println(threadId + " " + msg);
}
}
package com.study.mq.a2_mqtt; import org.eclipse.paho.client.mqttv3.IMqttMessageListener;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; public class MqttConsumer {
private static int qos = 2;
private static String broker = "tcp://activemq.tony.com:1883";
private static String userName = "admin";
private static String passWord = "admin";private static MqttClient connect(String clientId) throws MqttException {
MemoryPersistence persistence = new MemoryPersistence();
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setCleanSession(false);
connOpts.setUserName(userName);
connOpts.setPassword(passWord.toCharArray());
connOpts.setConnectionTimeout(10);
connOpts.setKeepAliveInterval(20);
MqttClient mqttClient = new MqttClient(broker, clientId, persistence);
mqttClient.connect(connOpts);
return mqttClient; } public static void sub(MqttClient mqttClient, String topic) throws MqttException {
int[] Qos = {qos};
String[] topics = {topic};
mqttClient.subscribe(topics, Qos, new IMqttMessageListener[]{(s, mqttMessage) -> {
System.out.println("收到新消息" + s + " > " + mqttMessage.toString());
}});
} private static void runsub(String clientId, String topic) throws MqttException {
MqttClient mqttClient = connect(clientId);
if (mqttClient != null) {
sub(mqttClient, topic);
}
} public static void main(String[] args) throws MqttException {
runsub("consumer-client-id-1", "x/y/z");
}
}
发布订阅
订阅这个topic的客户端都会收到消息
package com.study.mq.a1_example.helloworld.topic; import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.*; // 发布订阅 - 1个生产者对多个消费者
public class Producer {
public static void main(String[] args) {
// brokerUrl: http://activemq.apache.org/connection-configuration-uri.html
new ProducerThread("tcp://activemq.tony.com:61616", "topic1").start();
}static class ProducerThread extends Thread {
String brokerUrl;
String destinationUrl; public ProducerThread(String brokerUrl, String destinationUrl) {
this.brokerUrl = brokerUrl;
this.destinationUrl = destinationUrl;
} @Override
public void run() {
ActiveMQConnectionFactory connectionFactory;
Connection conn;
Session session; try {
// 1、创建连接工厂
connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
// 2、创建连接对象md
conn = connectionFactory.createConnection();
conn.start();
// 3、创建会话
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
// 4、创建发布的目标 topic
Destination destination = session.createTopic(destinationUrl);
// 5、创建生产者消息
MessageProducer producer = session.createProducer(destination);
// 设置生产者的模式,有两种可选 持久化 / 不持久化
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
// 6、创建一条文本消息
String text = "Hello world!";
TextMessage message = session.createTextMessage(text);
for (int i = 0; i < 1; i++) {
// 7、发送消息
producer.send(message);
}
// 8、 关闭连接
session.close();
conn.close();
} catch (JMSException e) {
e.printStackTrace();
}
}
}
}
package com.study.mq.a1_example.helloworld.topic;
import org.apache.activemq.ActiveMQConnectionFactory;
import javax.jms.*;
// 非持久订阅者
// 非持久订阅只有当客户端处于连接状态才能收到发送到某个主题的消息,
// 而当客户端处于离线状态,这个时间段发到主题的消息它永远不会收到
public class Consumer {
    public static void main(String[] args) {
        new ConsumerThread("tcp://activemq.tony.com:61616", "topic1").start();
        new ConsumerThread("tcp://activemq.tony.com:61616", "topic1").start();
    }
}
class ConsumerThread extends Thread {
    String brokerUrl;
    String destinationUrl;
    public ConsumerThread(String brokerUrl, String destinationUrl) {
        this.brokerUrl = brokerUrl;
        this.destinationUrl = destinationUrl;
    }
    @Override
    public void run() {
        ActiveMQConnectionFactory connectionFactory;
        Connection conn;
        Session session;
        MessageConsumer consumer;
        try {
            // brokerURL http://activemq.apache.org/connection-configuration-uri.html
            // 1、创建连接工厂
            connectionFactory = new ActiveMQConnectionFactory(this.brokerUrl);
            // 2、创建连接对象
            conn = connectionFactory.createConnection();
            conn.start(); // 一定要启动
            // 3、创建会话(可以创建一个或者多个session)
            session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
            // 4、创建订阅的目标 topic  一条消息,多个订阅者接收
            Destination destination = session.createTopic(destinationUrl);
            // 5、创建消费者消息 http://activemq.apache.org/destination-options.html
            consumer = session.createConsumer(destination);
            // 6、接收消息(没有消息就持续等待)
            Message message = consumer.receive();
            if (message instanceof TextMessage) {
                System.out.println("收到文本消息:" + ((TextMessage) message).getText());
            } else {
                System.out.println(message);
            }
            consumer.close();
            session.close();
            conn.close();
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
MQTT Spring使用
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-mqtt</artifactId>
        </dependency>
package mqtt; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.IMqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.Pollers;
import org.springframework.integration.dsl.SourcePollingChannelAdapterSpec;
import org.springframework.integration.endpoint.MessageProducerSupport;
import org.springframework.integration.handler.LoggingHandler;
import org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory;
import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter;
import org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler;
import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException; import java.util.function.Consumer; @SpringBootApplication
public class MqttApplication {
private static final Log LOGGER = LogFactory.getLog(MqttApplication.class);public static void main(final String... args) {
// https://spring.io/projects/spring-integration
// https://github.com/spring-projects/spring-integration-samples/
SpringApplication.run(MqttApplication.class, args);
} @Bean
public MqttPahoClientFactory mqttClientFactory() {
DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
MqttConnectOptions options = new MqttConnectOptions();
options.setServerURIs(new String[]{"tcp://activemq.tony.com:1883"});
options.setUserName("admin");
options.setPassword("admin".toCharArray());
factory.setConnectionOptions(options);
return factory;
} // publisher
@Bean
public IntegrationFlow mqttOutFlow() {
// IntegrationFlows.from 数据来源,可以设定为每秒去取数据
return IntegrationFlows.from(() -> "hello mqtt", new Consumer<SourcePollingChannelAdapterSpec>() {
@Override
public void accept(SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) {
sourcePollingChannelAdapterSpec.poller(Pollers.fixedDelay(1000));
}
})
.transform(p -> p + " sent to MQTT")
.handle(mqttOutbound())
.get();
} @Bean
public MessageHandler mqttOutbound() {
// 创建handller
MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler("client-si-producer-0", mqttClientFactory());
messageHandler.setAsync(true);
messageHandler.setDefaultTopic("x/y/z");
return messageHandler;
} // consumer
@Bean
public IntegrationFlow mqttInFlow() {
return IntegrationFlows.from(mqttInbound())
.transform(p -> p + ", received from MQTT")
.handle(printHandler())
.get();
} private MessageHandler printHandler() {
return new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessagingException {
System.out.println(message.getPayload().toString());
}
};
} @Bean
public MessageProducerSupport mqttInbound() {
MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter("client-si-consumer-1",
mqttClientFactory(), "x/y/z");
adapter.setCompletionTimeout(5000);
adapter.setConverter(new DefaultPahoMessageConverter());
adapter.setQos(1);
return adapter;
}
}
Websocket
只是一个连接方式


package com.study.mq.a3_websocket_stomp; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.transport.stomp.Stomp;
import org.apache.activemq.transport.stomp.StompConnection;
import org.apache.activemq.transport.stomp.StompFrame; import javax.jms.*; // http://activemq.apache.org/stomp.html
public class ConsumerAndProducerStomp {
public static void main(String[] args) throws Exception {
// 直接用Stomp代码的方式
ConsumerAndProducerStomp.stompTest();
}public static void stompTest() throws Exception {
StompConnection connection = new StompConnection();
connection.open("activemq.tony.com", 61613); connection.connect("system", "manager"); // 发送两条数据
connection.begin("tx1");
connection.send("/topic/test-stomp", "message1");
connection.send("/topic/test-stomp", "message2");
connection.commit("tx1"); // 订阅/topic/test-stomp
connection.subscribe("/topic/test-stomp", Stomp.Headers.Subscribe.AckModeValues.CLIENT); connection.begin("tx2");
// 接收数据并打印
StompFrame message = connection.receive();
System.out.println(message.getBody());
connection.ack(message, "tx2");
// 继续接收
message = connection.receive();
System.out.println(message.getBody());
connection.ack(message, "tx2"); connection.commit("tx2");
connection.disconnect();
}
}


连接协议和消息协议是不同的,连接协议是tcp之类的,消息协议是AMQP
消息中间件-ActiveMQ支持的消息协议的更多相关文章
- ActiveMQ支持的消息协议
		
ActiveMQ支持哪些协议 ActiveMQ支持多种协议传输和传输方式,允许客户端使用多种协议连接ActiveMQ支持的协议:AUTO,OpenWire,AMQP,Stomp,MQTT等Active ...
 - ActiveMQ学习笔记(7)----ActiveMQ支持的传输协议
		
1. 连接到ActiveMQ Connector: Active提供的,用来实现连接通讯的功能,包括:client-to-broker,broker-to-broker.ActiveMQ允许客户端使用 ...
 - 分布式-信息方式-ActiveMQ支持的传输协议和配置
		
ActiveMQ支持的传输协议和配置■ Connector: ActiveMQ提供的,用来实现连接通讯的功能.包括: client-to-broker ...
 - ActiveMQ支持的传输协议
		
------------------------------------------------------ ActiveMQ支持的client-broker通讯协议有:TCP.NIO.UDP.SSL ...
 - JMS学习十(ActiveMQ支持的传输协议)
		
ActiveMQ提供了一种连接机制,这种连接机制使用传输连接器(TransportConnector)实现客户端与代理(client - to - broker)之间的通信. 网络连接器(networ ...
 - 消息中间件-activemq实战之消息持久化(六)
		
对于activemq消息的持久化我们在第二节的时候就简单介绍过,今天我们详细的来分析一下activemq的持久化过程以及持久化插件.在生产环境中为确保消息的可靠性,我们肯定的面临持久化消息的问题,今天 ...
 - 消息中间件ActiveMQ使用详解
		
消息中间件ActiveMQ使用详解 一.消息中间件的介绍 介绍  消息队列 是指利用 高效可靠 的 消息传递机制 进行与平台无关的 数据交流,并基于 数据通信 来进行分布式系统的集成. 特点(作用) ...
 - 消息中间件--ActiveMQ&JMS消息服务
		
### 消息中间件 ### ---------- **消息中间件** 1. 消息中间件的概述 2. 消息中间件的应用场景 * 异步处理 * 应用解耦 * 流量削峰 * 消息通信 --------- ...
 - 消息中间件-activemq消息机制和持久化介绍(三)
		
前面一节简单学习了activemq的使用,我们知道activemq的使用方式非常简单有如下几个步骤: 创建连接工厂 创建连接 创建会话 创建目的地 创建生产者或消费者 生产或消费消息 关闭生产或消费者 ...
 
随机推荐
- NGK主网上线后内存价格上涨30倍,NGK RAM是否值得买入?
			
美国加州时间10月14日上午10时,NGK主网正式上线.因为市场预期向好,NGK上线以后迎来了大涨,NGK的代币价格上涨了10倍,内存价格上涨了30倍.目前,NGK上线已经有五天的时间,盘面上已经出现 ...
 - JDK环境解析,安装和目的
			
目录 1. JDK环境解析 1.1 JVM 1.2 JRE 1.3 JDK 2. JDK安装 2.1 为什么使用JDK8 2.1.1 更新 2.1.2 稳定 2.1.3 需求 2.2 安装JDK 2. ...
 - Vue为何采用异步渲染
			
Vue为何采用异步渲染 Vue在更新DOM时是异步执行的,只要侦听到数据变化,Vue将开启一个队列,并缓冲在同一事件循环中发生的所有数据变更,如果同一个watcher被多次触发,只会被推入到队列中一次 ...
 - SpringBoot(三):SpringBoot热部署插件
			
SpringBoot热部署插件 在实际开发中,我们修改了某些代码逻辑功能或页面都需要重启应用,这无形中降低了开发效率!热部署是指当我们修改代码后,服务能自动启动加载新修改的内容,这样大大提高了我们开发 ...
 - 后端程序员之路 37、Akka、Actor、Scala初窥
			
Akkahttp://akka.io/ Akka 是一个用 Scala 编写的库,用于简化编写容错的.高可伸缩性的 Java 和 Scala 的 Actor 模型应用,是一个广泛运用的分布式应用框架. ...
 - 机械硬盘换固态硬盘&重装系统
			
起初 笔记本电脑购买于2016年底,i7四代处理器,940M显卡,4G内存,500G固态硬盘,这样的配置已经跟不上使用需求了.于是先把内存条升级成了单根8G金士顿内存条,豁然发现使用chrome浏览器 ...
 - 一篇文章彻底弄懂Android-MVVM
			
转: 一篇文章彻底弄懂Android-MVVM 在学习一个技术之前,我们首先要搞清为什么要用它.用它以后会有什么好处,这样我们才能有兴趣的学习下去. 一.为什么要用MVVM? 我为什么要用这个什么MV ...
 - 内核报错kernel:NMI watchdog: BUG: soft lockup - CPU#1
			
1.现象描述 系统管理员电话通知,描述为一台服务器突然无法ssh连接,登录服务器带外IP地址并进入远程控制台界面后,提示Authentication error,重启后即可正常进入系统,进入后过20分 ...
 - ant-design-vue中table自定义列
			
1. 使用背景 在项目中使用ant-vue的a-table控件过程中,需要显示序号列或者在列中显示图片,超链,按钮等UI信息.经过查询文档customCell和customRender可以实现以上需求 ...
 - WIFI6 基本知识(二)
			
WI-FI6核心技术 WI-FI6除了继承了WI-FI5的所有MIMO特性之外,还增加了许多针对高密部署场景的特性.以下是WI-FI6的核心新特性: OFDMA频分复用技术 DL/UL MU-MIMO ...