问题
I want to build a CEP-Engine which is dynamic so you can add different event streams. As soon as a new stream is added, Esper should be able to read all the properties of the stream and put it into a list, for example. (For example integer id, long temperature, date timestamp etc.) Is this possible in Esper?
Would be very grateful for any help
回答1:
In order to add a stream at runtime you can use create-schema.
create schema MyStream(id int, ...)
For a stream that accepts events that an application sends using EPEventServive#sendEvent you should add the bus and public annotation (or set the equivalent compiler flags).
@public @buseventtype create schema MyStream(id int, ...)
You can now use this stream.
select * from MyStream
You can attach a listener and have it do some logic. The Esper examples have a lot of detail. The create-schema is used in the "runtimeconfig" example.
回答2:
Thank you for answering. I'm afraid I didn't make myself clear. I want to be able to add event streams where I don't know beforehand what kind of properties the events have. So I don't know before if there is an integer ID or if there is a date timestamp and which payload might be there. As soon as I add such an unknown event, Esper should examine the stream and return the contained properties of the stream to me.
来源:https://stackoverflow.com/questions/65076816/add-sensorevents-to-cep-engine-and-get-a-list-of-all-properties