<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Alexandre Alves&apos;s Blog</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/" />
    <link rel="self" type="application/atom+xml" href="http://dev2dev.bea.com/blog/aalves/atom.xml" />
   <id>tag:dev2dev.bea.com,2008:/blog/aalves//88</id>
    <updated>2008-06-26T01:42:42Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.31</generator>
 
<entry>
    <title>New Blog Account</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2008/06/new_blog_accoun.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2008/06/new_blog_accoun.html</id>
    
    <published>2008-06-26T01:42:35Z</published>
    <updated>2008-06-26T01:42:42Z</updated>
    
    <summary>As several others at dev2dev, I&apos;ve also decided to have my own personal blog account: http://adcalves.wordpress.com/...</summary>
    <author>
        <name>aalves</name>
        
    </author>
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[As several others at dev2dev, I've also decided to have my own personal blog account:
<a href="http://adcalves.wordpress.com/">http://adcalves.wordpress.com/</a>]]>
        
    </content>
</entry>
<entry>
    <title>CEP, Rules Engines, and SQL</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2007/08/cep_rules_engin.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2007/08/cep_rules_engin.html</id>
    
    <published>2007-08-14T00:01:00Z</published>
    <updated>2008-06-23T18:16:01Z</updated>
    
    <summary>There has been a lot of discussions on the differences between CEP/ESP and rules engines, specifically regarding RETE implementations, and around the scope of SQL within CEP. What is the best language for Complex Event Processing?</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
            <category term="Technology: Service-oriented Architecture" />
            <category term="Technology: Vertical Markets" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[<p>There has been a lot of discussions on the <a href="http://www.infoq.com/news/2007/05/esper">differences between CEP/ESP and rules engines</a>, specifically regarding RETE implementations. I particularly like this entry from <a href="http://thecepblog.com/2007/07/27/blending-cep-for-rules-and-brms-folks/">Tim Bass</a> on the subject. </p> <p>In my opinion, the very fact that we are comparing CEP/ESP and rules engines is a sign that these subjects are not yet very well understood.</p> <p>Partly, the reason for the confusion is that CEP/ESP, rules engines, and RETE are at different levels of abstractions. </p> <p>CEP/ESP is a technology. It is a collection of techniques, methodologies, and implementation procedures intended on solving a common set of problems of a domain, namely, in the case of CEP/ESP, (loosely speaking) to achieve online processing of streaming data (i.e. events) to support, among other things, real-time business decision.</p> <p>Although CEP and ESP have different definitions, for the purpose of this article I will use both terms interchangeably.</p> <p>There are several aspects to CEP: visualization of events, storage of events, programming model for the development of CEP applications, rule (or query) governance, the runtime processing engine, etc. </p> <p>With respect to the runtime processing engine, there are several implementations options. However, before considering an engine implementation, one must first consider what language, or what language paradigm, should be surfaced to the user so that the user can program to this engine.</p> <p>One option is to take the well-known imperative programming language paradigm and use any one of the popular procedural or object-oriented languages such as Java as the event processing language of choice that is surfaced to the user. For example, this is the approach taken when one implements their CEP application with hard-coded <em>rules</em> directly in Java.</p> <p>Another option is to use a more data-driven approach. Considering that one is dealing with events, which is a type or extension of data, this seems an appropriate choice. </p> <p>Within the realm of data-driven approaches, one option is to use SQL. SQL, needless to say, has proven to be a very convenient and pervasive domain-specific language for dealing with data, which allows one to leverage existing skill-sets. Another common option is to use <em>logic programming</em>. Note that there is an equally intriguing discussion around <a href="http://apama.typepad.com/my_weblog/2007/07/sql-is-certainl.html">CEP and SQL</a> currently going on. </p> <p>Logic programming is a very interesting, but long subject. In a logic programming language, programs consist of a set of statements that specify what is true about a desired goal. This is different than in imperative languages (e.g. Java), where programs specify the set of statements that must be executed to achieve the desired goal.</p> <p>More specifically, in logic programming, programs contain only logical statements. Logical statements are statements that are either true or false. Logical statements that are always true are called <em>axioms</em>. The role of a logic program is to infer new logical statements called <em>theorems</em> from the axioms through some automated algorithm. The automated algorithm used by the program is called its <em>inference rules</em>. Theorems are the goals that represent the desired results. </p> <p>Pure logic programming is very powerful indeed. In pure logic programming, at no time one specifies how to derive the goals, that is, there are no control statements (e.g. if-then-else). Pure logic programming is also very hard to implement. Hence people came with simpler models that support sub-sets of the full logic programming paradigm. One of these is called <em>First Order Predicate Calculus</em>. </p> <p>In First Order Predicate Calculus, logical statements are formed of constants, variables and their quantifiers (e.g. for all values, for any value), predicates, and connectives. Much of the expressiveness and power of First Order Predicate Calculus comes from the connectives. Common connectives are the logic operators AND, OR, NOT. Additional connectives are implication and equivalence. To say that A implies B, means that B is true when A is also true.</p> <p>It turns out that even the restricted sub-set First Order Predicate Calculus is hard to implement. Thus people have further simplified it in attempts to facilitate implementations; <em>Horn Clauses</em> is the most commonly used sub-set of First Order Predicate Calculus. Horn Clauses do not support the specification of variable quantifiers, and of the equivalence operator, among other limitations. Prolog, probably the most widely used logic programming language, supports Horn Clauses.</p> <p>Loosely speaking, a rule-based system or rule-based engine is an implementation of a logic programming language, usually based upon Horn Clauses, with some few procedural extensions. These systems are sometimes called <em>production systems</em>. In a production system, logical statements that are constants (i.e. always true or false) are called <em>assertions</em>, and compose what's called the <em>working memory</em>. Logical statements that make use of the implication connective, that is, follow a <em>if-then</em> structure are called <em>productions</em>, and make up the <em>production memory</em>.</p> <p>Rules engine execute by following a <em>recognize-act algorithm</em>; that is, as new logical statements are made available (i.e. inputted by the user), the engine matches (i.e. recognizes) the left-hand side of all productions against the contents of the working memory. This process results into a set of production instantiations. Next the engine executes (i.e. acts) the right-hand side, called <em>actions</em>, of the matched instantiated productions. The actions may result in new content in the working memory. Changes to the working memory causes the engine to re-enter the recognize-act cycle, which continues until no more matches occur. </p> <p>One procedural extension to rules engines is to be able to directly manipulate the content of the working memory. This is done in the right-hand-side (i.e. actions) of the productions, where one may create, delete, and modify assertions present in the working memory.</p> <p>Matching through thousands of productions against thousands of assertions can be quite expensive. A naive approach would cost O(productions * assertions). Matching can take around 90% of the processing time of a rules engine.</p> <p>So let's consider a way of optimizing this. Essentially what the engine is trying to do is to find out which assertions match against the left-hand-side of the productions, in another word, the end goal is to find a set of productions. What if we create a graph of nodes, where the nodes represent the conditions we are trying to match, and as we traverse the graph matching these nodes we eventually reach a terminal node representing the production for which the conditions apply?</p> <p>For example, consider the following four productions P1, P2, P3, P4:</p> <blockquote> <p><strong>P1: if attr1 = 'value1' and attr2 = 'value2' then action1</strong></p> <p><strong>P2: if attr1 = 'value1' and attr2 = 'value3' then action2</strong></p> <p><strong>P3: if attr1 = 'value4' and attr2 = 'value5' then action3</strong></p> <p><strong>P4: if attr1 = 'value6' and attr2 = 'value7' then action4</strong></p></blockquote> <p>The corresponding matching graph is:</p> <p><a href="http://dev2dev.bea.com/blog/aalves/WindowsLiveWriter/CEPRulesEnginesandRETE_EAE0/image.png"><img height="172" alt="A RETE Network" src="http://dev2dev.bea.com/blog/aalves/WindowsLiveWriter/CEPRulesEnginesandRETE_EAE0/image_thumb.png" width="440"></a> </p> <p>Now consider that assertion A is inputted:</p> <blockquote> <p><strong>A1(attr1 = 'value1', attr2 = 'value2')</strong></p></blockquote> <p>The first step is to match for <em>attr1</em>, which will take the engine to the child node <em>n2, </em>and then to match <em>attr2</em> to the terminal node <em>P1</em>, which is our goal. This has a total of 4 comparisons in the worst-case. A (very) naive implementation would take 8 comparisons in the worst-case.</p> <p>Although over-simplified, this is the general idea of the RETE (i.e. Latin for network) matching algorithm invented by Dr. Charles Forgy. RETE also has additional considerations for optimizing the handling of the binding of variables, of joins, and techniques for keeping the network of matching nodes up-to-date, among other things.</p> <p>RETE is a very efficient algorithm for performing matching in productions systems. Does it look as if it is generic enough in its entirely or parts of it to be used in different contexts? Yes, it certainly does to me. In fact, we use some of the ideas, with combination of hash functions, in the implementation of some aspects of our CEP engine, which is based upon SQL and not on a logical programming language.</p> <p>To put all of these in perspective, let's look at an example. Let's say you want to find out if a certain stock has changed its value more than 20% when compared to a previous value in the past. Consider that a stock is defined as:</p> <blockquote> <p><strong>Stock: SYMBOL, VALUE, TIMESTAMP</strong></p></blockquote> <p>First, let's start with a logic programming language. I will use <a href="http://www.swi-prolog.org/">Prolog</a> in this case:</p> <blockquote> <p><strong>stockUp(X)&nbsp; :-&nbsp; stock(X, Price1, Time1),&nbsp; stock(X, Price2, Time2), </strong></p> <p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Time2 &gt; Time1, Price2 &gt; (Price1 * 1.20). </strong></p></blockquote> <p>If we feed the following assertions into the Prolog's working memory:</p> <blockquote> <p><strong>stock(aaa, 10, 0).</strong></p> <p><strong>stock(bbb, 15, 1).</strong></p> <p><strong>stock(ccc, 10, 2).</strong></p> <p><strong>stock(aaa, 12, 3).</strong></p> <p><strong>stock(bbb, 14, 4).</strong></p> <p><strong>stock(ccc, 13, 5).</strong></p></blockquote> <p>We will get the following result:</p> <blockquote> <p><strong>stockUp(X = ccc)</strong></p></blockquote> <p>Which means that the last stock assertion (i.e. <em>'stock(ccc,13,5)'</em>) generates the creation of the new assertion '<em>stockUp</em>' for symbol <em>'ccc'</em>.</p> <p>Next, let's try with <a href="http://edocs.bea.com/wlevs/docs20/epl_guide/index.html">BEA EPL</a>, which mostly follows the SQL idiom:</p> <blockquote> <p><strong>INSERT INTO StockUp</strong>  <p><strong>SELECT a.symbol FROM</strong><strong> Stock a, Stock b RETAIN ALL EVENTS </strong> <p><strong>WHERE a.symbol = b.symbol and (a.price &gt; b.price * 1.20)</strong></p></blockquote> <p>This EPL statement provides the same result. However, in this case, we will be feeding the engine with Java Bean events rather than assertions. So, instead of creating the assertion: </p> <blockquote> <p><strong>stock(aaa, 10, 0)</strong></p></blockquote> <p>We will create the Java Bean:</p> <blockquote> <p><strong>new Stock("aaa", 10.0)</strong></p></blockquote> <p>It is interesting how events and assertions map seamlessly to each other, at least for this simple scenario. Intuitively, this seems to make sense to me, as both are conceptually <em>immutable</em> and represent some known aspect of the problem domain.</p> <p>Note how we specify <em>RETAIN ALL EVENTS</em> in the EPL query. Using rule-based systems as an analogy, the <em>RETAIN</em> clause provides a declarative way of managing the CEP engine's working memory. In the case of this example, it is doing exactly the same thing as the Prolog program, that is, keeping all assertions forever, which is probably not a realistic situation.</p> <p>Consider this next EPL statement:</p> <blockquote> <p><strong>INSERT INTO StockUp</strong></p> <p><strong>SELECT symbol FROM Stock </strong></p> <p><strong>RETAIN 10 EVENTS WITH LARGEST timestamp </strong><strong>PARTITION BY symbol</strong></p> <p><strong>WHERE price &gt; (prev(1,price) * 1.20)</strong></p></blockquote> <p>In the first EPL query, we were considering that the stock events were ordered in non-decreasing time within the stream. This is a fair assumption to make considering that we are dealing with streams executing within an underlying stream infrastructure; whereas we couldn't really make this assumption with regards to logical statements, and hence the need of explicitly including the timestamp in the Prolog predicate clause. Nevertheless, for sake of comparison, let's assume that the events are not ordered, which means that the EPL query itself has to take the ordering into account. This is done with the <em>WITH LARGEST timestamp </em>clause. This clause will keep the stock stream in ascending order of timestamp; in my opinion <em>WITH LARGEST timestamp </em>is more declarative than the logical counter-part <em>timestamp2 &gt; timestamp1</em>. </p> <p>Likewise, note how the second EPL statement does need to <em>join </em>on <em>symbol</em>, which is explicitly done by both the logical statement <em>'stock(<strong><u>X</u></strong>, Price1, Time1),&nbsp; stock(<strong><u>X</u></strong>, Price2, Time2)</em>' and by the first EPL statement '<em>a.symbol = b.symbol</em>'. Instead, the clause <em>PARTITION BY symbol</em> will group the stocks by symbol and allow one to compare (in this case using the <em>previous </em>function) within just that group.</p> <p>Needless to say, this second EPL query provides the same result as of the first one, but in a more declarative manner. The one semantic difference between these two is that the 2nd query only considers 10 events at a time (i.e. <em>RETAIN 10 EVENTS</em>), rather than all events (i.e. <em>RETAIN ALL EVENTS</em>). In another word, we are declaratively restricting the working memory to 10 events in this case.</p> <p>Ok, so one may argue that rule-based systems are better suited to handle inference, which my simple example fails to demonstrate.</p> <p>That is a valid point, so let's consider the scenario where stocks are part of a cluster that moves together, that is, if several other stocks within the same cluster go up, it is likely that the remaining ones within the cluster will also go up in the near future. </p> <p>A simple production rule for this scenario is:</p> <blockquote> <p><strong>stockUp(aaa) :- stockUp(bbb), stockUp(ccc)</strong></p></blockquote> <p>If one creates the following new assertion:</p> <blockquote> <p><strong><strong>stock(bbb, 25, 6).</strong></strong></p></blockquote> <p>One will get the following result, which is expected:</p> <blockquote> <p><strong>stockUp(X = bbb)</strong></p></blockquote> <p>And, in addition, the engine would infer that:</p> <blockquote> <p><strong>stockUp(X = aaa)</strong></p></blockquote> <p>Can we do something similar with EPL? Certainly, here is the query:</p> <blockquote> <p><strong>INSERT INTO StockUp</strong></p> <p><strong>SELECT 'aaa' AS symbol</strong></p> <p><strong>FROM StockUp a, StockUp b RETAIN 10 MINUTES</strong></p> <p><strong>WHERE a.symbol = 'bbb' AND b.symbol = 'ccc'</strong></p></blockquote> <p>Again, it is expressed in terms of SQL joins, which arguably is a less natural form of expressing inference, but nonetheless correct. </p> <p>Thankfully, EPL also supports a <em>pattern matching idiom</em>, in contrast to just a SQL idiom, which, in my opinion, provides better expressiveness for describing inference:</p> <blockquote> <p><strong>INSERT INTO StockUp</strong></p> <p><strong>SELECT 'aaa' AS symbol</strong></p> <p><strong>MATCHING StockUp(symbol = 'bbb') AND StockUp(symbol = 'ccc')</strong></p> <p><strong>RETAIN 10 MINUTES</strong></p></blockquote> <p>So which language is better? SQL-based languages? Rule-based languages? </p> <p>In my opinion, the discussion around CEP technology is larger than the discussion around which language to use for its engine, and definitely larger than discussing which matching algorithm, RETE or otherwise, this engine should be built upon.</p> <p>When discussing the CEP technology, I find it important to focus on use-cases. </p> <p>Regarding programming languages, there is a place for more than one language in CEP, and, equally, one does not want to be restricted by any one language in particular.</p> <div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:a0c3a58e-5516-4136-8ef1-58bec5df2043" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a>, <a href="http://technorati.com/tags/EDA" rel="tag">EDA</a>, <a href="http://technorati.com/tags/Rule-Based%20Systems" rel="tag">Rule-Based Systems</a>, <a href="http://technorati.com/tags/Production%20Systems" rel="tag">Production Systems</a>, <a href="http://technorati.com/tags/Prolog" rel="tag">Prolog</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>The EDA Programming Model</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2007/07/the_eda_program.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2007/07/the_eda_program.html</id>
    
    <published>2007-07-27T01:01:10Z</published>
    <updated>2007-07-27T01:04:36Z</updated>
    
    <summary>What should be the ideal programming model for event-driven applications?</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
            <category term="Technology: Service-oriented Architecture" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[<p>In&nbsp;the previous post <a href="http://dev2dev.bea.com/blog/aalves/archive/2006/11/a_short_dissert.html">A Short Dissertation for EDA</a>, I&nbsp;try to describe what is EDA, and why it is important.</p> <p>Having established that EDA is indeed desirable, the next step is to determine how does one actually author an event-driven application. That is, what are&nbsp;the new abstractions, models, and design patterns&nbsp;that&nbsp;we should be using&nbsp;for&nbsp;EDA.</p> <p>This is analogous to the problem that enterprises faced before <a href="http://java.sun.com/javaee/">Java EE</a> came about. Before Java EE, developers would have to go long ways to create enterprise applications in Java. EE brought the necessary abstractions to facilitate this, by defining, among other things,&nbsp;the&nbsp;concepts of Session Beans, Entity Beans, Message-Driven Beans, and Enterprise Archives (i.e. EAR), which packaged and assembled these entities together.</p> <p>So what abstractions do we need for EDA? That is, what would be a good programming model for creating event-driven applications?</p> <p>To no surprise, the needed abstractions for the EDA programming model are:</p> <ul> <li>Event Sources and Event Sinks: application code that respectively generate events and receive events  <li>Streams: channels through which events flow, these channels don't hold on to events, they actively stream events  <li>Processors: agents capable of processing events; the processing&nbsp;function or capability varies per agent  <li>Event Types: metadata defining the properties of&nbsp;events</li></ul> <p>Developers&nbsp;author&nbsp;event-driven applications by creating instances of these abstractions. </p> <p>For example, consider a simple financial market pricing application. The goal of this pricing application is to determine what would be the best price to quote its clients that wish to trade stocks. This event-driven application&nbsp;creates two event sources, each&nbsp;receiving stock tick events from two different exchange markets. For sake of simplicity, the stock tick event contains only two event properties, its stock symbol (e.g. BEAS) and the latest traded price of the stock.&nbsp;&nbsp;The application further defines a processor that is <em>configured</em> to calculate and output the&nbsp;price of a stock symbol as being the average price received from&nbsp;the two event sources. Finally,&nbsp;there is a single event sink&nbsp;that publishes the calculated average stock price to a well-known JMS destination. The event sources are connected to the processor by having the event sources send events to a common stream that the processor listens to. Likewise, the processor is connected to the event sink by sending its event, the average stock price, to a shared stream that the event sink listens to.</p> <p><a href="http://dev2dev.bea.com/blog/aalves/WindowsLiveWriter/EDAprogrammingmodel_DF6D/event-driven%20pricing%20application.png" atomicselection="true"><img height="218" alt="event-driven pricing application" src="http://dev2dev.bea.com/blog/aalves/WindowsLiveWriter/EDAprogrammingmodel_DF6D/event-driven%20pricing%20application_thumb.png" width="640"></a>&nbsp;</p> <p>The events flow from the two event sources, to the first stream, then to the processor, then to the second stream, and finally to the event sink. This flow of events&nbsp;across the EDA components forms a Event Processing Network (EPN).</p> <p>An&nbsp;EPN is another abstraction of the EDA programming model.&nbsp;Formally, it is&nbsp;defined as:</p> <ul> <li>A&nbsp;directed graph of event sources, event sinks, streams, and processors; all collaborating&nbsp;towards fulfilling the&nbsp;function of a event-driven application. A EPN models horizontal composition and vertical layering of event processing.</li></ul> <p>Essentially, an event-driven application&nbsp;specifies a EPN, and&nbsp;the EPN assembles&nbsp;the EDA components (e.g. event sources, event sinks, processors, streams) together.</p> <p>In the previous example, why do you need a stream to begin with? Couldn't one just link together the event sources to the processor and then to the event sink? Actually, you could, but streams are useful for several reasons:&nbsp;</p> <ul> <li>Streams&nbsp;de-couple event sources from event sinks; this is similar to what a JMS destination does to&nbsp;JMS publishers and subscribers  <li>Streams manage the flow of events; this is done by providing queuing capability, with different rejection policies, and by providing different dispatching mechanisms, such as synchronous&nbsp;and asynchronous dispatching</li></ul> <p>As long as we are defining a new programming model, let's also consider some other&nbsp;lessons that we have picked up&nbsp;along the way. For instance, it is important that the specification of a EPN be declarative, in another words, we want to assemble the event driven application by using some declarative mechanism, such as XML. Furthermore, it is also equally important that we keep the business logic de-coupled from the technology. Finally,&nbsp;we would like to pay-as-you-go for functionality. This latter means that if you don't need a service, for example persistence or security, then you should not need to configure, reference (e.g. implement some technology interface), or otherwise be impacted by this service that you don't intend on using to begin with.</p> <p><a href="http://www.bea.com/framework.jsp?CNT=index.htm&amp;FP=/content/products/weblogic/event_server/">WebLogic Event Server</a> (EvS) has native support for this EDA programming model. </p> <p>In EvS, a user application&nbsp;<em>is</em> a EPN, and has first-class support for creating event sources, event sinks, streams,&nbsp;processors, and event types. </p> <p>Event sources and event sinks may be bound to different plug-able protocols, such as JMS. A event source or event sink that is bound to some&nbsp;specific protocol and is responsible for converting or passing along external events to&nbsp;and from the EPN are known as&nbsp;<em>Adapters.</em>&nbsp;Processors support <a href="http://edocs.bea.com/wlevs/docs20/epl_guide/index.html">BEA's Event Processing Language</a>. Java Beans may be registered in the EPN as Event Types. Streams support dynamic configuration of queuing and&nbsp;concurrency parameters.</p> <p>The EPN itself is specified in a XML configuration file, called the&nbsp;<em>EPN assembly file</em>.&nbsp;</p> <p>&nbsp;To be able to support the de-coupling of the user code from (infrastructure) dependencies, we have created our own dependency injection container, supporting both setter and constructor injection...</p> <p>Just kidding! The EPN assembly file is a custom extension of a <a href="http://www.springframework.org/">Spring framework</a> context XML configuration file. What this means is that we leverage Spring's Inversion of Control (IoC) container in its entirely, thus allowing one to seamlessly use Spring beans (and any other Spring feature, such as AOP) in the assembly of a EPN.&nbsp;EvS defines its own custom <em>tags </em>for the EDA components, hence&nbsp;a developer does not need to understand how the Spring framework&nbsp;works to create&nbsp;event-driven applications. The EDA programming model extensions to Spring is called <a href="http://edocs.bea.com/wlevs/docs20/reference/spring_tags.html">Hot-Spring</a>.</p> <p>Back to our pricing application example, if you consider that the event sources and event sinks are re-using existing <em>adapter</em> implementations respectively that understand the market exchange protocol and JMS, then the whole EDA application can be authored without the developer having to write a single line of Java code! The developer only has to specify the EPN assembly file and configure the processor and adapters that it is using, all done through XML files or through a command-line interface (CLI) Administration tool.</p> <p>What if the developer needs to use some custom business logic somewhere in the EPN? Well, the developer can always create Java POJOs (Plain-Old-Java-Objects) functioning in the roles of event sources or event sinks and assembled them together in the EPN. This reflects a common manifest&nbsp;from&nbsp;the Spring community, "simple things are easily done, complicated things are still possible".</p> <p>Finally, after having authored the EvS application, how do you deploy the application to EvS? </p> <p>EvS deployment unit is a <em>Spring-OSGi bundle</em>. What is this? To begin with,&nbsp;a&nbsp;bundle is a regular JAR file. The <em>Spring</em> aspect of it means that this JAR file must contain&nbsp;a Spring context configuration, which in the case of EvS is a EPN assembly file, within the directory <em>META-INF/spring</em>. The second aspect of this is <a href="http://www.osgi.org/">OSGi</a>. OSGi is a service-oriented, component-based backplane. Why do you care? Well, generally speaking the developer does not need to care about this.&nbsp;Essentially, a OSGi bundle contains special&nbsp;OSGi entries in its MANIFES.MF file within the JAR file that specify, among other things,&nbsp;service dependencies and service advertisement. The fact that a EvS application is a OSGi bundle helps promote maintainability, re-use, and interoperability. The idea here is that we are&nbsp;<em>bringing SOA directly to the code.</em></p> <p>In summary, if you must remember only two things from this article, please remember:</p> <ul> <li>In the same way that Java EE created a new programming model for&nbsp;server-side Java enterprise development, there is a need for a new EDA programming model  <li>The EDA programming model must not only abstract and provide first-class support for the EDA concepts, but it must also promote re-use, openness, and dependency de-coupling</li></ul> <p>We have tried to achieve these in WebLogic Event Server. Please let us know how we have done.</p> <div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:0e3f60ad-beae-4d74-9588-03ad85abe9c6" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/EDA" rel="tag">EDA</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a>, <a href="http://technorati.com/tags/WebLogic%20Event%20Server" rel="tag">WebLogic Event Server</a>, <a href="http://technorati.com/tags/programming%20model" rel="tag">programming model</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>A Short Dissertation on EDA</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2006/11/a_short_dissert.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2006/11/a_short_dissert.html</id>
    
    <published>2006-11-13T19:46:25Z</published>
    <updated>2006-11-17T19:14:29Z</updated>
    
    <summary>There is a lot of literature on EDA, event stream processing, CEP, etc; that is, on event and event processing technologies. Although all of them are very good, it can get a little overwhelming. Following, I attempt to describe EDA and how EDA relates to other technologies, such as SOA, real-time, and Java, in a pragmatic form.</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Product: WebLogic Real Time" />
            <category term="Technology: Service-oriented Architecture" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[<p><em>Event-driven architecture</em> is an architectural style composed of decoupled applications that interact by exchanging events. These applications are called event-driven applications. Event-driven applications may play the role of an emitter of events, and of a responder or processor of events.</p>


	<p>Event-driven architecture is important, because the real-world is event-driven. One example is the financial world, in which trader applications react to events (or changes) made to the financial exchange market. Event-driven situations should be modeled by event-driven architecture.</p>


	<p>Event driven applications are sense-and-respond applications, that is, applications that react to and process events.</p>


	<p><em>Events</em> are state changes that are meaningful to an observer. Generally, events are in the form of a protocol message. Events may be <em>simple</em> or <em>complex</em>. Simple events contain no meaningful member events. Complex events contain meaningful member events, which are significant on their own. An example of a simple event is a stock bid event, and a stock offer event; an example of a complex event is a stock trade event, which includes both a bid event and an offer event.</p>


	<p>Events may be delivered through different mediums, two of which are <em>channels</em> and <em>streams</em>. Channels are non-active virtual pipes, that is, a producer component is responsible for inserting data into one side of the pipe and another consumer component is responsible for removing the data at the other side of the pipe. The data is stored in the channel as long as it is not removed by a component. Of course, channels may be bound, in which case it may stop
accepting new data or purging existing data as it sees fit. Examples of channels are <span class="caps">JMS</span> queues and topics. In the contrary, streams are active virtual pipes, that is, they support a continuous flow of data. If a producer component does not directly listen to the stream, it is likely to miss some data. Because streams do not need to store data, streams are able to support a high-volume of streaming data flowing through them. An example of a stream is the of the air TV broadcast.</p>


	<p>Having received events, the next task of an event-driven application is to process the
events. <em>Event Processing</em> is defined as a computation stage that consumes and optionally generates events. Currently, as specified by Roy Schulte, there are four ways to categorize event processing:</p>


	<ul>
	<li>Event passing:
Events are simply handled off between components, there is
mostly no processing, and it generally deals only with simple events. Event-passing applications are asynchronous, staged, and trigged by the arrival of one event from a single event stream or channel. Sometimes they are referenced as message-driven or document-driven applications. Examples are simple pub-sub applications.</li>
	</ul>


	<ul>
	<li>Event mediation (or brokering):
Events are filtered, routed (e.g. content-based), and transformed (e.g. enriched). Event mediators are stateless, and deal with both simple and complex events; however they do not synthesize new complex events of their own, that is, event mediators cannot combine (i.e. aggregate) simple events into complex events, mostly due to the fact that they do not keep state. Generally, there is a single event stream or channel fan-in, and multiple event
streams or channels fan-out. Examples are integration brokers.</li>
	</ul>


	<ul>
	<li>Complex Event Processing (CEP):
Events are processed by matching for complex patterns, and for complex relationships, such as causality, timing, correlation and aggregation. <span class="caps">CEP</span> applications are state-full; simple and complex events are received from several event streams and new complex events may be synthesized. <span class="caps">CEP</span> applications must be able to handle a very high volume of events, and hence generally only using streams.</li>
	</ul>


	<ul>
	<li>Non-linear Complex <span class="caps">BPM</span>: 
Event-based business processes modeling non-linear complex work flows. The business process is able to handle unpredictable situations, including complex patterns, and complex event relations.</li>
	</ul>


	<p><em>Event Stream Processing</em> (ESP) is event processing solely on streams, as opposed to channels. Hence, <span class="caps">CEP</span> is always part of <span class="caps">ESP</span>; however <span class="caps">ESP</span> includes other event processing types, such as event passing and event mediation, when those are performed on streams, rather than on channels.</p>


An event-driven application may play the roles of <em>event source</em>, <em>event sink</em>, or both. An event source generates events to event sinks. Note that event sources do not necessarily create the event, nor events sinks are necessarily the consumer of events. Furthermore, event sources and event sinks are completely decoupled from each other: 
	<ul>
	<li>An event source does not pass control to event sinks, which is the case of service consumers delegating work to providers; and </li>
		<li>Event sinks do not provide services to event sources, which is the case of consumers that initiate and consume work from providers; and </li>
		<li>One can add and remove event sources and sinks as needed without impacting other event sources and sinks.</li>
	</ul>


	<p>How does <span class="caps">EDA</span> compare to <span class="caps">SOA</span>? That depends on how the loosely term <span class="caps">SOA</span> is defined. If <span class="caps">SOA</span> is defined as an architecture that promotes re-use of modular, distributed components, then <span class="caps">EDA</span> is a type of <span class="caps">SOA</span>. If <span class="caps">SOA</span> is defined as an architecture where modules provide services to consumer modules, then <span class="caps">EDA</span> is not <span class="caps">SOA</span>.</p>


	<p>The concepts previously described are based upon work from Roy Schulte, Mani Chandy, David Luckham, and others.</p>


	<p>Next, let&#8217;s focus on real-time concepts.</p>


	<p>Real-time is the capability of a system on being able to ensure the timely and predictable execution of code. In another words, if a developer specifies that an object must be executed in the next 100 milliseconds (or in the next 100 minutes for that matter), a real-time infrastructure will guarantee the execution of this object within this temporal constraint.</p>


        <p>Event-driven architectures are suitable for real-time. Event-driven applications are generally implemented using asynchronous mechanisms; this lack of synchronicity improves resource usage, which in turn helps guarantee real-time quality of service.</p>


	<p>Objects that have temporal constraints are named <em>schedulable objects</em>. The system measures how well the temporal constraints are being met by means of a particular metric, for example, the number of missed deadlines. Schedulers order the execution of schedulable objects attempting to maximize these metrics. Schedulers make use of different algorithms or policies to do this, one of which is the Rate Monotonic Analyze (RMA). <span class="caps">RMA</span> relies on thread priority as a scheduling parameter and determines that the highest priority should be associated to the shortest tasks.</p>


	<p>Let&#8217;s re-consider <span class="caps">CEP</span>. CEP allows one to specify temporal constraints in the processing of events. For example, one can specify to match for an event that happens within 100 milliseconds of another event. Hence, <span class="caps">CEP</span> rules (e.g. queries) are essentially a type of schedulable object, and therefore a <u><span class="caps">CEP</span> agent must be a real-time agent</u>.</p>


	<p>In a very loosely form, <span class="caps">CEP</span> can be further characterized by two functions, a guarding function, and an action function. The former determines whether an event should trigger a response, and the latter specifies the responses to be taken if the guard is satisfied.</p>


	<p>Consider a system that supports <span class="caps">CEP</span> agents whose action functions are coded in Java. This implies that the system must support the development, and deployment of Java applications, and hence, in this regards, it must be to some extent a Java application server, or rather as we have concluded previously, a real-time Java application server.</p>


	<p>To be more exact, <span class="caps">CEP</span> Java action functions do not need the full services of a complete application server, for instance, part of the transactional, persistence, and security container services may not be needed. What is needed is a minimal-featured application server. This minimalist aspect is also applicable to the real-time capability. We do not need a full set of real-time features that enables the development of any type of applications, but rather a minimal set of real-time features that enables the support of <span class="caps">CEP</span> agents.</p>


	<p>A system that supports <span class="caps">CEP</span> also supports other event processing types, such as event passing and event mediation. Therefore, a light-weight real-time Java application server that is able to host <span class="caps">CEP</span> agents is a good overall solution for achieving <span class="caps">EDA</span>.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Myths on BPEL</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2006/06/myths_on_bpel.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2006/06/myths_on_bpel.html</id>
    
    <published>2006-06-12T19:17:15Z</published>
    <updated>2006-09-12T20:56:20Z</updated>
    
    <summary>Let&apos;s investigate a few misconceptions related to BPEL, ranging from its goals, to its language.</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Technology: XML" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[<p>Like any other new technology, BPEL has its share of miscommunications and misconceptions.</p>

<p>Let's consider a few of them:</p>

<p><ul><li>BPEL is a human interaction workflow language: <b>FALSE</b></li><br>
BPEL is focused on system-to-system interactions. The omission of native language support for human interaction scenarios is being addressed by <a href="http://www-128.ibm.com/developerworks/webservices/library/specification/ws-bpel4people/">BPEL4People</a>.</ul></p>

<p><ul><li>BPEL is well suited for <a href="http://en.wikipedia.org/wiki/Programming_in_the_small">programming in the small</a>, that is, programming at the module level: <b>FALSE</b></li><br>
BPEL is better suited for programming in the large, that is, at the inter-module level (i.e. interconnection of modules). This issue is being addressed by <a href="http://ftpna2.bea.com/pub/downloads/ws-bpelj.pdf">BPELJ</a>.<br></ul></p>

<p><ul><li>BPEL provides a standard visual notation for representing business processes: <b>FALSE</b></li><br>
BPEL provides a standard language for specifying and executing business processes, the BPEL specification does not include a standard notation. However, there exists a business process modeling notation (<a href="http://www.ebpml.org/bpmn.htm">BPMN</a>) to BPEL mapping.</ul></p>

<p><ul><li>BPEL provides process choreography, that is, means of specifying a network of communicating processes: <b>FALSE</b></li><br>
BPEL is not <a href="http://www.w3.org/TR/ws-cdl-10/">WS-CDL</a>! BPEL specifies the interaction between peer business processes, and not among a network of several processes.</ul></p>

<p><ul><li>BPEL is a declarative language, especially so as it is specified in XML: <b>FALSE</b></li><br>
BPEL, just like Java, and C/C++, is an imperative language, based upon states, statements, and the usual structured language constructs we are used to, such as <i>if-then-else</i>, <i>switch-case</i>, <i>while</i>, etc. Being specified in XML, does not make it more or less declarative.</ul></p>

<p><ul><li>BPEL allows the modeling of long running processes: <b>TRUE</b></li><br>
BPEL provides native support for compensation handling, a very useful feature for modeling <i>undo</i> work needed to guarantee some form of atomicity when locking resources is prohibitive.</ul></p>

<p><ul><li>BPEL allows the modeling of highly concurrent activities: <b>TRUE</b></li><br>
BPEL provides native support for concurrent flows and advance synchronization of these flows.</ul></p>]]>
        
    </content>
</entry>
<entry>
    <title>Memory management for real-time applications in Java</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2006/05/memory_manageme.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2006/05/memory_manageme.html</id>
    
    <published>2006-05-22T18:01:54Z</published>
    <updated>2006-09-12T20:56:19Z</updated>
    
    <summary>What is the appropriate memory management technique for developing real-time applications in Java? Can we rely on garbage collectors?</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Technology: Vertical Markets" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[<p>One of the main advantages of using Java is not to have to worry about disposing objects [1], that is, to let the Java runtime take care of the memory management of Java objects.</p>

<p>This is done by letting the Java runtime garbage collect Java objects that are no longer being used. </p>

<p>Garbage collection is a relatively complicated process. Generally, the Java runtime will traverse the heap, checking for objects that are no longer being referenced by any other objects, and thus can be safely deleted. </p>

<p>However, as garbage collection uses CPU cycles, it may impact the execution of application code. That is, if during the execution of the application code, garbage collection is performed, the application code may take more time to respond. This causes the latency of the user transaction to increase. Even worse, as it is unknown to the user when a garbage collection may occur, the latency increase is unpredictable.</p>

<p>Real-time applications have strict timing requirements, that is, they have to execute application code under some determined, known latency. Thus the unpredictable latency increase that may be caused by the garbage collection becomes a problem. </p>

<p>What are the solutions to this problem? One obvious solution is not to use Java for real-time applications. This is a poor solution. Java brings a lot as a programming language and as a development platform; we should be able to solve this problem in Java.</p>

<p>Another solution is to use a different memory management approach in Java instead of garbage collectors. <a href="http://www.jcp.org/en/jsr/detail?id=282">RTSJ</a>, the Real-Time Specification for Java, defines the concept of <a href="http://java.sun.com/j2se/realtime/">immortal memory, and scoped memory</a>. Immortal memory is memory that is never garbage collected; it lives forever until the JVM is brought down. Scoped memory is memory that is allocated and released in chunks. That is, the user explicitly creates a scope of memory where the objects will live and the objects are released when the scope is exited or destroyed. In both cases of immortal memory and scoped memory, there is no need for garbage collection. However, there is a drawback, the onus of managing the memory has again moved back to the user, as it is the case for C/C++ applications. This still seems too high of a price to pay. Can we do better?</p>

<p>Ok, so <quote>let's</quote> re-consider garbage collection, the main problem with garbage collection is the unpredictable latency spikes it causes. Can we avoid this unpredictable behavior? Or rather, can we limit (i.e. bind) this unpredictable behavior?  Yes, by doing garbage collection more often and consistently, we can bind the maximum latency pause time. This is the approach taken by <a href="http://edocs.bea.com/wlrt/docs10/index.html">WLRT</a>. Thus, garbage collection becomes a <u>predictable task</u>, with a known cost, which can be considered and modeled by the real-time developer as needed. And, most importantly, we <u><quote>don't</quote> sacrifice <quote>Java's</quote> easy of use</u>.</p>]]>
        <![CDATA[<p>[1] it should be noted that Java programs can still have memory leaks, in spite of garbage collection or any other memory management technique. For instance, by not removing component objects from containers, when they are no longer needed.</p>]]>
    </content>
</entry>
<entry>
    <title>Resolving XML QNames</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2005/11/resolving_xml_q_1.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2005/11/resolving_xml_q_1.html</id>
    
    <published>2005-11-12T01:49:35Z</published>
    <updated>2006-09-12T20:56:16Z</updated>
    
    <summary>How do you expand a XML QName in the presence of default namespaces?</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Technology: Web Services" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[<p class=MsoNormal>The XML Namespace specification defines the concept of a <a
href="http://www.w3.org/TR/REC-xml-names/#dt-qname">qualified name</a> as a name
consisting of a local part and namespace URI.</p>

<p class=MsoNormal>A qualified name, or QName, is specified in terms of a
prefix and a local part (e.g. &lt;<i>foo:bar</i> xmlns:foo=&apos;urn:foo&apos;&gt;),
where the prefix (<i>foo</i>) is resolved to a namespace URI (&apos;<i>urn:foo</i>&apos;).
This process of resolving the prefix results in what is commonly known as the
expanded name.</p>

<p class=MsoNormal>The rules for resolving a prefix are mostly uniform in the
context of different XML processors, with the exception of how default
namespaces (e.g. <i>xmlns=&apos;urn:foo&apos;</i>) are dealt with.</p>

<p class=MsoNormal>Specifically:</p>

<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in'><span
style='font-family:Symbol'>&#45;<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span>XML elements: if the QName does not have a prefix, then the
in-scope default namespace must be used.</p>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;border:none'>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>XML</b></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-left:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>Resolved
  namespace for element &apos;foo&apos;</b></p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&lt;<i>foo</i> xmlns=&apos;urn:foo&apos;/&gt;</p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&apos;urn:foo&apos;</p>
  </td>
 </tr>
</table>
<br>
<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in'><span
style='font-family:Symbol'>&#45;<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span>XML attributes: if the QName does not have a prefix, then the
namespace URI is NULL, that is, the default namespace is not used.</p>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;border:none'>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>XML</b></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-left:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>Resolved
  namespace for attribute &apos;a&apos;</b></p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&lt;foo xmlns=&apos;urn:foo&apos;<i>a</i>=&apos;attr1&apos;/&gt;</p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>NULL</p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&lt;foo xmlns:ns1=&apos;urn:foo&apos; <i>ns1:a=</i>&apos;attr1&apos; /&gt;</p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&apos;urn:foo&apos;</p>
  </td>
 </tr>
</table>
<br>
<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in'><span
style='font-size:10.0pt;font-family:Symbol'>&#45;<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span>Attribute value of W3C Schema primitive type QName: if the QName
does not have a prefix, then the in-scope default namespace must be used.</p>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;border:none'>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>XML</b></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-left:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>Resolved
  namespace of attribute value of attribute &apos;a&apos;</b></p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&lt;foo xmlns=&apos;urn:foo&apos; a=&apos;<i>myname</i>&apos;/&gt;</p>
  <p class=MsoNormal>where </p>
  <p class=MsoNormal>&lt;xsd:attribute name=&apos;a&apos; type=&apos;xsd:QName&apos;/&gt;</p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&apos;urn:foo&apos;</p>
  </td>
 </tr>
</table>
<br>
<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in'><span
style='font-size:10.0pt;font-family:Symbol'>&#45;<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span>XSLT (1.0) variable or parameter: if the QName does not have a
prefix, then the namespace URI is NULL, that is, the default namespace is not
used.</p>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;border:none'>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>XSLT</b></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-left:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>Resolved
  namespace for variable</b></p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&lt;<i>xsl:variable</i> name=&apos;varA&apos; xmlns=&apos;urn:foo&apos; /&gt;</p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>NULL</p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&lt;<i>xsl:variable</i> name=&apos;ns1:varA&apos; xmlns=&apos;urn:foo&apos;
  xmlns:ns1=&apos;urn:bar&apos; /&gt;</p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&apos;urn:bar&apos;</p>
  </td>
 </tr>
</table>
<br>
<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in'><span
style='font-family:Symbol'>&#45;<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span>XPath 1.0 node tests: if the QName does not have a prefix, then
the namespace URI is NULL, that is, the default namespace is not used.</p>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;border:none'>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>XPATH</b></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-left:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>Resolved
  namespace for Node Test &apos;b&apos;</b></p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&lt;a xmlns:ns1=&apos;urn:foo&apos; xmlns=&apos;urn:foo&apos;&gt;<br>&nbsp;&nbsp;&lt;b/&gt;<br>&lt;/a&gt;</p>
  <p class=MsoNormal>/ns1:a/<i>b</i></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>NULL</p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>/ns1:a/<i>ns1:b</i></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&apos;urn:foo&apos;</p>
  </td>
 </tr>
</table>
<br>
<p class=MsoNormal style='margin-left:.25in;text-indent:-.25in'><span
style='font-family:Symbol'>&#45;<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span>XPath 2.0 node (name) tests: if the QName does not have a prefix,
then the in-scope default namespace must be used.</p>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;border:none'>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>XPATH</b></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-left:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b>Resolved
  namespace for Node Test &apos;b&apos;</b></p>
  </td>
 </tr>
 <tr>
  <td width=295 valign=top style='width:221.4pt;border:solid windowtext 1.0pt;
  border-top:none;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&lt;a xmlns:ns1=&apos;urn:foo&apos; xmlns=&apos;urn:foo&apos;&gt;<br>&nbsp;&nbsp;&lt;b/&gt;<br>&lt;/a&gt;</p>
  <p class=MsoNormal>/ns1:a/<i>b</i></p>
  </td>
  <td width=295 valign=top style='width:221.4pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal>&apos;urn:foo&apos;</p>
  </td>
 </tr>
</table>

<p class=MsoNormal>&nbsp;</p>]]>
        
    </content>
