How to Create an Oracle CEP Event Type as a JavaBean Manually

Overview of Oracle CEP Events 2-11 } public Long getTimestamp { return timestamp; } public Long getLatencyTimestamp { return latencyTimestamp; } public Long getVolume { return volume; } } 2. Compile the JavaBean that represents your event type. 3. Register your JavaBean event type in the Oracle CEP event type repository: a. To register declaratively, edit the EPN assembly file using the wlevs:event-type-repository element wlevs:event-type child element as Example 2–6 shows. Example 2–6 EPN Assembly File event-type-repository wlevs:event-type-repository wlevs:event-type type-name=MarketEvent wlevs:class com.bea.wlevs.example.algotrading.event.MarketEvent wlevs:class wlevs:event-type wlevs:event-type-repository b. To register programatically, use the EventTypeRepository class as Example 2–7 shows. Example 2–7 Programmatically Registering an Event EventTypeRepository rep = getEventTypeRepository; rep.registerEventType MarketEvent, com.bea.wlevs.example.algotrading.event.MarketEvent.getClass ; For more information, see Section 2.7, Accessing the Event Type Repository . 4. Use the event type: ■ Reference the event types as standard JavaBeans in the Java code of the adapters and business logic POJO in your application. public void onEventList newEvents throws RejectEventException { for Object event : newEvents { MarketEvent marketEvent = MarketEvent event; System.out.printlnPrice: + marketEvent.getPrice; } } ■ Access the event types from Oracle CQL and EPL rules: The following Oracle CQL rule shows how you can reference the MarketEvent in a SELECT statement: 2-12 Oracle Complex Event Processing Developers Guide query id=helloworldRule [CDATA[ select MarketEvent.price from marketEventChannel [Now] ]] query

2.3 Creating an Oracle CEP Event Type as a Tuple

You can create and register an Oracle CEP event type as a tuple. When you design your event, you must restrict your design to the even data types that Section 2.1.3.3, Event Types Specified as a Tuple describes. This topic describes: ■ Section 2.3.1, How to Create an Oracle CEP Event Type as a Tuple Using the Event Type Repository Editor ■ Section 2.3.2, How to Create an Oracle CEP Event Type as a Tuple Manually

2.3.1 How to Create an Oracle CEP Event Type as a Tuple Using the Event Type Repository Editor

This procedure describes how to create and register an Oracle CEP event type as a tuple using the Oracle CEP IDE for Eclipse event type repository editor. For more information about the Oracle CEP IDE for Eclipse, see Example 3, Overview of the Oracle CEP IDE for Eclipse . Alternatively, you can create and register your event type as a tuple manually see Section 2.3.2, How to Create an Oracle CEP Event Type as a Tuple Manually . To create an Oracle CEP event type as a tuple using the event type repository editor: 1. Decide on the properties your event type requires. When you design your event, you must restrict your design to the even data types that Section 2.1.3.3, Event Types Specified as a Tuple describes. 2. Open the EPN in the Oracle CEP IDE for Eclipse. The EPN editor opens as Figure 2–4 shows. Overview of Oracle CEP Events 2-13 Figure 2–4 EPN Editor For more information, see Section 6.1, Opening the EPN Editor .

3. Click the Event Type tab.

The Event Type tab appears as Figure 2–5 shows. Figure 2–5 Event Type Repository Editor

4. Click Add Event Type green plus sign.

A new event is added to the Event Type Definitions list with default name newEvent as Figure 2–6 shows.