WebLogic Event Server Reference

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

WebLogic Event Server Spring Tag Reference

This section contains information on the following subjects:

 


Overview of the WebLogic Event Server Spring Tags

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.

Graphical Representation

The following graphic describes the hierarchy of the WebLogic Event Server Spring tags.

Figure 2-1 Hierarchy of WebLogic Event Server Spring Tags

Hierarchy of WebLogic Event Server Spring Tags

Example of an EPN Assembly File That Uses WebLogic Event Server 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>

 


wlevs:adapter

Use this tag to declare an adapter service to the Spring application context.

Child Tags

The wlevs:adapter Spring tag supports the following child tags:

Attributes

The following table lists the attributes of the wlevs:adapter Spring tag.

Table 2-1 Attributes of the wlevs:adapter Spring Tag
Attribute
Description
Data Type
Required?
id
Unique identifier for this component.
String
Yes.
advertise
Advertises this service in the OSGi registry.
Valid values are true and false. Default value is false.
Boolean
No.
depends-on
The name of the Spring beans that the underlying Spring bean that implements this componet depends on. Use this attribute to enforce the correct initialization order of beans in your application. If you do not require any specific initialization order, then do not specify this attribute.
If using, set this attribute to the value of the id attribute of the dependent Spring bean.
String
No.
lazy-init
Specifies whether WeblogicEvent Server should lazily initialize the underlying Spring bean that implements this component.
If set to false, the bean will be instantiated on startup by bean factories that perform eager initialization of singletons.
Valid values for this attribute are true and false. The default value is false.
Boolean.
No.
listeners
Specifies the components that listen to this component.
Set this attribute to the value of the id attribute of the element that declared the component.
String
No.
provider
Specifies the adapter service provider. Typically the value of this attribute is a reference to the OSGi-registered adapter factory service.
If you are using the csvgen or loadgen utilities to simulate a data feed, use the hard-coded csvgen or loadgen values, respectively, such as:

provider="csvgen"

String
Yes
manageable
Specifies that this component can be monitored using the WebLogic Event Server monitoring framework.
Setting this attribute to true may adversely impact the performance of your application, so change the default setting of this attribute only if you are sure you want monitoring information about this component.
Valid values for this attribute are true and false. The default value is false.
Boolean
No.

Example

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.

 


wlevs:class

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

Example

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.

 


wlevs:event-type-repository

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.

Child Tags

The wlevs:event-type-repository Spring tag supports the following child tag:

Example

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.

 


wlevs:event-type

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.

Child Tags

The wlevs:event-type Spring tag supports the following child tags:

Attributes

The following table lists the attributes of the wlevs:event-type Spring tag.

Table 2-2 Attributes of the wlevs:link Spring Tag
Attribute
Description
Data Type
Required?
id
Specifies the unique identifier for this event type.
If you do not specify this attribute, WebLogic Event Server automatically generates an identifier for you.
q
No.
type-name
Specifies the name of of this event type.
This is the name you use whenever you reference the event type in the adapter, business POJO, or EPL rules.
String
Yes.

Example

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:class>com.bea.wlevs.event.example.helloworld.HelloWorldEvent</wlevs:class>
</wlevs:event-type>
</wlevs:event-type-repository>

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.

 


wlevs:instance-property

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.

Child Tags

You can specify one of the following standard Spring tags as a child tag of the wlevs:instance-property tag:

Attributes

The following table lists the attributes of the wlevs:instance-property Spring tag.

Table 2-3 Attributes of the wlevs:instance-property Spring Tag
Attribute
Description
Data Type
Required?
name
Specifies the name of the property, following JavaBean naming conventions.
String
Yes.
ref
A short-cut alternative to a nested <ref bean='...'/> element.
String
No.
value
A short-cut alternative to a nested <value>...</value> element.
String
No.

Example

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:.

 


wlevs:listener

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.

Attributes

The following table lists the attributes of the wlevs:listener Spring tag.

Table 2-4 Attributes of the wlevs:listener Spring Tag
Attribute
Description
Data Type
Required?
ref
Specifies the component that listens to the parent component .
Set this attribute to the value of the id attribute of the listener component.
You do not specify this attribute if you are nesting listeners.
String
No.

Example

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.

 


wlevs:metadata

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.

Child Tags

The wlevs:metadata tag can have one or more standard Spring entry child tags.

Attributes

The following table lists the attributes of the wlevs:metadata Spring tag.

Table 2-5 Attributes of the wlevs:metadata Spring Tag
Attribute
Description
Data Type
Required?
key-type
The default fully qualified classname of a Java data type for nested entry tags.
You use this attribute only if you have nested entry tags.
String
No.

Example

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.

 


wlevs:processor

Use this tag to declare a processor to the Spring application context.

Child Tags

The wlevs:processor Spring tag supports the following child tags:

Attributes

The following table lists the attributes of the wlevs:processor Spring tag.