</entry>
<entry>
    <title>Standard Compliance and BPEL TCK</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2005/10/standard_compli.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2005/10/standard_compli.html</id>
    
    <published>2005-10-25T07:13:53Z</published>
    <updated>2006-09-12T20:56:14Z</updated>
    
    <summary>How does one conform to the OASIS BPEL specification? </summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Technology: Web Services" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[<p>Different standard bodies deal differently in respect to verifying compliance to their published specifications.</p>

<p>Sun's JCP (Java Community Process version 2.1) is very stringent on implementors of its specifications. The specification lead must provide a technology compatibility kit (TCK). The TCK includes tests, tools, and documentation that a implementor must use to verify and prove conformance to the specification. These TCKs usually consist of huge test-beds, containing hundreds of test-cases. The implementor can only promote conformance to a specification after all test-cases have passed with a positive result.</p>

<p>In contrast, OASIS defines a Adoption Service program. Adoption services are a group of services whose aim is to drive adoption of OASIS standards (and OASIS committee drafts) by means of providing conformance, interoperability, or training/personal skill certification programs. Organizations can work together with OASIS to create a referral relationship, which is then used to advertise the certification programs that the organizations provide. Conformance certification programs usually consist of test assertion summary documents, and a testing process. </p>

<p>I did a quick search in the Web and I could not find any single OASIS referred adoption service program for BPEL, version 1.1 or otherwise.<br />
What this means is that currently there is no way of asserting implementation conformance to the OASIS BPEL4WS 1.1 committee draft. <br />
In another words, even if the implementors wanted to guarantee that their implementation is portable and fully compliant, there is no obvious way of doing so.</p>

