Broker这个词汇,在使用Action MQ进行相关开发,配置,查阅文章了解时,都经常出现!但又不知道它究竟在其Action MQ带表的是什么,到底有啥用处!懵懵懂懂的,不慎了解!
我这里抛几个地方的打印数据给你看,先有个概念再说其含义:
编码处:
在执行链接Action MQ时
QueueConnectionFactory connectFactory = new ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_USER,
ActiveMQConnection.DEFAULT_PASSWORD, "tcp://localhost:61616");
QueueConnection connection = connectFactory.createQueueConnection();
如果你没有打开运行ActionMQ\apache-activemq-5.15.3\bin\win64\activemq时会报
javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616
出现broker URL
运行activemq处:
在执行ActionMQ包下的activemq时:
jvm 1 | INFO | PListStore:[D:\ActionMQ\apache-activemq-5.15.3\bin\win64\..\.
.\data\localhost\tmp_storage] started
jvm 1 | INFO | Apache ActiveMQ 5.15.3 (localhost, ID:MS-20160107HQXN-56946-1
526888200761-0:1) is starting
jvm 1 | INFO | Listening for connections at: tcp://MS-20160107HQXN:61616?max
imumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1 | INFO | Connector openwire started
jvm 1 | INFO | Listening for connections at: amqp://MS-20160107HQXN:5672?max
imumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1 | INFO | Connector amqp started
jvm 1 | INFO | Listening for connections at: stomp://MS-20160107HQXN:61613?m
aximumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1 | INFO | Connector stomp started
jvm 1 | INFO | Listening for connections at: mqtt://MS-20160107HQXN:1883?max
imumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1 | INFO | Connector mqtt started
jvm 1 | WARN | ServletContext@o.e.j.s.ServletContextHandler@69999b94{/,null,
STARTING} has uncovered http methods for path: /
jvm 1 | INFO | Listening for connections at ws://MS-20160107HQXN:61614?maxim
umConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1 | INFO | Connector ws started
jvm 1 | INFO | Apache ActiveMQ 5.15.3 (localhost, ID:MS-20160107HQXN-56946-1
526888200761-0:1) started
我们在看下Broker的相关API方法,你就有点懂啦:
BrokerService bs = new BrokerService();
bs.addConnector("tcp://localhost:61636");
bs.start();
是不是有点是懂非懂了点啦
我们接下来说:
说白啦,通过运行activemq其实就包含了
BrokerService bs = new BrokerService();
bs.addConnector("tcp://localhost:61636");
bs.start();
这3个代码的运行 但我们也可以通过编码BrokerService类进行一些配置 感兴趣的可以看下API
以上的介绍:差不不多我们也有一定的了解啦
ActionMQ它是怎么把发送端的数据传送到接受端的呢 就是通过broker
说白啦:broker 帮你把消息从发送端传送到接收端
通俗来讲就是指该MQ的服务端 包含了很多消息传递的功能设置,例如缓存保存时间,最大消费者接入数等等
还有种说法就是消息协商器或则叫消息代理(Message Broker)主要是负责消息数据的相互接受与发送.
原理图:
发送端(Product)把数据发送到Broker
接收端(Consumer)从Broker接受数据
至于数据怎么存,在高并发的时候,采不采用负载均衡,看你怎么玩它啦
差不多Broker是什么东西,你差不多清晰了吧!