JNDI support differences between Tibco EMS and ActiveMQ
Introduction
Recently our team was working on Veracity Quick Start sprint, when I was trying to migrate the JMS provider implementation from Tibco EMS to ActiveMQ. I found that there are notable differences between these two JMS implementations on their JNDI support, which will be illustrated below.
Code to demonstrate
Code below is a main function which use Java JNDI API to retrieve JMS queue and topic. We will try each implementation by put relevant INITIAL_CONTEXT_FACTORY and PROVIDER_URL into the props object.
public class Main {
public static void main(String[] args) throws Exception {
Properties props = new Properties();
// ActiveMQ
// props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
// props.put(Context.PROVIDER_URL, "tcp://localhost:61616");
// Tibco
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.tibco.tibjms.naming.TibjmsInitialContextFactory");
props.put(Context.PROVIDER_URL, "tibjmsnaming://localhost:7222");
// create a new intial context
javax.naming.Context ctx = new javax.naming.InitialContext(props);
// lookup an existing topic
javax.jms.Topic myTopic = (javax.jms.Topic) ctx.lookup("MyTopic");
System.out.println(myTopic);
// lookup an existing queue
javax.jms.Queue myQueue = (javax.jms.Topic) ctx.lookup("MyQueue");
System.out.println(myQueue);
}
}
Try Tibco EMS
When using Tibco EMS, in order to let the code run successfully, i.e. retrieved myTopic and myQueue objects:
1) There must be a Tibco JMS server running on localhost:7222.
2) A topic named MyTopic and a queue named MyQueue must already be defined.
No other configuration files needed.
Try ActiveMQ
When you try ActiveMQ(uncomment line 5 and 6, and comment line 9 and 10), things are little different:
1) You don’t need to have MyTopic and MyQueue already exists on ActiveMQ server.
2) You even needn’t have a server running at localhost:61616.
3) Put a jndi.properties file on your class path, in which you predefined the wanted queues and topics:
Or use a little different syntax when invoke lookUp in your java code: use dynamicTopics/MyTopic instead of MyTopic, and dynamicQueues/MyQueue instead of MyQueue.
Conclusion
I checked the documentation of both products, also relevant sections in the book ActionMQ in action, and figure out the differences about their JNDI capability:
1) Tibco EMS implements a server-side JNDI provider, you actually need to communicate to server to get your defined queues and topics.
2) ActiveMQ implements a client-side JNDI provider, no communication with server is needed.
When you get queue or topic object by a name passing to lookUp(), it doesn’t means they already exist on server, nor they will be created at that moment. ActiveMQ queues and topics are dynamically created when you actually use them, for example, when you actually send a message to a queue.
Suffice to say, the JNDI support is completely local and has nothing to do with server.
JNDI support differences between Tibco EMS and ActiveMQ的更多相关文章
- tibco EMS 8.2.0安装
安装环境 序号 项目 值 1 OS版本 Red Hat Enterprise Linux Server release 7.1 (Maipo) 2 内核版本 3.10.0-229.el7.x86_64 ...
- Spring 整合 Tibco EMS
参考文档: http://haohaoxuexi.iteye.com/blog/1893038 http://www.blogjava.net/chenhui7502/archive/2011/08 ...
- TIBCO EMS安装部署
创建用户 groupadd -g 800 tibcouseradd -u 801 -g tibco -d /home/tibco/ -s /bin/bash tibco 目前关于sharedatast ...
- ActiveMQ(5.10.0) - JNDI Support
1. Place the jndi.properties file on the classpath. java.naming.factory.initial = org.apache.activem ...
- python 使用 tibco ems
emshelper.py #encoding=utf-8 import jpype jvmpath=r"C:\Program Files\Java\jre1.8.0_161\bin\serv ...
- 使用Tomcat、JNDI与ActiveMQ实现JMS消息通信服务
前言 之所以使用JNDI 是出于通用性考虑,该例子使用JMS规范提供的通用接口,没有使用具体JMS提供者的接口,这样可以保证我们编写的程序适用于任何一种JMS实现(ActiveMQ.HornetQ等) ...
- Table of Contents - ActiveMQ
Getting Started ActiveMQ 的安装 Hello World Configuring Standard ActiveMQ Components Connecting to Acti ...
- eclipse内嵌jetty(run-jetty-run插件) 配置jndi数据源
运行环境 java 6,eclipse juno,ssh(spring,hibernate,springmvc ) 1.离线安装 下载地址:http://pan.baidu.com/s/1qX67wO ...
- 基于ActiveMQ的统一日志服务
概述 以ActiveMQ + Log4j + Spring的技术组合,实现基于消息队列的统一日志服务. 参考:Spring+Log4j+ActiveMQ实现远程记录日志——实战+分析 与参考文章的比较 ...
随机推荐
- SQL Server 造成cpu 使用率高的 6 原因
第一种: 编译和重编译执行计划. 第二种: 排序与聚合. 第三种: 表格连接操作. 第四种: max degree of parallelism. 第五种: max worker threads. 第 ...
- python学习day8
目录 一.异常 二.多线程 三.守护线程与join 四.GIL与多线程锁 五.递归锁与信号量 六.线程间同步与交互 七.多进程 八.进程间通信与数据共享 九.进程池 一.异常 1.异常处理 在编程过程 ...
- IDEA12 KeyGen Download List
When you use IDEA to develop Java, you can use the following file to generate lincese. Because CNBlo ...
- USB学习小记-HID类键盘的报告描述符的理解
前言 断断续续的学习了将近三个月,才把USB的HID类搞明白,速度真是够慢的.利用晚上+周末的时间学习自己的东西确实是必要的,不过效率是有点低,以后要更专注一些才行,希望自己能做到吧. 在学习过程中, ...
- cf467C George and Job
C. George and Job time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- 虚拟机使用PuTTY、SSH Secure Shell Client前的配置
1 仅主机模式 2 检查子网IP 为192.168.154.0 3 进入虚拟机,检查IP地址 ip addr show 添加IP地址 ip addr add dev eno16777736 192.1 ...
- OC基础13:数字、字符串和集合2
"OC基础"这个分类的文章是我在自学Stephen G.Kochan的<Objective-C程序设计第6版>过程中的笔记. 17.Foundation框架的数组是有序 ...
- 【设计模式】学习笔记13:组合模式(Composite)
本文出自 http://blog.csdn.net/shuangde800 认识组合模式 上一篇中,我们可以用迭代器来实现遍历一个集合(数组,ArrayList, Vector, HashTabl ...
- android卸载反馈实现
博客原地址:http://blog.csdn.net/wang_shaner/article/details/41543787 实现原理 fork分叉函数 fork分叉(分裂)函数可以创建一个新进程, ...
- Bctf-pwn_ruin-re_lastflower
Pwn-ruin 用几个词来概括下漏洞原理:Arm+heap overflow(house of force)+dl-resolve Info leak: 在printf key8时,泄漏堆上地址(s ...