<p>In spite of this, there are several vendors that do offer BPEL engine implementations. <a href="http://en.wikipedia.org/wiki/BPEL">Wikipedia</a> alone lists over 20 providers. How many of these are really full-fledged BPEL engines? Actually, how many of these even provide a minimum level of portability and QoS? It is very hard to tell. </p>

<p>Even worse, currently the onus of ascertaining conformance is on the client. And vendors are not facilitating it. Vendors do not provide a compatibility issue list, or even document the features that they support.</p>

<p>To confirm this, I wrote two scenarios that test significant but hidden BPEL features and executed these scenarios in a couple of <i>commercial</i> and open-source implementations. The BPEL processes for these scenarios are included for reference.</p>

<p>The first one has to do with isolated scopes. When a scope is marked as isolated (variableAccessSerialized), access to its variables must follow a serialization schedule, so that data consistency is preserved. To force the engine into yielding while running within a isolated scope, I used a <i>receive</i> activity and delayed the dispatch of its message.</p>

<p>The second scenario has to do with dead-path-elimination. Paths that will not (ever) be executed, e.g. the unselected case of a <i>switch</i> statement, must be considered as having a negative link status and this negative status must be propagated to all of its target links. Otherwise the flow may just block indefinitely, or until the transaction, if present, times-out.</p>

