中间件技术及其在分布式系统中的应用-王春明

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

王春明(,226007):文章介绍了中间件技术及消息中间件的概念,对SUN公司提出的JMS标准进行了分析,提出了一个基于JMS消息中间件的分布式应用方法.:中间件;分布式系统;JMS:TP393.09:A:(200341):(1962-),,,,,.:1673-2340(2006)01-0071-03MiddlewareTechnologyandItsApplicationtoDistributedSystemWANGChun-ming(SchoolofComputerScience,NantongUniversity,Nantong226007,China)Abstract:ThepaperintroducestheconceptsofmiddlewaretechnologyandmessagemiddlewareandanalyzestheJMSstandardsuggestedbySUNCompany,therebyputtingforwardadistributedapplicationmethodbasedonJMSmiddleware.Keywords:middleware;distributedsystem;JMS,.,.,,.,.6,/.,SUNJMS(JavaMessageService),JMS.1/0,,,,.,API,,1.:,API,.(MessageOrientedMiddleware,MOM),,,.,.()JournalofNantongUniversity(NaturalScience)第5卷第1期2006年3月Vol.5No.1Mar.2006#72#()2006,.2JMSJMSSUNJAVAMOM.,(/).JMSAPI,JMS,,.JMS4:JMS,JMS2.,(ConnectionFactory)(Connection).Connection,.(Destination).(Session)JMS,,Session.(MessageProducer)(MessageConsumer)Session,.JMSAPI,(PTP)-(PUB/SUB).PTP,,,,.PUB/SUB(Topic),,,,.PTP.JMS:(1)QueueConnectionFactoryJNDIAPI;(2);(3)QueueSender;(4)TextMessage;(5);(6);(7)Finally,QueueSender.JMS:(1)QueueConnectionFactoryJNDIAPI;(2);(3)QueueReceiver;(4),;(5),;(6)Finally,QueueReceiver.JMS,.,.3JMS,,,,.3,3.,Web,WebJSP,Applet;,,J2EE,WebJMSEJB,WebWeb,-,JMS,EJB;,#73#:.(PTP),WebAppletJMS,;EJBonMessageListenerJMS,onMessage,.,,EJBEJB.Applet:publicclassMessageClientextendsjava.Applete.applet{......publicBooleanmessageSend(StringjndiConnectFactory,StringjndiQueue,StringItemId,doubleItemBid){try{ContextjndiContext=newInitialContext();QueueConnectionFactoryqueueConnectionFactory=(QueueConnectionFactory)jndiContext.lookup(jndiConnectionFactory);Queuequeue=(Queue)jndiContext.lookup(jndiQueue);QueueSessionqueueSession=queueConnec-tion.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);QueueSenderqueueSender=queueSession.createSender(queue);MapMessage.message=queueSession.createMapMessage();message.setString(ItemID,itemID);message.setDouble(ItemBid,itemBid);queueSender.send(messgae);returntrue;}catch(e){returnfalse;}}}EJB:publicvoidonMessage(javax.jms.Messagemsg){StringitemID=null;doubleitemBid=-1;try{if(msginstanceofMapMessage){javax.jms.MapMessage.map=(javax.jms.MapMessage)msg;itemID=map.getString(itemID);itemBid=map.getDouble(itemBid);......}}catch(e){...}}4,.,,.J2EEEJBJMSAPI,,JMSAPI,J2EE.,,.:[1].J2EE[M].:,2003.[2][]HenryXie.J2EE[M].:,2003.[3][]MarkHapner.JavaAPI:J2EE[M].:,2002.

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功