com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Event Tables

Event tables can contain whole events or parts of events coming from one or more streams. An event table need to have a unique identifier and a single event table can be shared across multiple queries using the identifier. Similar to windows, aggregation functions can also be applied to the events contained in event tables.

When writing queries with event tables, both in-memory and relational database tables can be treated in the same way.


Inserting events to a table

When inserting events to a table, it can be treated similar to an output event stream.

define table foo (name string, age int);

from inputStream
select name, age
insert into foo;

All events coming from the inputStream get added to the foo event table without considering uniqueness.

In some cases, there is a need to insert an event to the table only if an event with the same id doesn't already exist in the table. It can be done as follows:

from inputStream[not ((name == foo.name ) in foo)]
select name, age
insert into foo;


Deleting events from a table

Following query deletes events in the table 'foo' triggered using the events coming from 'inputStream'. Once an event arrives from the inputStream, all event in event table with the same name gets deleted.

from inputStream
delete foo
on inputStream.name == foo.name;


Updating events in a table

This can be used when an existing event residing inside the table needs to be updated with latest data.

from inputStream
update foo
on inputStream.name == foo.name;


Querying event tables

When writing queries involving an event table, it has to be joined with an input stream (using a window) as follows.

from inputStream#window.length(1) join foo
on inputStream.name == foo.name
select inputStream.name, foo.age
insert into outStream;

Aggregate functions can also be used for event tables as follows:

from inputStream#window.length(1) join orderTable
on inputStream.name == orderTable .name
select sum( orderTable .price) as totalPrice
insert into outStream;

When joining with a window, the query gets triggered by 2 types of events - i.e. current events and expired events. Current events are the incoming events that come through the input stream towards the window. Expired events are the ones which are emitted by the window (e.g. events emitted after 1 minute in a 1-minute time window). By default when the user doesn't specify an event type, current events are chosen. You can choose which type of events to be used to trigger the query as follows (note that all-events refer to both current and expired events):

from inputStream#window.length(1) join foo
on inputStream.name == foo.name
select inputStream.name, foo.age
insert into outStream for current-events;

from inputStream#window.length(1) join foo
on inputStream.name == foo.name
select inputStream.name, foo.age
insert into outStream for all-events;



Note

When joining an event table with a window, once window emits an event (or a new event arrives towards the window), it is matched against the event table's events (based on given conditions) and can result in multiple events when the condition is satisfied. In such a scenario, all the resulting events will get added to the output stream.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.