<p>None of the implementations I tried were able to cope with either of these scenarios. I was not particularly surprised about this. Granted, the BPEL 1.1 specification is not very clear in respect to these particular features, but they are very important nonetheless. So it seems there is a urgent need for a BPEL TCK!<br />
<br></p>]]>
        <![CDATA[<ol>
<li><u>Isolated scope test-case</u>:</li>
<br>
&lt;process name="isolatedscope" targetNamespace="http://bea.com/bpeltck/isolatedscope"
 xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
 xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
 xmlns:ns1="http://www.w3.org/2001/XMLSchema"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:client="http://bea.com/bpeltck/isolatedscope"&gt;

<p>&nbsp;&nbsp;&lt;partnerLinks&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;partnerLink name="client" <br />
partnerLinkType="client:plt" myRole="Provider"/&gt;<br />
&nbsp;&nbsp;&lt;/partnerLinks&gt;<br />
&nbsp;&nbsp;&lt;variables&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;variable name="inputVariable" messageType="client:RequestMessage"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;variable name="outputVariable" messageType="client:ResponseMessage"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;variable name="totalVar" type="ns1:string"/&gt;<br />
&nbsp;&nbsp;&lt;/variables&gt;<br />
&nbsp;&nbsp;&lt;sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;receive partnerLink="client" portType="client:pt" operation="process" variable="inputVariable" createInstance="yes"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;assign &gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from variable="inputVariable" part="payload" query="/client:ProcessRequest/client:input"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to variable="totalVar"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;flow suppressJoinFailure="yes"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;links&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;link name="AtoB"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/links&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sequence &gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;scope name="debit" variableAccessSerializable="yes"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;target linkName="AtoB"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;variables&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;variable name="tempVar" type="ns1:string"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/variables&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assig &gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from variable="totalVar"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to variable="tempVar"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from expression="bpws:getVariableData ( 'tempVar' )  - 10"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to variable="totalVar"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/scope&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;scope name="credit" variableAccessSerializable="yes"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;variables&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;variable name="tempVar" type="ns1:string"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/variables&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;source linkName="AtoB"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from variable="totalVar"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to variable="tempVar"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;receive createInstance="no" partnerLink="client" portType="client:pt" operation="wake" variable="inputVariable"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from expression="bpws:getVariableData ( 'tempVar' )  + 10"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to variable="totalVar"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/scope&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/flow&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from variable="totalVar"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to variable="outputVariable" part="payload" query="/client:ProcessResponse/client:result"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;reply name="replyOutput" partnerLink="client" portType="client:pt" operation="process" variable="outputVariable"/&gt;<br />
&nbsp;&nbsp;&lt;/sequence&gt;<br />
&lt;/process&gt;<br />
<li><u>DPE test-case:</u></li><br />
&lt;process name="dpe" targetNamespace="http://bea.com/bpeltck/dpe" <br />
 xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" <br />
 xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"<br />
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" <br />
 xmlns:client="http://bea.com/bpeltck/dpe" &gt;</p>

<p>&nbsp;&nbsp;&lt;partnerLinks&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;partnerLink name="client" partnerLinkType="client:plt" myRole="Provider" partnerRole="Requester"/&gt;<br />
&nbsp;&nbsp;&lt;/partnerLinks&gt;<br />
&nbsp;&nbsp;&lt;variables&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;variable name="inputVariable" messageType="client:RequestMessage"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;variable name="outputVariable" messageType="client:ResponseMessage"/&gt;<br />
&nbsp;&nbsp;&lt;/variables&gt;<br />
 &lt;sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;receive partnerLink="client" portType="client:pt" operation="initiate" variable="inputVariable" createInstance="yes"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;flow suppressJoinFailure="yes"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;links&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;link name="AtoB"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/links&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;target linkName="AtoB"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from variable="inputVariable" part="payload" query="/client:ProcessRequest/client:input"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to variable="outputVariable" part="payload" query="/client:ProcessResponse/client:result"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;switch&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;case condition="bpws:getVariableData ( 'inputVariable', 'payload', '/client:ProcessRequest/client:input' )  = 'donotmatch'"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;empty&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;source linkName="AtoB"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/empty&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/case&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;otherwise&gt; &lt;!-- selected case --&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;sequence &gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from expression="'otherwise'"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to variable="outputVariable" part="payload" query="/client:ProcessResponse/client:result"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/copy&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/assign&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/otherwise&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/switch&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sequence&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/flow&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;invoke partnerLink="client" portType="client:cb" operation="onCallback" inputVariable="outputVariable"/&gt;<br />
&nbsp;&nbsp;&lt;/sequence&gt;<br />
&lt;/process&gt;<br />
</ol></p>]]>
    </content>
