Building your first WebLogic Event Server Application

by Robin Smith
07/16/2007

Abstract

WebLogic Event Server, the next-generation event-driven SOA real-time Java container, is here. It encompasses the use of an event processing network of nodes with OSGi bundles and the Spring framework—a powerful combination.

The purpose of this article is to guide you through a step-by-step process for creating your first WebLogic Event Server application. You can very quickly create and publish (deploy) your application and see it in action. After completing the tutorial, you'll be well on your way to understanding the design principles of real-time event-driven architecture.

The General Concepts

Before we start the development process, let's review some fundamental concepts. Your application will model a complex event processing (CEP) network (see Figure 1). This will encompass a collection of collaborating producers and consumers of events with nodes (stages) that reflect:

  • Services—these can be a combination of adapters, streams, and processors
  • Business Objects—these are plain old java objects (POJOs) that can make use of the supported Spring framework (Spring Beans) and are the "vehicle" to maintain the business logic that will act upon its associated events
  • Events—these "transverse" the event network and can be represented as POJOs or maps

    Event Driven Programming Model

    Figure 1. Event-driven programming model

    The Spring Framework Guides the Way

    The new Java container fully supports Spring. This leading full-stack Java application framework provides significant benefits for development projects, increasing development productivity and runtime performance while improving test coverage and application quality.

    The event-driven programming paradigm supported by the WebLogic Event Server provides for a Spring-based declarative assembly and configuration (see Figure 2), which enables applications to be configured in Spring configuration files. These files incorporate custom Spring tags for the WebLogic Event Server services, seamless integration to legacy Spring beans, and dependency injection capabilities for additional services, such as those provided by the SOA fabric offered by the BEA product portfolio.

    HelloWorld Spring Assembly

    Figure 2. Example of the HelloWorld Spring Assembly File

    The Event Processing Language

    Another major aspect to a complex event processing (CEP) network is that the processors derive the "events" from one or more incoming data streams with the use of the BEA Event Processing Language (EPL). Its use in the context of an event processor can be seen as analogous to the database management of structured data—but backwards. Rather than the information remaining static with SQL queries being executed ad-hoc across the data, in an event-driven application the queries remain static and the data is continuously changing. The processor(s) (meaning the CEP engine) "assimilates" EPL as it continuously filters, correlates, and manages causality, and then aggregates the data streams, all executed in soft real time.

    EPL is our SQL-like event processing language that drives the processor(s). It extends the traditional capabilities of SQL by using WHEN rather than IF clauses, therefore handling the required temporal constraints to define windows in the streaming data in which event patterns can be identified and acted upon accordingly. Here is an example of EPL:

    <n1:config>
    
      <processor>
    
        <name>helloworldProcessor</name>
    
        <rules>
    
          <rule id="helloworldRule"><![CDATA[ 
    
             select * from HelloWorldEvent retain 1 event ]]></rule>
    
        </rules>
    
      </processor>
    
      <adapter>
    
        <name>helloworldAdapter</name>
    
        <message>HelloWorld - the current time is:</message>
    
      </adapter>
    
    </n1:config>
    
    
    Listing 1. EPL used in the HelloWorld example

    The "retains" clause in the simple EPL statement in Listing 1 defines the window of events that are visible to the query. In this case, the retains value of 1 means that we simply want to see each event once. The code that processes these events is shown in Listing 2.

    EPL is a powerful language that enables you, the developer, to implement a comprehensive range of queries to "extract" the events from the incoming data and invoke your business logic (POJO). What is really cool is that EPL is defined outside the programmatic aspects of the application, which can facilitate high developer productivity and flexibility. In fact, you can dynamically alter queries without recompiling, bundling and republishing the associated application to enable your solution to react to changing conditions or circumstances in real time.

    Okay, enough with the programming concepts. Let's look at the container quickly, before plunging into some code.

    The Real-time Java Container for Event-driven SOA

    As you might have suspected by now, BEA is not offering any traditional extensions to its leading Java EE Application Server or add-ons to its other extensive array of products. The WebLogic Event Server is a completely new, built-from-the-ground-up Java container, based on the latest BEA msA (micro-services architecture). At the core of its design is an infrastructure for providing deterministic, extremely low application latencies under predetermined peak workloads—an essential requirement for high-performance real-time applications. Unlike other solutions, where the developer needs to program to new extension APIs or complex self-memory management implementations, this new Java container achieves its goals by adopting transparently for the developer real-time concepts, such as dynamically minimizing thread context switching and synchronization, tuning I/O (such as socket connections), and incorporating real-time scheduling techniques and efficient memory management.

    All of these capabilities can be augmented with the benefits offered by another product in the Event-driven SOA (EDSOA) family: WebLogic Real Time. This product, a subject for other more detailed articles, can provide a unique foundational runtime for the WebLogic Event Server, with its own low latency-focused Java virtual machine (JVM) implementation (see Figure 3).

    Event Server Deterministic Container

    Figure 3. A unique deterministic Java runtime and Java container

    A New RAD Development Environment

    Now that I have teased you with new concepts and implementations, let me now introduce the BEA Eclipse rapid application development (RAD) environment for the WebLogic Event Server.

    While it is very important that you are aware of the concepts and rich features offered by these new technologies, BEA is now providing you with a collection of intuitive wizards for the dynamic construction and publishing of WebLogic Event Server applications.

    Before building our first EDA application (the traditional "HelloWorld"), you need to make sure you have installed all of the required software. I recommend that you use Eclipse 3.2 with WTP, and then use the "feature updates" capability to get the latest version of Spring. Now you are ready to install the custom BEA Eclipse Technology Preview of the BEA WebLogic Server Plug-in (see Figure 4) by once again using the "feature updates" with the Local Site option.

    Eclipse Install Feature

    Figure 4. Install the WebLogic Event Server Eclipse plug-in

    Pages: 1, 2

    Next Page »