- 浏览: 240676 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
akka_li:
学习了!但是为什么后续的没有了?!
EJB4:RMI和RMI-IIOP -
springaop_springmvc:
apache lucene开源框架demo使用实例教程源代码下 ...
Lucene学习笔记(一)Lucene入门实例 -
qepipnu:
求solr 客户端 jar包
Solr学习笔记(三)Solr客户端开发实例 -
zhangbc:
是这问题,赞!
Oracle Start Up 2 Oracle 框架构件、启动、解决一个问题 -
feilian09:
查询 select hibernate jdbc 那个效率快
Hibernate,JDBC性能探讨
This section I will concertate on the difference of messaging mechenism with old platform Jboss.
1. Queue Test
Firstly, deploy a Queue on EAP-5.1 Jboss, create 'homeTest-service.xml' file under $JBOSS_HOME\server\default\deploy\messaging, and the 'homeTest-service.xml' contain text as following:
<mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=testQueue" xmbean-dd="xmdesc/Queue-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends>jboss.messaging:service=PostOffice</depends> <attribute name="SecurityConfig"> <security> <role name="guest" read="true" write="true"/> <role name="publisher" read="true" write="true" create="false"/> <role name="noacc" read="false" write="false" create="false"/> </security> </attribute> </mbean>
this is testQueue MBean definition descrption, and then creates a Java Message Service connection to a JBoss Messaging instance and uses it to create a session and a message producer, which sends a message to the queue/testQueue, then uses that connection to create a consumer that reads a single message from the queue. This test is considered successful if the message consumer receives, without error, the message that was sent by the producer, And Output the send text message.
The Test Code as Following:
private void run() { String destinationName = JMSUtil.getDestTestQueue(); InitialContext ic = null; ConnectionFactory cf = null; Connection connection = null; try { ic = JMSUtil.getInitialContext(true, "127.0.0.1"); cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); Queue queue = (Queue)ic.lookup(destinationName); JMSUtil.log("Queue " + destinationName + " exists"); connection = cf.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer sender = session.createProducer(queue); TextMessage message = session.createTextMessage("Kylin Soong"); sender.send(message); JMSUtil.log("The message was successfully sent to the " + queue.getQueueName() + " queue"); MessageConsumer consumer = session.createConsumer(queue); connection.start(); message = (TextMessage)consumer.receive(2000); JMSUtil.log("Recieve Msg: " + message.getText()); JMSUtil.displayProviderInfo(connection.getMetaData()); } catch (Exception e) { e.printStackTrace(); } }
The Code is very simple, howerver, to make this code work spent bunchs of work, that's because new Version Jboss split Jbossall-client.jar into more little piece, In old version we only add Jbossall-client.jar on jar to classpath, and now we must add the following jar:
After add this complete, the above code working, and the output as following:
2011-08-02 21:09:10 [INFO] Queue /queue/testQueue exists 2011-08-02 21:09:11 [INFO] The message was successfully sent to the testQueue queue 2011-08-02 21:09:11 [INFO] Recieve Msg: Kylin Soong
2. Topic Test
Just like the testQueue Test, topic test almost do the same thing as queue test, this test creates a Java Message Service (JMS) connection to a JBoss Messaging instance and uses it to create a session, a publisher, and a subscriber. The publisher sends a message to the topic. The test is considered successful if the subscriber receives the message. Also like queue test text message has been sent by publisher, the subscriber recieves the message and extract the text and output though log mechanism, The same Operation, before Code test we should deploy testTopic firstly, also like deploy testQueue, this time only need to add Topic referenced mbean to 'homeTest-service.xml', the mbean contents as following:
<mbean code="org.jboss.jms.server.destination.TopicService" name="jboss.messaging.destination:service=Topic,name=testTopic" xmbean-dd="xmdesc/Topic-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends>jboss.messaging:service=PostOffice</depends> <attribute name="SecurityConfig"> <security> <role name="guest" read="true" write="true"/> <role name="publisher" read="true" write="true" create="false"/> <role name="durpublisher" read="true" write="true" create="true"/> </security> </attribute> </mbean>
As usual, Topic Test Code:
private void run() { String destinationName = JMSUtil.getDestTestTopic(); InitialContext ic = null; Connection connection = null; try { ic = JMSUtil.getInitialContext(true, "127.0.0.1"); ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); Topic topic = (Topic) ic.lookup(destinationName); JMSUtil.log("Topic " + destinationName + " exists"); connection = cf.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer publisher = session.createProducer(topic); MessageConsumer subscriber = session.createConsumer(topic); TopicTestListener messageListener = new TopicTestListener(); subscriber.setMessageListener(messageListener); connection.start(); TextMessage message = session.createTextMessage("Kylin Soong"); publisher.send(message); JMSUtil.log("The message was successfully published on the topic"); messageListener.waitForMessage(); message = (TextMessage)messageListener.getMessage(); JMSUtil.log("Received message: " + message.getText()); JMSUtil.displayProviderInfo(connection.getMetaData()); } catch (Exception e) { e.printStackTrace(); } }
This time is more easier to make topic test code work, the out is as following:
2011-08-02 22:15:25 [INFO] Topic /topic/testTopic exists 2011-08-02 22:15:26 [INFO] The message was successfully published on the topic 2011-08-02 22:15:26 [INFO] Received message: Kylin Soong
发表评论
-
Java Nio Usage Demo & A example of use selectableChannel
2011-12-06 21:42 3702Primary purpose of this blog is ... -
JDK Source Code & java.nio
2011-11-10 23:26 2412java.nio is very useful and a p ... -
Oracle - Add Exist Validation Before Create Table
2011-11-07 13:49 1463Usually we need to check the ta ... -
JDK Source Code & java.rmi.server.RMISocketFactory
2011-10-31 23:14 2199Today's Source code analysing s ... -
JMX Architecture & "Hello Word" the JMX way
2011-10-25 20:07 1819JMX Architecture Overview: JMX ... -
Thinking in JDBC
2011-09-22 20:56 1883This blog will beas on a series ... -
Jboss-eap-5.1 starting up note
2011-07-26 22:46 2593Jboss enterprise platform 5 hav ... -
EJB Security & JAAS Demo
2011-05-21 19:39 1616PROLOGUE: When deploying ... -
JBoss LoginInitialContext Factory Implementation
2011-05-15 16:05 1537Jboss has a series of imp ... -
Jboss Reference Exception Gallery
2011-04-27 14:08 28981. Unable to locate a login con ... -
Hibernate Annotation 的一个问题,给点意见
2011-03-10 12:43 22问题:org.hibernate.annotations. ... -
大家说说BBC的网站用的是什么技术做的
2011-02-22 05:01 1442最近在英国出差,发现这里的一些网站做的相当有特色,有些网站不是 ... -
Hibernate OneToMany 单向和双向配置对数据存取性能的比较
2011-02-08 17:06 23341. 开篇说明:今天是春 ... -
对Hibernate属性(CascadeType、JoinColumn、JoinTable、ForeignKey等)的研究
2010-12-26 15:45 16689本文列出几个“EJB 学习阶段总结:JBoss下发布一个Toy ... -
EJB 学习阶段总结:JBoss下发布一个Toy企业应用
2010-12-25 12:11 2647解释题目:为什 ... -
EJB7: Message Driven Bean
2010-12-21 22:42 2153在企业系统中需要使用 ... -
EJB6: EntityBean例子
2010-11-26 14:48 1515本例子描述向EJB容器(JBoss)部署http: ... -
JPA dev: 几个问题总结(续)
2010-11-25 18:02 24892. 如何由PoJo类生成数据库中的表 首先可以根据实体间关 ... -
JPA dev: 几个问题总结
2010-11-25 16:56 3409最近工作中遇到几个与JPA相关的问题,本文通过一个例子总结一下 ... -
JAXB学习
2010-11-24 22:35 01 什么是JAXB? JAXB全称Java Ar ...
相关推荐
JBoss EAP 6.4 是 Red Hat 提供的一个企业级应用服务器,它基于 Java EE 6 规范,提供了全面的中间件服务,用于构建、部署和管理企业级应用程序。这个版本是 JBoss 产品线的一个关键里程碑,因为它包含了众多功能...
【JBoss EAP 7.2.0:企业级应用平台详解】 JBoss EAP(Enterprise Application Platform)是Red Hat公司推出的一款开源、基于Java EE(现在称为Jakarta EE)的应用服务器,它为企业级应用程序提供了稳定、安全和可...
jboss-eap-fp-src-4.3.0.CP05_FP01.zip jboss-eap-fp-src-4.3.0.CP05_FP01.zip
最后,要更改Web工程的根目录,需要创建一个名为`jboss-web.xml`的文件,在`webroot/WEB-INF/`目录下。文件内容应包含`<context-root>`标签,用于定义Web应用的上下文路径。例如,设置`<context-root>/</context-...
- `jboss-eap-7.2.6.CP`: 这是 JBoss EAP 7.2.6 的累积补丁,它整合了从 7.2.1 到 7.2.5 的所有 GA 补丁,并可能额外包含其他修复或改进。 3. **应用补丁的过程** 应用 JBoss EAP 补丁通常涉及以下步骤: - 验证...
标题中的"jboss-eap-5.2.0.zip"指的是JBoss EAP的5.2.0版本的压缩包,这是在JDK 1.6环境下运行的。这个版本的发布对于那些需要维护或升级旧系统的开发者来说至关重要,因为它提供了对较早技术栈的支持。 **JBoss ...
在使用JBoss EAP 6.2.0时,用户可以通过解压提供的“jboss-eap-6.2”压缩包文件来安装和配置服务器。这个压缩包内包含了完整的JBoss EAP 6.2.0安装文件,包括服务器二进制文件、配置文件、文档以及示例应用程序。...
在本压缩包"jboss-eap-6.3.0软件和源码.zip"中,包含了JBoss EAP 6.3.0的完整安装文件以及源码,这对于开发者和系统管理员来说是非常宝贵的资源,可以深入理解其工作原理并进行定制化开发。 1. **JBoss EAP核心概念...
JBoss EAP 7.1.0 是一个企业级的应用服务器,由Red Hat开发并维护,它是Java EE(现在称为Jakarta EE)平台的一个实现。这个版本提供了多种服务和功能,用于构建、部署和管理企业级Java应用程序。下面将详细讨论...
### jboss-eap-4.3 webconsole无法登录的解决方案详解 #### 一、问题背景与现象 在项目开发过程中,有时会遇到需要使用特定版本的JBOSS应用服务器的情况。例如,在使用JBOSS EAP 4.3时可能会遇到无法登录Web ...
接下来,下载JBoss EAP 6.4.0的安装包`jboss-eap-6.4.0-installer.jar`,放置在`/home/Downloads`目录下。执行`java -jar jboss-eap-6.4.0-installer.jar`进行安装,根据提示设置安装路径和其他参数,包括管理员的...
jboss-eap-7.0.0-installer.jar~ ~
赠送jar包:jboss-logging-3.4.1.Final.jar; 赠送原API文档:jboss-logging-3.4.1.Final-javadoc.jar; 赠送源代码:jboss-logging-3.4.1.Final-sources.jar; 赠送Maven依赖信息文件:jboss-logging-3.4.1.Final....
赠送jar包:jboss-threads-3.1.0.Final.jar; 赠送原API文档:jboss-threads-3.1.0.Final-javadoc.jar; 赠送源代码:jboss-threads-3.1.0.Final-sources.jar; 赠送Maven依赖信息文件:jboss-threads-3.1.0.Final....
赠送jar包:jboss-logging-3.3.2.Final.jar; 赠送原API文档:jboss-logging-3.3.2.Final-javadoc.jar; 赠送源代码:jboss-logging-3.3.2.Final-sources.jar; 赠送Maven依赖信息文件:jboss-logging-3.3.2.Final....
赠送jar包:jboss-logging-3.4.3.Final.jar; 赠送原API文档:jboss-logging-3.4.3.Final-javadoc.jar; 赠送源代码:jboss-logging-3.4.3.Final-sources.jar; 赠送Maven依赖信息文件:jboss-logging-3.4.3.Final....
赠送jar包:jboss-annotations-api_1.3_spec-2.0.1.Final.jar; 赠送原API文档:jboss-annotations-api_1.3_spec-2.0.1.Final-javadoc.jar; 赠送源代码:jboss-annotations-api_1.3_spec-2.0.1.Final-sources.jar;...
JBoss EAP 6.3.0 是一个企业级的应用服务器,由Red Hat公司开发,是Java EE 6规范的实现。它提供了丰富的功能和工具,用于构建、部署和管理基于Java的应用程序。以下是关于JBoss EAP 6.3.0的一些关键知识点: 1. **...
JBoss EAP (Enterprise Application Platform) 7.4.0是一个Java应用服务器,提供了一套完整的开发、部署和管理企业级应用程序的解决方案。下面是对其解锁内容概要以及适合人群、使用场景和目标的简要说明: 解锁...
综上所述,"Redhat openjdk11和jboss-eap-7.4.0"组合为企业级Java开发提供了一个强大且稳定的平台。OpenJDK11的先进特性和性能提升,加上JBoss EAP 7.4.0对Java EE 8的全面支持和丰富的管理功能,使得这个组合成为了...