Top
Interstage Big Data Complex Event Processing Server V1.0.0 User's Guide
Interstage

5.4.6 Designing XTP Collaboration

This section explains considerations when performing XTP collaboration, as well as how to use it, as follows:

5.4.6.1 Considerations when Using XTP Collaboration

This section explains the items to consider when using XTP collaboration for referencing external data in complex event processing, as follows:

5.4.6.2 Using an XTP Cache

This section explains how to create a Virtual Data Window and how to use the created Virtual Data Window.

Creating a Virtual Data Window

Create a Virtual Data Window (hereafter, referred to as a "VDW") within complex event processing rules in order to reference an XTP cache from the rules.

Specifically, describe this as follows:

Syntax: If an event type ID is used

@VDW(cacheName="cacheName", keyProperty="keyPropertyName")
create window windowName.isxtp:vdw() as eventTypeID;

Syntax: If type information is specified directly

@VDW(cacheName="cacheName", keyProperty="keyPropertyName")
create window
windowName.isxtp:vdw() as (propertyName type, propertyName type, ...);

Example

Description example for creating a Virtual Data Window (VDW)

This is an example of creating a VDW (MarketWindow) to reference an XTP cache (MARKET).

@VDW(cacheName="MARKET", keyProperty="code")
create window MarketWindow.isxtp:vdw
() as (code string, high int, low int);
  • "code" is specified as a key property.

  • "code (string type)", "high (int type)", and "low (int type)" are defined as the properties.

Using a Virtual Data Window

Use a created Virtual Data Window in the same way as an ordinary window.

Example

Example of using a created Virtual Data Window (VDW)

This is an example of referencing a VDW (MarketWindow) in an event (TickerWindow) to obtain the data of the VDW events (cache entries) that meet the condition.

select M.code from MarketWindow as M, TickerWindow as T
where M.code = T.code and
( T.price > M.high or T.price < M.low);

Note

Notes on using a Virtual Data Window

The restrictions below apply to a WHERE clause that can be used when accessing the information stored in a Virtual Data Window.

These restrictions apply when records are to be identified from a cache.

If the records have already been identified, the rules can be described in the usual way and the following restrictions will not apply:

  • Only key properties specified using the "@VDW" annotation can be specified to identify records.

  • Only the "=" comparison operator can be used for key properties that can be specified to identify records.

Description example

After identifying records using "M.code = T.code", compare other items.

@VDW(cacheName="MARKET", keyProperty="code") 
create window MarketWindow.isxtp:vdw
() as (code string, high int, low int);

sele
ct M.code from MarketWindow as M, TicketWindow as T
where M.code =
T.code and (T.price > M.high or T.price < M.low)

The table below shows valid and invalid description examples for the cache above.

No.

Description example

Valid?

Explanation

1

select * from MarketWindow where code = '1111'

Yes

This is acceptable because the "=" operation is used for a key property.

2

select * from MarketWindow where high = 1000

No

This is unacceptable because a WHERE clause is specified for other than a key property.

3

select * from MarketWindow where code > '1111'

No

This is unacceptable because a WHERE clause is only specified for a key property but is performing an operation other than "=".