我正在浏览 Apache ActiveMQ example并面对 vm
前缀如下:
ActiveMQConnectionFactory connectionFactory =
new ActiveMQConnectionFactory("vm://localhost");
这是什么意思?顺便说一句,当我连接到消息代理时,我基本上使用像 tcp://localhost:61616
这样的地址。
最佳答案
虽然 Rahul 是正确的,但我认为在答案中添加一些上下文是有意义的。
因此,vm 代表虚拟机,这是 Java 中非常核心的概念。 Java 程序在虚拟机中执行。
关于您的特定 ActiveMQ 案例的更多信息,解释了 vm:// 和 tcp:// 之间的区别,可以阅读 here :
In the same JVM clients can then use the vm:// transport to connect to the embedded broker - whilst external clients can use the tcp:// protocol
关于java - 地址行中的 vm 前缀是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30931886/