- 浏览: 1989201 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (509)
- JavaEE (122)
- Oracle数据库 (29)
- JavaScript (37)
- SAP (5)
- MySql数据库 (7)
- JavaSE (4)
- Ajax (1)
- jQuery (13)
- SSH框架 (36)
- Web Service (10)
- JSF框架 (2)
- JBPM (0)
- ireport报表 (2)
- ibatis (5)
- Hibernate (31)
- JSP (11)
- Tomcat 服务器 (20)
- Other (19)
- JavaWeb (4)
- Maven (11)
- OSWorkFlow (10)
- HTML (13)
- Exception汇总 (7)
- SVN (2)
- 笑话 (1)
- JSTL (1)
- WebSphere Message Broker (13)
- ANT命令 (3)
- Liunx (12)
- Struts2 (26)
- Eclipse (6)
- DOS (3)
- Flex (11)
- WebSphere (1)
- 开发常用工具 (3)
- Junit (2)
- EJB (4)
- Struts1.2 (2)
- Jboss (1)
- Android (2)
- Java框架源码解析 (1)
- Spring (4)
- MyBatis (6)
- SpringMVC (4)
- Jetty (2)
- 数据库表设计 (1)
- SSO (4)
最新评论
-
贝塔ZQ:
也可以试试PageOffice插件,觉得更简单点
Jxl操作Excel设置背景、字体颜色、对齐方式、列的宽度 -
jia1208:
...
Could not publish server configuration for Tomcat v6.0 Server at localhost. -
u011274527:
赞
java.io.EOFException java.io.ObjectInputStream$PeekInputStream.readFully 错误 -
旭旭小牛啦:
怎么没哟了,继续赛
jQuery 选择器 -
wzw3919:
100行会报空指针
Java 解压缩zip文件
IBM WebSphere Message Broker JavaCompute节点的使用.
import java.util.List; import com.ibm.broker.javacompute.MbJavaComputeNode; import com.ibm.broker.plugin.*; public class Sub_FFN_JavaCompute extends MbJavaComputeNode { private final ArticleCreator articleCreator; private final StatementCreator statementCreator; private final SaleListCreator saleListCreator; public Sub_FFN_JavaCompute() throws MbException { // instantiate the output tree creation objects saleListCreator = new SaleListCreator(); statementCreator = new StatementCreator(); articleCreator = new ArticleCreator(); } public void evaluate(MbMessageAssembly inAssembly) throws MbException { MbOutputTerminal out = getOutputTerminal("out"); MbOutputTerminal alt = getOutputTerminal("alternate"); MbMessage inMessage = inAssembly.getMessage(); // create new message MbMessage outMessage = new MbMessage(inMessage); MbMessageAssembly outAssembly = new MbMessageAssembly(inAssembly, outMessage); try { MbElement root = outMessage.getRootElement(); MbElement document = root.getLastChild().getFirstChild(); MbElement chapter2 = document.createElementAsLastChild(MbElement.TYPE_NAME,"Chapter",null); // add title attribute MbElement title2 = chapter2.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE, "title", "Message Flows"); document.createElementAsLastChild(MbElement.TYPE_NAME,"NAME","ZhouHaiTao"); out.propagate(outAssembly); } finally { // clear the outMessage outMessage.clearMessage(); } } //复制头信息到outMessage中; public void copyMessageHeaders(MbMessage inMessage, MbMessage outMessage) throws MbException { MbElement outRoot = outMessage.getRootElement(); // iterate though the headers starting with the first child of the root element MbElement header = inMessage.getRootElement().getFirstChild(); while (header != null && header.getNextSibling() != null) // stop before the last child (body) { // copy the header and add it to the out message outRoot.addAsLastChild(header.copy()); // move along to next header header = header.getNextSibling(); } } /** * Iterates over the incoming message's SaleList elements and builds the output * message's SaleList * 在入报文的遍历SaleList元素并建立输出讯息。 * */ private final class SaleListCreator extends XPathOperation { private SaleListCreator() throws MbException { super("/SaleEnvelope/SaleList"); // expression evaluated on the incoming message } /** * Called once for each SaleList element */ @SuppressWarnings("unchecked") protected void forEachElement(MbElement saleList) throws MbException { List <MbElement> nodeset = (List <MbElement>)getOutputElement().evaluateXPath("/?SaleEnvelope/?$SaleList"); MbElement outSaleList = nodeset.get(0); // create the statements for each SaleList statementCreator.setOutputElement(outSaleList); statementCreator.evaluate(saleList); } } private final class ArticleCreator extends XPathOperation { private ArticleCreator() throws MbException { super("Item"); // expression evaluated on the incoming Invoice sub-tree } public ArticleCreator(String expression) throws MbException { super(expression); // TODO 自动生成的构造函数存根 } //遍历元素; @Override protected void forEachElement(MbElement element) throws MbException { // TODO 自动生成的方法存根 } } /** * Iterates over the incoming message's Invoice elements and builds the output * message's Statement sub-tree * 遍历的发票在入报文元素并建立输出; */ private final class StatementCreator extends XPathOperation { private final MbXPath setCustomer = new MbXPath( "?$Statement[?@Type[set-value('Monthly')]]" + " [?@Style[set-value('Full')]]" + " [?Customer[?Initials[set-value(concat($invoice/Initial[1], $invoice/Initial[2]))]]" + " [?Name[set-value($invoice/Surname)]]" + " [?Balance[set-value($invoice/Balance)]]]" + " /?Purchases"); private StatementCreator() throws MbException { super("Invoice"); // expression evaluated on the incoming SaleList sub-tree } /** * Called once for each Invoice element */ @SuppressWarnings("unchecked") protected void forEachElement(MbElement invoice) throws MbException { MbElement outSaleList = getOutputElement(); setCustomer.assignVariable("invoice", invoice); List <MbElement> nodeset = (List <MbElement>)outSaleList.evaluateXPath(setCustomer); MbElement purchases = nodeset.get(0); // Now create the articles for each invoice articleCreator.setOutputElement(purchases); articleCreator.evaluate(invoice); } } /** * XPathOperation is an abstract helper class allowing a method to be repeatedly applied to * results of an XPath expression. The user can optionally access the output message tree * allowing message transformations to be defined based on XPath evaluations of the input * tree. * 是一种抽象的XPathOperation帮助类允许一个方法反复应用到, * 的节点。用户可以选择性地访问输出消息树, * 许信息转换的被定义基于0评估输入的树 */ abstract class XPathOperation { private MbXPath xpath = null; private MbElement outputElement = null; /** * Constructor taking the XPath expression to evaluate. The expression must evaluate to * a nodeset. * 通过构造方法,expression 参数值生成一个xpath路径; * */ public XPathOperation(String expression) throws MbException { xpath = new MbXPath(expression); } /** * Must be called prior to the evaluate method if the user wishes to work with the output * tree (eg for message transformation). * */ public void setOutputElement(MbElement out) { outputElement = out; } /** * Allows the user to access the output tree in the forEachElement() method */ public MbElement getOutputElement() { return outputElement; } /** * Can be overridden by the user to do initialisation processing before iterating over the * XPath nodeset results */ protected void before() throws MbException { } /** * This gets called once for each element in the XPath nodeset results. The current element * is passed in as the only argument. This method is abstract and must be implemented * in the derived class. * 这将被调用一次为每个元素在0 nodeset结果。当前元素, * 通过是作为唯一的论点。该方法是抽象的,必须执行 * 在派生类。 */ protected abstract void forEachElement(MbElement element) throws MbException; /** * Can be overridden by the user to do post-processing after iterating over the * XPath nodeset results */ protected void after() throws MbException { } /** * Called by the user to iterate over the XPath nodeset. *被称为由用户自行遍历的nodeset 0。 * @param element The context element to which the XPath expression will be applied. */ @SuppressWarnings("unchecked") public void evaluate(MbElement element) throws MbException { //根据xpath获得一个结果; Object result = element.evaluateXPath(xpath); //如果result不是一个List实例;则return; if(!(result instanceof List)) { // error return; } before(); //强制转换成List<MbElement>List集合; List<MbElement> nodeset = (List<MbElement>)result; for(MbElement node : nodeset) { //循环遍历node节点元素; forEachElement(node); } after(); } } }
下面有一个文档,可以参考一下:
- JavaCompute节点创建新消息.rar (10.1 KB)
- 下载次数: 33
发表评论
-
Java 获取MQ 本地队列的消息
2011-12-08 15:10 3748最近工作中需要用的从MQ队列中取消息的业务..找了一下MQ A ... -
往Websphere MQ 本地队列中 放入消息和获取消息
2011-11-30 14:10 3207在访问一个队列首先需要获取队列管理器对象, 需要提供如 ... -
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/commonserv
2011-10-26 17:20 4297Exception in thread "main& ... -
Exception in thread "main" java.lang.NoClassDefFoundError: javax/resource/Resour
2011-10-26 17:17 9778今天在使用MQ API调用 MQ的时候,报如下错误: 原因是 ... -
Java连接MQ报错,通道协商失败 MQJE001: 完成代码为“2”,原因为“2059
2011-10-17 14:25 10788Java连接MQ报错,通道协商失败 MQJE001: 完成代 ... -
WMB 使用Compute节点连接Oracle数据库实例
2011-06-12 21:49 4640WMB这方面的资料少的可怜,几乎是找不到,. 我既然是W ... -
[Microsoft][ODBC 驱动程序管理器] 驱动程序不支持此功能
2011-06-12 20:54 5913今天做WebSphere Message Broker 练习时 ... -
:[IBM][ODBC Oracle Wire Protocol driver][Oracle]ORA-00001: unique constraint (SC
2011-06-12 20:27 3255今天在做一个WebSPhere Mes ... -
MQ服务启动失败的解决方法
2011-06-10 00:00 3091MQ服务启动失败的解决方法 昨天在学习MB是把MQ ... -
使用MQSI命令创建代理,队列管理器
2011-06-08 22:18 3773最近实在是无 ... -
WebSphere Message Broker HttpInput 节点
2011-05-24 02:02 1426写了一个关于HttpInput 节点中SSL(Https协议) ... -
BIP2087E: Broker BrokerDemo was unable to process the internal configuration mes
2011-05-19 12:51 3205今天部署的时候,.出现下面这个错误, BIP4041E:执行 ...
相关推荐
《精通WebSphere Message Broker》-陈宇翔-源代码及相关工具-4482这个压缩包文件主要聚焦于IBM的WebSphere Message Broker(WMB)技术,这是一款强大的企业级消息中间件产品。通过深入理解和掌握WMB,开发者能够构建...
3.1. WEBSPHERE MESSAGE BROKER的附加组件 10 3.1.1. WebSphere Message Broker Extender for TIBCO RV for Multiplatforms 10 3.1.2. WebSphere Message Broker File Extender 10 3.1.3. WebSphere Message Broker ...
通过对Websphere Message Broker 6.1配置操作的详细梳理,我们了解了如何进行队列管理器的基本操作、数据库管理、配置管理器管理、代理管理、组件数据库操作以及MQ控制命令的使用方法。这些基础知识对于部署和维护...
精通WebSphere Message Broker,清晰版本
JavaCompute Node是IBM Message Broker(也称为IBM WebSphere MQ Message Broker)中的一个组件,它允许开发人员用Java编写自定义处理逻辑,以接收、处理和转发消息。这种节点类型提供了强大的灵活性,因为它可以...
Websphere Message Broker实践,WebSphere MQ Java编程,Message Broker 计时器节点编程模式,MessageBroker TCPIP通信协议,wmb关于ws服务的引用,WMB连接oracle数据库实践,全部组件
### IBM WebSphere Message Broker 命令详解 IBM WebSphere Message Broker(以下简称“Message Broker”)是IBM提供的一款用于企业级消息处理的软件,它能够高效地管理和传递大量的消息数据,支持复杂的消息处理...
精通Websphere Message Broker,最主要的功能是消息选路、消息传送、消息扩展和发布/订阅。显然,这些功能使WebSphere Message Broker成为实现ESB业务集成的首选
WebSphere Message Broker 是一个企业服务总线(ESB),提供了用于各种协议的通用连接以及为使用结构化和非结构化数据的应用程序提供数据转换功能。为了提高消息处理性能,需要遵循一些最佳实践。 消息流开发阶段的...
WebSphere Message Broker是IBM提供的一个企业级的消息中间件产品,用于实现应用程序和服务之间的异步通信和数据交换,是构建SOA的关键组件之一。它能够处理大量消息,并支持多种消息传递模式,如点对点和发布/订阅...
WebSphere Message Broker(WMB),是IBM提供的一款强大的企业级消息中间件,它允许应用程序通过消息传递进行通信,实现业务流程的集成。在本主题中,我们将深入探讨WebSphere Message Broker如何与Web服务进行交互...
Websphere Message Broker(WMB),也称为IBM Integration Bus(IIB),是IBM提供的一款强大的企业服务总线(ESB)和消息中间件产品。它允许企业构建、部署和管理集成解决方案,通过消息传递实现系统之间的通信。在...
在IBM的WebSphere Message Broker(WMB)中,JavaCompute节点是一种强大的功能,允许开发人员使用Java代码来处理和转换消息。这个节点提供了对消息内容的直接访问,使得可以进行复杂的业务逻辑处理和数据操作。以下...
**Websphere Message Broker ESQL**是IBM WebSphere Message Broker平台中的一个重要组件,它提供了一种类似于SQL的语言,用于处理消息数据流中的数据。通过使用ESQL,开发人员能够灵活地操纵消息中的数据,实现数据...
##### 2.1 WebSphere Message Broker 的使用场景 WebSphere Message Broker 可以应用于各种复杂的集成场景,例如: - **消息流设计**:使用图形化工具设计消息流,以实现特定的业务逻辑。 - **服务编排**:将多个...
本教程《精通Websphere Message Broker.pdf》将深入探讨这些主题,帮助读者掌握如何使用IBM WebSphere Message Broker Toolkit 7.0来设计、构建和维护高效的消息传递解决方案。通过学习,你将能够熟练地利用WMB构建...