I understand that queries can be added/modified dynamically using JMX API, without bringing the CEP application down. But because a channel (relation or stream) has only a 1:1 mapping with a event type, any new query addition needs creation of a new channel and event-type. How can this be done dynamically - basically, dynamic creation of a EPM component.
Just to add to this - there is a related thread on this forum Re: Examples of programatic creation of EPN elements
It has the following statement "There is nothing stopping you writing an event bean that manages its own "channels" (written by you)"
How can I write a event bean that manages channels - I am taking that manages here means "creating" channels. Please let me know
No. You can't dynamically create new channels in the EPN, but you can dynamically assign the value of the "selector" of an existing channel via JMX. By doing this, you can control where the output of any new queries that you create will go (i.e. which existing channel).
To pre-create a channel, shouldn't we know what kind of events the channel will contain? One does not know the event-type of the query output beforehand and it may not map into existing event-types. Because of 1:1 mapping between channel and event, we cannot create any anticipatory channels before hand.
Please confirm as this is a crucial requirement for us.
You can't create channels dynamically within an application, however you can dynamically deploy new applications that provide new channels to a processor of another application.
For example, say you have a processor called helloworldProcessor in an application named helloworld.
You can deploy a new application that has the following EPN:
<wlevs:channel id="newHelloworldOutputChannel" event-type="HelloWorldEvent" advertise="true">
Hope this helps,
Thanks for the reply. Even if we can dynamically spin off a new channel in a new application, your explanation is assuming that the event-type is still known beforehand. What if my dynamic query does NOT output HelloWorldEvent but outputs data that is not known before hand? We need to think in terms of some generic data - something like a map of name, value pairs. How does CEP handle this use case? From the information I collected so far, it sounds like this is not supported.
I guess we need channels that can support a concept of a generic event type.
Not necessarily, the new event-type can be registered by the new application as well.
Further, you can build your own generic event-type by using com.bea.wlevs.ede.api.EventBuilder.
Hope this helps,
It does not need to be for every query, but only for those queries that output a different structure, which in all likelihood, would also mean you need a different Java class handling the event downstream anyway.
But, perhaps if it is the case that you have a generic Java sink, then the option to go for is indeed that of the EventBuilder route (i.e. generic event-type).
Hope this helps,
Can you please show me an example how you visualize configuring a generic event-type (using EventBuilder) to a new channel in the new application (for a new query with a new output)? The event builder API will basically return an event of type Object. (createEvent() in com.bea.wlevs.ede.api.EventBuilder )