jboss jms配置
参见文档:http://www.jboss.org/file-access/default/members/jbossmessaging/freezone/docs/userguide-1.4.2.GA/html/index.html http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Server_Configuration_Guide/4/html/index.html O'Relly 中 EJB3中的: Almost anything that can be done with the pub/sub model can be done with point-to-point, and vice versa. An analogy can be drawn to developers' programming language preferences. In theory, any application that can be written with Pascal can also be written with C. Anything that can be written in C++ can also be written in Java. In some cases, it comes down to a matter of preference, or which model you are already familiar with. In most cases, the decision about which model to use depends on which model is a better fit for the application. With pub/sub, any number of subscribers can be listening on a topic, and all of them will receive copies of the same message. The publisher may not care if everybody is listening, or even if nobody is listening. For example, consider a publisher that broadcasts stock quotes. If any particular subscriber is not currently connected and misses out on a great quote, the publisher is not concerned. In contrast, a point-to-point session is likely to be intended for a one-on-one conversation with a specific application at the other end. In this scenario, every message really matters. The range and variety of the data the messages represent can be a factor as well. Using pub/sub, messages are dispatched to the consumers based on filtering that is provided through the use of specific topics. Even when messaging is being used to establish a one-on-one conversation with another known application, it can be advantageous to use pub/sub with multiple topics to segregate different kinds of messages. Each kind of message can be dealt with separately through its own unique consumer and onMessage( ) listener. Point-to-point is more convenient when you want a particular receiver to process a given message once. This is perhaps the most critical difference between the two models: p2p guarantees that only one consumer processes each message. This ability is extremely important when messages need to be processed separately but in tandem. publish/subscriber 是推送,当时没接到的就再接不到了(durable除外) 配置topic,以-service.xml结尾的xml文件或直接在%jboss_home%\server\default\deploy\jms\jbossmq-destinations-service.xml中配置。 ConnectionFactory的配置:%jboss_home%\server\default\deploy\jms\uil2-service.xml 下面引用自http://blog.csdn.net/jiulong/archive/2006/08/21/1101385.aspx 在jboss 4中,如果一个appserver A中的消息驱动bean需要访问另外一个appserver B中的消息队列,需要对A及其bean部署文件做相应的配置;对于消息服务器B无需做改动。 对A大致要做3件事情。 1、修改jboss安装目录的jboss-4.0.2\server\default\deploy\jms的jms-ds.xml文件,用红色部分替换掉灰色部分。这里实际上是重新配置了我们如何去访问远程jndi服务器绑定的对象。
2、在消息驱动Bean所在的ejb.jar文件的jboss.xml部署描述符文件中加入如下代码.
3、在mdbean配置部分加上如下红色部分语句。 <invoker-proxy-binding-name>lottery-mdb-invoker</invoker-proxy-binding-name>这个名字需要与上边第二步配置的完全匹配。
Ok,我们完整的jboss.xml文件内容如下: <jboss> <invoker-proxy-bindings> <invoker-proxy-binding> <name>lottery-mdb-invoker</name> <invoker-mbean>does-not-matter</invoker-mbean> <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory> <proxy-factory-config> <JMSProviderAdapterJNDI>QueuehostJMSProvider</JMSProviderAdapterJNDI> <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI> <MinimumSize>1</MinimumSize> <KeepAliveMillis>30000</KeepAliveMillis> <MaximumSize>15</MaximumSize> <MaxMessages>1</MaxMessages> <MDBConfig> <ReconnectIntervalSec>10</ReconnectIntervalSec> <DLQConfig> <DestinationQueue>queue/DLQ</DestinationQueue> <MaxTimesRedelivered>10</MaxTimesRedelivered> <TimeToLive>0</TimeToLive> </DLQConfig> </MDBConfig> </proxy-factory-config> </invoker-proxy-binding> </invoker-proxy-bindings> <enterprise-beans> <message-driven> <ejb-name>RecieveMdBean</ejb-name> <configuration-name>Standard Message Driven Bean</configuration-name> <destination-jndi-name>queue/lotappQueue</destination-jndi-name> <invoker-bindings> <invoker> <invoker-proxy-binding-name>lottery-mdb-invoker</invoker-proxy-binding-name> </invoker> </invoker-bindings> </message-driven> </enterprise-beans> </jboss> Jboss控制台(WebConsole/J2EE Domains/JBoss management/j2ee resource/local jms/)下可以看到消息总数。 |