Table 2-6 Attributes of the wlevs:processor Spring Tag
Attribute
Description
Data Type
Required?
id
Unique identifier for this component.
This identifier also corresponds to the <name> element in the XML configuration file for this processor; this is how WebLogic Event Server knows which EPL rules to execute for which processor component in your network.
String
Yes.
advertise
Advertises this service in the OSGi registry.
Valid values are true and false. Default value is false.
Boolean
No.
depends-on
The name of the Spring beans that the underlying Spring bean that implements this componet depends on. Use this attribute to enforce the correct initialization order of beans in your application. If you do not require any specific initialization order, then do not specify this attribute.
If using, set this attribute to the value of the id attribute of the dependent Spring bean.
String
No.
lazy-init
Specifies whether WeblogicEvent Server should lazily initialize the underlying Spring bean that implements this component.
If set to false, the bean will be instantiated on startup by bean factories that perform eager initialization of singletons.
Valid values for this attribute are true and false. The default value is false.
Boolean.
No.
listeners
Specifies the components that listen to this component.
Set this attribute to the value of the id attribute of the element that declared the component.
String
No.
provider
Specifies the language provider of the processor, such as the Event Processor Language (EPL).
Valid values are:
  • epl
The default value is epl.
String
No.
queryURL
Specifies a URL that points to an EPL rules definition file for this processor.
String.
No.
manageable
Specifies that this component can be monitored using the WebLogic Event Server monitoring framework.
Setting this attribute to true may adversely impact the performance of your application, so change the default setting of this attribute only if you are sure you want monitoring information about this component.
Valid values for this attribute are true and false. The default value is false.
Boolean
No.

Example

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.

 


wlevs:property

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.

Child Tags

You can specify one of the following standard Spring tags as a child element of the wlevs:property tag:

Attributes

The following table lists the attributes of the wlevs:property Spring tag.

Table 2-7 Attributes of the wlevs:property Spring Tag
Attribute
Description
Data Type
Required?
name
Specifies the name of the property, following JavaBean naming conventions.
String
Yes.
ref
A short-cut alternative to a nested <ref bean='...'/> element.
String
No.
value
A short-cut alternative to a nested <value>...</value> element.
String
No.

Example

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">
<bean id="builderFactory"
class="com.bea.wlevs.example.fx.ForeignExchangeBuilderFactory"/>
</wlevs:property>
</wlevs:event-type>

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.

 


wlevs:source

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.

Attributes

The following table lists the attributes of the wlevs:source Spring tag.

Table 2-8 Attributes of the wlevs:source Spring Tag
Attribute
Description
Data Type
Required?
ref
Specifies the source of the stream to which this tag is a child.
Set this attribute to the value of the id attribute of the source component.
You do not specify this attribute if you are nesting sources.
String
No.

Example

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.

 


wlevs:stream

Use this tag to declare a stream to the Spring application context.

Child Tags

The wlevs:stream Spring tag supports the following child tags:

Attributes

The following table lists the attributes of the wlevs:stream Spring tag.

Table 2-9 Attributes of the wlevs:stream Spring Tag
Attribute
Description
Data Type
Required?
id
Unique identifier for this component.
String
Yes.
advertise
Advertises this service in the OSGi registry.
Valid values are true and false. Default value is false.
Boolean
No.
depends-on
The name of the Spring beans that the underlying Spring bean that implements this componet depends on. Use this attribute to enforce the correct initialization order of beans in your application. If you do not require any specific initialization order, then do not specify this attribute.
If using, set this attribute to the value of the id attribute of the dependent Spring bean.
String
No.
lazy-init
Specifies whether WeblogicEvent Server should lazily initialize the underlying Spring bean that implements this component.
If set to false, the bean will be instantiated on startup by bean factories that perform eager initialization of singletons.
Valid values for this attribute are true and false. The default value is false.
Boolean.
No.
listeners
Specifies the components that listen to this component. Separate multiple components using commas.
Set this attribute to the value of the id attribute of the tag (wlevs:adapter, wlevs:stream, or wlevs:processor) that defines the listening component.
String
No.
provider
Specifies the streaming provider.
Valid values are:
  • defaultstream
Default value is defaultstream, which is the out-of-the-box streaming provider.
String
No.
manageable
Specifies that this component can be monitored using the WebLogic Event Server monitoring framework.
Setting this attribute to true may adversely impact the performance of your application, so change the default setting of this attribute only if you are sure you want monitoring information about this component.
Valid values for this attribute are true and false. The default value is false..
Boolean
No.
max-size
Specifies the maximum size of this stream.
Zero-size streams synchronously pass-through events. Streams with non-zero size process events asynchronously, buffering events by the requested size.
The default value for this attribute is 1024.
integer
No.
max-threads
Specifies the maximum number of threads that will be used to process events for this stream.
If the max-size attribute is 0, then setting a value for max-threads has no effect.
The default value for this attribute is 1.
integer
No.
source
Specifies the component from which the stream sources events.
Set this attribute to the value of the id attribute of the tag (wlevs:adapter, wlevs:stream, or wlevs:processor) that defines the source component.
String
No.

Example

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.


  Back to Top       Previous  Next