</entry>
<entry>
    <title>JBI vocabulary</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2005/10/jbi_vocabulary_1.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2005/10/jbi_vocabulary_1.html</id>
    
    <published>2005-10-10T18:49:41Z</published>
    <updated>2006-09-12T20:56:14Z</updated>
    
    <summary>What are JBI&apos;s commonly used definitions?</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Technology: Web Services" />
            <category term="Technology: Web Services" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[JBI is relatively new as a Java standard, and its deliberation is still going on.<br/>
In spite of this, there is at least one aspect of JBI that has already become popular, and that is the vocabulary and patterns that it uses and defines.<br/>
<p>
<ul>
<li><b>Binding Components</b>: Software components that understand specific protocols and are able to convert to a normalized or common system-wide protocol. They function as the entry and exit point of the system. Also commonly known as adapters.</li>
<li><b>Service Engines</b>: Software components responsible for servicing requests, generally by means of transformation. Examples are XSLT transformers, BPEL engines, rule engines, etc.</li>
<li><b>Message Exchange</b>: Message interchanging protocol, common exchange patterns are request-reply, in-only, etc. </li>
<li><b>Component Installation</b>: Static or dynamic addition of a executable software component onto the runtime environment.</li>
<li><b>Service Deployment</b>: Static or dynamic addition of services (or applications) onto a installed component.</li>
<li><b>Service Assemblies</b>: A set of services.</li>
</ul>
<br/>
Standards are used for achieving interoperability and portability, however we should not overlook their importance on facilitating communication.]]>
        
    </content>
