This section contains information on the following subjects:
WebLogic Event Server provides a number of Spring tags that you use in the EPN assembly file of your application to register event types, declare the components of the event processing network and specify how they are linked together. The EPN assembly file is an extension of the standard Spring context file.
The following graphic describes the hierarchy of the WebLogic Event Server Spring tags.
The following sample EPN assembly file from the HelloWorld application shows how to use many of the WebLogic Event Server tags:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:wlevs="http://www.bea.com/ns/wlevs/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.bea.com/ns/wlevs/spring
http://www.bea.com/ns/wlevs/spring/spring-wlevs.xsd">
<!-- First, create and register the adapter (and factory) that generates hello world messages -->
<osgi:service interface="com.bea.wlevs.ede.api.AdapterFactory">
<osgi:service-properties>
<prop key="type">hellomsgs</prop>
</osgi:service-properties>
<bean class="com.bea.wlevs.adapter.example.helloworld.HelloWorldAdapterFactory" />
</osgi:service>
<wlevs:event-type-repository>
<wlevs:event-type type-name="HelloWorldEvent">
<wlevs:class>com.bea.wlevs.event.example.helloworld.HelloWorldEvent</wlevs:class>
</wlevs:event-type>
</wlevs:event-type-repository>
<!-- Assemble EPN (event processing network) -->
<!-- The adapter id is used by the configuration system, so needs to be well-known -->
<wlevs:adapter id="helloworldAdapter" provider="hellomsgs" manageable="true">
<!-- This property is also configure by dynamic config -->
<wlevs:instance-property name="message" value="HelloWorld - the currenttime is:"/>
</wlevs:adapter>
<!-- The processor id is used by the configuration system, so needs to be well-known -->
<wlevs:processor id="helloworldProcessor" manageable="true" />
<wlevs:stream id="helloworldInstream" manageable="true">
<wlevs:listener ref="helloworldProcessor"/>
<wlevs:source ref="helloworldAdapter"/>
</wlevs:stream>
<!-- Manageable is so that we can monitor the event throughput -->
<wlevs:stream id="helloworldOutstream" manageable="true">
<wlevs:listener>
<!-- Create business object -->
<bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
</wlevs:listener>
<wlevs:source ref="helloworldProcessor"/>
</wlevs:stream>
</beans>
Use this tag to declare an adapter service to the Spring application context.
The wlevs:adapter
Spring tag supports the following child tags:
The following table lists the attributes of the wlevs:adapter
Spring tag.
The following example shows how to use the wlevs:adapter
tag in the EPN assembly file:
<wlevs:adapter id="helloworldAdapter" provider="hellomsgs">
<wlevs:instance-property name="message"
value="HelloWorld - the current time is:"/>
</wlevs:adapter>
In the example, the adapter's unique identifier is helloworldAdapter
. The provider is an OSGi service, also registered in the EPN assembly file, whose reference is hellomsgs
. The adapter has a static property called message
, which implies that the adapter Java file has a setMessage()
method.
Specifies the fully qualified JavaBean classname that implements a particular event type.
This tag is used only as a child of wlevs:event-type.
This tag has no child tags and no attributes
The following example shows how to use the wlevs:class
tag in the EPN assembly file:
<wlevs:event-type type-name="HelloWorldEvent"><wlevs:class>com.bea.wlevs.event.example.helloworld.HelloWorldEvent</wlevs:class>
</wlevs:event-type>
In the example, the <wlevs:class>
tag specifies the class (com.bea.wlevs.event.example.helloworld.HelloWorldEvent
) that defines the HelloWorldEvent
event type.
Use this tag to group together one or more wlevs:event-type
tags, each of which is used to register an event type used throughout the application.
This tag does not have any attributes.
The wlevs:event-type-repository
Spring tag supports the following child tag:
The following example shows how to use the wlevs:event-type-repository
tag in the EPN assembly file:
<wlevs:event-type-repository>
<wlevs:event-type type-name="HelloWorldEvent">
<wlevs:class>com.bea.wlevs.event.example.helloworld.HelloWorldEvent</wlevs:class>
</wlevs:event-type></wlevs:event-type-repository>
In the example, the <wlevs:event-type-repository>
tag groups a single <wlevs:event-type>
tag to declare a single event type: HelloWorldEvent
. See wlevs:event-type for additional details.
Specifies the definition of an event type used in the WebLogic Event Server application. Once you define the event types of the application, you can reference them in the adapter and business class POJO, as well as the EPL rules.
You can define an event type in the following ways:
You can specify one of either wlevs:class
or wlevs:metadata
as a child of wlevs:event-type
, but not both.
You can also use the wlevs:property child tag to specify a custom property to apply to the event type.
BEA recommends that you define your event type by using the wlevs:class
child tag because you can them reuse the specified JavaBean class, and you control exactly what the event type looks like.
The wlevs:event-type
Spring tag supports the following child tags:
The following table lists the attributes of the wlevs:event-type
Spring tag.
The following example shows how to use the wlevs:event-type
tag in the EPN assembly file:
<wlevs:event-type-repository><wlevs:event-type type-name="HelloWorldEvent">
</wlevs:event-type-repository>
<wlevs:class>com.bea.wlevs.event.example.helloworld.HelloWorldEvent</wlevs:class>
</wlevs:event-type>
In the example, the name of the event type is HelloWorldEvent
and its definition is determined by the com.bea.wlevs.event.example.helloworld.HelloWorldEvent
JavaBean class.
Specifies the properties that apply to the create stage instance of the component to which this is a child tag. This allows declarative configuration of user-defined stage properties.
This tag is used only as a child of wlevs:adapter, wlevs:processor, or wlevs:stream.
The wlevs:instance-property
tag is defined as the Spring propertyType
type; for additional details of this Spring data type, the definition of the allowed child tags, and so on, see the
Spring 2.0 XSD.
You can specify one of the following standard Spring tags as a child tag of the wlevs:instance-property
tag:
The following table lists the attributes of the wlevs:instance-property
Spring tag.
The following example shows how to use the wlevs:instance-property
tag in the EPN assembly file:
<wlevs:adapter id="helloworldAdapter" provider="hellomsgs"><wlevs:instance-property name="message" value="HelloWorld - the current time is:"/>
</wlevs:adapter>
In the example, the bean that implements the helloworldAdapter
adapter component expects an instance property called message
; the sample wlevs:instance-property
tag above sets the value of this property to HelloWorld - the current time is:
.
Specifies the component that listens to the component to which this tag is a child. A listener can be an instance of any other component. You can also nest the definition of a component within a particular wlevs:listener
component to specify the component that listens to the parent.
WARNING: | Nested definitions are not eligible for dynamic configuration or monitoring. |
This tag is always a child of wlevs:adapter, wlevs:processor, or wlevs:stream.
The following table lists the attributes of the wlevs:listener
Spring tag.
The following example shows how to use the wlevs:listener
tag in the EPN assembly file:
<wlevs:processor id="helloworldProcessor"><wlevs:listener ref="helloworldOutstream"/>
</wlevs:processor>
In the example, the hellworldOutstream
component listens to the helloworldProcessor
component. It is assumed that the EPN assembly file also contains a declaration for a <wlevs:adapter>
, <wlevs:stream>
, or <wlevs:processor>
component whose unique identifier is helloworldOustream
.
Specifies the definition of an event type by listing its fields as a group of Spring entry
tags. When you define an event type this way, WebLogic Event Server automatically generates the Java class for you.
Use the key
attribute of the entry
tag to specify the name of a field and the value
attribute to specify the Java class that represents the field's data type.
This tag is used only as a child of wlevs:event-type.
The wlevs:metadata
tag is defined as the Spring mapType
type; for additional details of this Spring data type, see the
Spring 2.0 XSD.
The wlevs:metadata
tag can have one or more standard
Spring entry
child tags.
The following table lists the attributes of the wlevs:metadata
Spring tag.
The following example shows how to use the wlevs:metadata
tag in the EPN assembly file:
<wlevs:event-type type-name="ForeignExchangeEvent"><wlevs:metadata>
...
<entry key="symbol" value="java.lang.String"/>
<entry key="price" value="java.lang.Double"/>
<entry key="fromRate" value="java.lang.String"/>
<entry key="toRate" value="java.lang.String"/>
</wlevs:metadata>
</wlevs:event-type>
In the example, the wlevs:metadata
tag groups together four standard Spring entry
tags that represent the four fields of the ForeignExchangeEvent
: symbol
, price
, fromRate
, and toRate
. The data types of the fields are java.lang.String
, java.lang.Double
, java.lang.String
, and java.lang.String
, respectively.
Use this tag to declare a processor to the Spring application context.
The wlevs:processor
Spring tag supports the following child tags:
The following table lists the attributes of the wlevs:processor
Spring tag.
The following example shows how to use the wlevs:processor
tag in the EPN assembly file:
<wlevs:processor id="spreader" />
The example shows how to declare a processor with ID spreader
. This means that in the processor configuration file that contains the EPL rules for this processor, the <name>
element must contain the value spreader
. This way WebLogic Event Server knows which EPL rules it must file for this particular processor.
Specifies a custom property to apply to the event type.
This tag is used only as a child of wlevs:event-type, wlevs:adapter, wlevs:processor, or wlevs:stream.
The wlevs:property
tag is defined as the Spring propertyType
type; for additional details of this Spring data type, the definition of the allowed child tags, and so on, see the
Spring 2.0 XSD.
You can specify one of the following standard Spring tags as a child element of the wlevs:property
tag:
The following table lists the attributes of the wlevs:property
Spring tag.
The following example shows how to use the wlevs:property
tag in the EPN assembly file:
<wlevs:event-type type-name="ForeignExchangeEvent">
<wlevs:metadata>
<entry key="symbol" value="java.lang.String"/>
<entry key="price" value="java.lang.Double"/>
</wlevs:metadata><wlevs:property name="builderFactory">
</wlevs:event-type>
<bean id="builderFactory"
class="com.bea.wlevs.example.fx.ForeignExchangeBuilderFactory"/>
</wlevs:property>
In the example, the wlevs:property
tag defines a custom property of the ForeignExchangeEvent
called builderFactory
. The property uses the standard Spring bean
tag to specify the Spring bean used as a factory to create ForeignExchangeEvents
.
Specifies an event source for this stream, or in other words, the component which this stream is coming from. Specifying an event source is equivalent to specifying this stream as an event listener to another component.
You can also nest the definition of a component within a particular wlevs:source
component to specify the component source.
WARNING: | Nested definitions are not eligible for dynamic configuration or monitoring. |
This tag is only a child of wlevs:stream.
The following table lists the attributes of the wlevs:source
Spring tag.
The following example shows how to use the wlevs:source
tag in the EPN assembly file:
<wlevs:stream id="helloworldInstream">
<wlevs:listener ref="helloworldProcessor"/><wlevs:source ref="helloworldAdapter"/>
</wlevs:stream>
In the example, the component with id
helloworldAdapter
is the source of the helloworldInstream
stream component.
Use this tag to declare a stream to the Spring application context.
The wlevs:stream
Spring tag supports the following child tags:
The following table lists the attributes of the wlevs:stream
Spring tag.
The following example shows how to use the wlevs:stream
tag in the EPN assembly file:
<wlevs:stream id="fxMarketAmerOut" />
The example shows how to declare a stream service with unique identifier fxMarketAmerOut
.