首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

JBoss ESB学习札记9——第八个ESB应用JMS Router

2014-04-26 
JBoss ESB学习笔记9——第八个ESB应用JMS Router续上篇介绍了第七个ESB应用,本文介绍第八个ESB应用——JMS Rou

JBoss ESB学习笔记9——第八个ESB应用JMS Router

续上篇介绍了第七个ESB应用,本文介绍第八个ESB应用——JMS Router。

?

说明:本文及后续文章虽非百分百的原创,但毕竟包含本人的努力和付出,所以希望大家转载时务请注明出处:http://yarafa.iteye.com,谢谢合作。

?

1 概述
该实例演示如何配置JMSRouter action类来实现消息的路由和转发,以及JMSCorrelationID在ESB中的使用。

?

2 新建ESB工程
操作过程略。


3 ESB配置
3.1 创建消息队列

本例中只用到了四个消息队列,其中:

jmsrouterRequestGw:用于接收外部消息

jmsrouterRequestEsb:用于接收ESB内部消息

jmsrouterRouteTo:用于接收JMSRouter 转发的消息

jmsrouterReplyTo:用于客户端转发消息

如下所示:

?

3.2 定义Provider
这里将定义两个JMS Provider,分别用于监听外部消息和ESB消息,内容如下:

?

3.3 定义Service

?

3.4 定义Listener
这里定义两个listener,分别用于监听外部消息和ESB消息,内容如下:

?

3.5 配置Action

配置说明:这里定义了两个action,第一个是JBoss ESB提供的action类,用于打印输出消息内容。第二个action是一个JMS消息路由器,它将接收到的消息转发到消息队列queue/jmsrouterRouteTo,客户端可从该消息队列获取经转发后的消息。?JMSRouter的其他属性说明如下,摘自JBoss ESB API,英文比较简单,懒得翻译了。

unwrap: 'true' will extract the message payload from the Message object before sending. false (default) will send the serialized Message object.
jndi-context-factory: The JNDI context factory to use. Default is "org.jnp.interfaces.NamingContextFactory"
jndi-URL: The JNDI URL to use. Default is "127.0.0.1:1099"
jndi-pkg-prefix: The JNDI naming package prefixes to use. Default is "org.jboss.naming:org.jnp.interfaces".
connection-factory: The name of the ConnectionFactory to use. Default is "ConnectionFactory".
persistent: The JMS DeliveryMode. 'true' or 'false'. Default is "true".
priority: The JMS Priority to be used. Default is "javax.jms.Message.DEFAULT_PRIORITY"
time-to-live: The JMS Time-To-Live to be used. Default is "javax.jms.Message.DEFAULT_TIME_TO_LIVE"
security-principal: Security principal use when creating the JMS connection.
security-credential: The security credentials to use when creating the JMS connection.
property-strategy: The implementation of the JMSPropertiesSetter interface, if overriding the default.
message-prop: Properties to be set on the message are prefixed with "message-prop-".
jndi-prefixes: A comma separated string of prefixes. Properties that have these prefixes will be added to the JNDI environment.
org.xyz.propertyName: A jndi environment property that will be added to the jndi environment if the prefix 'org.xyz' was specified in the jndi-prefixes list.

?

3.6 配置部署文件
部署依赖文件deployment.xml内容如下:

?

运行客户端程序,可分别在JBoss ESB服务器控制台和Java程序控制台看到如下输出:

JBoss ESB学习札记9——第八个ESB应用JMS Router

?

JBoss ESB学习札记9——第八个ESB应用JMS Router

?

上述便是ESB第八个应用实例。如有问题,欢迎指正。

?

?

-----------------------------------------------------
Stay Hungry, Stay Foolish!
http://yarafa.iteye.com
Afa
Mar 11st, 2011
-----------------------------------------------------

1 楼 gccjava 2012-09-19   为何Route后JMSReplyTo丢失了为NULL

热点排行