</entry>
<entry>
    <title>What problems does BPEL help to solve?</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2005/09/what_problems_d.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2005/09/what_problems_d.html</id>
    
    <published>2005-09-16T20:47:33Z</published>
    <updated>2006-09-12T20:56:14Z</updated>
    
    <summary>BPEL is a feature-rich language for modeling and execution of business process orchestration. But what are its use-cases?</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Technology: Service-oriented Architecture" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[<p>There has been a lot of talk about BPEL, but mostly it is being focused on its technical features, such as how compensation handling works.</p>

<p>Particularly, I have not seen a lot of emphasis on the use-cases that BPEL helps to solve.</p>

<p>So, as an attempt to understand where one can use BPEL (in the context of integration) and what are the most valuable BPEL features, I've tried to come up with a (incomplete) list of scenarios where BPEL is able to help with:</p>

<blockquote><ul>
<li>Intelligent dynamic routing based upon message content and process state;</li>
<li>Compensation of non-transactional work and long-running processes;</li>
<li>Sequential and concurrent splitter and aggregation of messages;</li>
<li>Content enrichment and message filtering;</li>
<li>Support for process instances with complex exception/fault paths;</li>
<li>Support for process instances with multiple on-going conversations;</li>
</ul>
</blockquote>
I would be very interested in knowing if anyone else has had experience implementing integration scenarios using BPEL. What were you trying to solve? What was easy to do and what was hard to do? How was it better (or worse) than using some other technology, such as XSLT?]]>
        
    </content>
