Event Type Instantiation and Immutability

Overview of Oracle CEP Events 2-3 The Oracle CEP server uses the following procedure to instantiate an event for a Java class event type: ■ It acquires an instance of the com.bea.wlevs.ede.api.EventBuilder.Factory you associate with the event type by calling the factorys createBuilder method. ■ It instantiates an event by calling the createEvent method. Note that again, even though the event is conceptually immutable, setter methods must be available in this case. And, again, the Oracle CEP server will invoke these setter methods only once, indirectly, when the factory initializes the event.

2.1.2 Event Type and Serialization

In general, Oracle CEP events need not be serializable. However, if you are caching events in Oracle Coherence, then events must be serializable.

2.1.3 Event Type Data Types

When creating event types, observe the following data type restrictions: ■ Section 2.1.3.1, Event Types Specified as JavaBean or Java Class ■ Section 2.1.3.2, Event Types Specified as java.util.Map ■ Section 2.1.3.3, Event Types Specified as a Tuple ■ Section 2.1.3.4, Event Types for use With a Database Table Source ■ Section 2.1.3.5, Event Types for use With the csvgen Adapter For more information, see: ■ Datatypes in the Oracle Complex Event Processing CQL Language Reference ■ Overview of the EPL Language in the Oracle Complex Event Processing EPL Language Reference

2.1.3.1 Event Types Specified as JavaBean or Java Class

When you define an event type as a JavaBean or Java class, you may use any Java type for its properties. Using the Oracle Java data cartridge, you may also combine JavaBean or Java class event types with other events types. Example 2–1 shows a tuple event type Student that defines its address property as Java class event type Address. Example 2–1 Event Type Repository event-type-repository event-type name=Student property name=name type=char property name=address type=Address event-type event-type name=Address class-nametest.Addressclass-name event-type event-type-repository For more information, see 2-4 Oracle Complex Event Processing Developers Guide ■ Section 2.2, Creating an Oracle CEP Event Type as a JavaBean ■ Section 2.4.1, How to Create an Oracle CEP Event Type as a Java Class Manually ■ Section 2.8, Sharing Event Types Between Application Bundles ■ Oracle Java Data Cartridge in the Oracle Complex Event Processing CQL Language Reference

2.1.3.2 Event Types Specified as java.util.Map

When you specify the properties of the event type declaratively in the EPN assembly file as a java.util.Map, you may use any Java type for its properties. However, you specify the event type as either: ■ The fully qualified name of a Java class that must conform to the same rules as Class.forName and must be available in the applications class-loader. ■ A Java primitive for example, int or float. You may specify an array by appending the characters [] to the event type name. Example 2–2 shows how to use these types: Example 2–2 Specifying Java Data Types for java.util.Map Event Type Properties wlevs:event-type-repository wlevs:event-type type-name=AnotherEvent wlevs:property entry key=name value=java.lang.String entry key=employeeId value=java.lang.Integer[] entry key=salary value=float entry key=projectIds value=short[] wlevs:property wlevs:event-type wlevs:event-type-repository For more information, see Section 2.5.1, How to Create an Oracle CEP Event Type as a java.util.Map .

2.1.3.3 Event Types Specified as a Tuple

When you specify the properties of the event type declaratively in the EPN assembly file as a tuple, you may use any CQL primitive types or Java types. Example 2–3 shows the use of different types: Example 2–3 Specifying com.bea.welvs.ede.api.Type Data Types for Tuple Event Type Properties wlevs:event-type-repository wlevs:event-type type-name=SimpleEvent wlevs:properties wlevs:property name=id type=char length=1000 wlevs:property name=msg type=char wlevs:property name=count type=double wlevs:property name=time_stamp type=timestamp wlevs:properties wlevs:event-type ... wlevs:event-type-repository For more information, see Section 2.3, Creating an Oracle CEP Event Type as a Tuple .