</entry>
<entry>
    <title>Web Services Messages for BPEL, JBI, and JAX-RPC</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/aalves/archive/2005/09/web_services_me_1.html" />
    <id>http://dev2dev.bea.com/blog/aalves/archive/2005/09/web_services_me_1.html</id>
    
    <published>2005-09-07T21:53:06Z</published>
    <updated>2006-09-12T20:56:13Z</updated>
    
    <summary>How do BPEL, JBI, and JAX-RPC represent WSDL messages?</summary>
    <author>
        <name>aalves</name>
        
    </author>
            <category term="Product: WebLogic Integration" />
            <category term="Technology: Web Services" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/aalves/">
        <![CDATA[It is interesting how applications differ when modeling WSDL messages.
<p>
<strong>WS-BPEL 2.0:</strong>
<p>
For instance, BPEL 2.0 represents a WSDL (1.1) message by conceptually materializing each WSDL message part into a separate Xml document. In this case, the document element corresponds to either a synthesized element whose type is equal to the part&apos;s <em>type</em> attribute, or the document element is the element referenced by the part&apos;s <em>element</em> attribute itself (in summary).
<p>
For example, consider the following WSDL definition:
<p>
<blockquote><pre>&lt;definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
    targetNamespace="urn:sample" 
    xmlns:tns="urn:sample"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

    &lt;types>
        &lt;xsd:schema targetNamespace="urn:sample">
            &lt;xsd:element name="value" type="xsd:string" />
        &lt;/xsd:schema>
    &lt;/types>

    &lt;message name="sampleMessage">
        &lt;part name="part1" type="xsd:string" />
        &lt;part name="part2" element="tns:value" />
    &lt;/message>
&lt;/definitions>
</pre></blockquote>
<p>
Note that we are not worried about a particular binding in the context of this scenario. For example, a SOAP literal binding would only allow messages to have one part if it uses the <em>type</em> attribute.
<p>
One example of a message instance for this definition is the following set of two document instances:
<p>
<blockquote><pre>
&lt;ns2:message xmlns:ns2="http://com.bea.sample.bpelmessage">first value!&lt;/ns2:message>
</pre></blockquote>
and
<blockquote><pre>
&lt;ns1:value xmlns:ns1="urn:sample">second value!&lt;/ns1:value>
</pre></blockquote>
<p>
<strong>JBI:</strong>
<p>
As for JBI, WSDL (1.1) messages are materialized into a single Xml document whose document element 'wraps' each message part as a child element.
<p>
So, for the previous WSDL definition, one example of a message instance is:
<p>
<blockquote><pre>
&lt;jbi:message version="1.0" type="ns1:sampleMessage"
    xmlns:ns1="urn:sample" xmlns:jbi="...">
    &lt;jbi:part>first value!&lt;/jbi:part>
    &lt;jbi:part>
        &lt;ns1:value>second value!&lt;/ns1:value>
    &lt;/jbi:part>
&lt;/jbi:message>
</pre></blockquote>
<p>
<strong>JAXRPC 2.0:</strong>
<p>
JAXRPC approach is slightly different, as JAXRPC binds the WSDL message to Java instead of representing it in a Xml document. Still, it’s approach is somewhat similar to that of BPEL, as it binds each WSDL message part into a separate Java method argument.
<p>
In this case, lets consider a slightly modification of the previous WSDL definition, which is more appropriate for RPC:
<p>
<blockquote><pre>
&lt;definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
    targetNamespace="urn:sample" 
    xmlns:tns="urn:sample"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    &lt;types>
        &lt;xsd:schema targetNamespace="urn:sample">
            &lt;xsd:element name="value1" type="xsd:string" />
            &lt;xsd:element name="value2" type="xsd:string" />
        &lt;/xsd:schema>
    &lt;/types>

    &lt;message name="sampleMessage">
        &lt;part name="part1" element="tns:value1" />
        &lt;part name="part2" element="tns:value2" />
    &lt;/message>

    &lt;portType name="samplePT">
        &lt;operation name="sampleOper">
            &lt;input message="tns:sampleMessage" />
        &lt;/operation>
    &lt;/portType>
&lt;/definitions>
</pre></blockquote>
<p>
The corresponding Java binding would be:
<p>
<blockquote><pre>
void sampleOper(java.lang.String part1, java.lang.String part2)
    throws RemoteException
</pre></blockquote>
<p>
<strong>WSDL 2.0:</strong>
<p>
Finally, WSDL 2.0 solves this problem by getting rid of the WSDL message part concept and hence specifying WSDL messages using W3C Schema element, which already has a obvious mapping when materialized into a document instance.
<p>
<strong>Conclusion:</strong>
<p>
The result of these differences is that one would have to transform/adapt the <u>same</u> WSDL (1.1) message when routing it within a JBI implementation through a BPEL service engine, JAXRPC applications, etc.]]>
        
    </content>
</entry>

</feed> 