1 2 Previous Next 16 Replies Latest reply: Jan 20, 2012 6:27 PM by 902696 RSS

    Can inherited events be used with only one processor?

    902696
      Hi friends!

      The question is quite simple: I have one parent event and several events which inherit from the first one. Every inherited event has its own properties and also the inherited properties (which have public visibility in the parent class so that the inheritance is automatic). I pass events to the CEP processor but it only works with the parent class and doesn't with the child ones. I mean, I'm using only one processor and only one CQL sentence.

      Is it neccesary to configure one processor for every inherited event?

      Thanks!
        • 1. Re: Can inherited events be used with only one processor?
          902696
          Hi again!

          I have also tried using two processors, but it doesn't work neither. I'm using the same adapter for all events and the interface InboundMessageConverter which implements "convert" method for processing messages from queues. It works if I return the parent class but doesn't if I return any of the childs using inheritance mechanism.

          What is happening?

          Thanks!
          • 2. Re: Can inherited events be used with only one processor?
            alexalves
            Hi,

            Can you include the EPN and the queries you are using?

            Thanks
            • 3. Re: Can inherited events be used with only one processor?
              902696
              Hi friend!

              Here you are:

              <?xml version="1.0" encoding="UTF-8"?>
              <beans xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:osgi="http://www.springframework.org/schema/osgi"
              xmlns:wlevs="http://www.bea.com/ns/wlevs/spring"
              xmlns:jdbc="http://www.oracle.com/ns/ocep/jdbc"
              xmlns:spatial="http://www.oracle.com/ns/ocep/spatial"
              xmlns:application="http://www.bea.com/ns/wlevs/config/application"
              xsi:schemaLocation="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/osgi
              http://www.springframework.org/schema/osgi/spring-osgi.xsd
              http://www.bea.com/ns/wlevs/spring
              http://www.bea.com/ns/wlevs/spring/spring-wlevs-v11_1_1_3.xsd
              http://www.oracle.com/ns/ocep/jdbc
              http://www.oracle.com/ns/ocep/jdbc/ocep-jdbc.xsd
              http://www.oracle.com/ns/ocep/spatial
              http://www.oracle.com/ns/ocep/spatial/ocep-spatial.xsd
              http://www.bea.com/ns/wlevs/config/application
              http://www.bea.com/ns/wlevs/config/application/wlevs_application_config.xsd">

                   <bean id="myConverter" class="com.bea.wlevs.adapter.example.mesevents.MeSEventsAdapter"/>
                   <wlevs:adapter id="jmsInbound" provider="jms-inbound">
                        <wlevs:listener ref="mesEventsChannel" />
                        <wlevs:listener ref="inputPetitionChannel" />
                        <wlevs:instance-property name="converterBean"
                             ref="myConverter" />
                   </wlevs:adapter>

              <wlevs:event-type-repository>
              <wlevs:event-type type-name="MeSEvent">
              <wlevs:class>com.bea.wlevs.event.example.mesevents.MeSEvent</wlevs:class>
              </wlevs:event-type>
              <wlevs:event-type type-name="InputPetition">
              <wlevs:class>com.bea.wlevs.event.example.mesevents.InputPetition</wlevs:class>
              </wlevs:event-type>
              </wlevs:event-type-repository>

              <wlevs:channel id="mesEventsChannel" event-type="MeSEvent" advertise="true">
              <wlevs:listener ref="mesEventsProcessor"/>
              </wlevs:channel>
              <wlevs:channel id="inputPetitionChannel" event-type="InputPetition" advertise="true">
              <wlevs:listener ref="mesEventsProcessor"/>
              </wlevs:channel>
              <!-- The default processor for OCEP 11.0.0.0 is CQL -->
              <wlevs:processor id="mesEventsProcessor" />

              <wlevs:channel id="mesEventsOutputChannel" event-type="MeSEvent" advertise="true">
              <wlevs:listener>
              <bean class="com.bea.wlevs.example.mesevents.MeSEventsBean"/>
              </wlevs:listener>
              <wlevs:source ref="mesEventsProcessor"/>
              </wlevs:channel>
              <wlevs:channel id="inputPetitionOutputChannel" event-type="InputPetition" advertise="true">
              <wlevs:listener>
              <bean class="com.bea.wlevs.example.mesevents.MeSEventsBean"/>
              </wlevs:listener>
              <wlevs:source ref="mesEventsProcessor"/>
              </wlevs:channel>
              </beans>

              It says the following:

              As you can see there are two input channels which are both connected to the JMS adapter as well as only one processor which is connected to the input channels and to the output channels. It is supposed that each event goes through each input and output channel but it fails and says the following:

              Channels mesEventsOutputChannel and inputPetitionOutputChannel from the same query must have the same event type.

              InputPetition is MeSEvent's child. It inherits all MeSEvent's preperties.

              Does anybody know what is happening?

              Thanks!
              • 4. Re: Can inherited events be used with only one processor?
                Junger He
                Hi,

                You have two issues from my understanding:
                1) it's not proper to use a single source to send events in multiple types.
                2) if you want to get a particular query's result, you need to use <selector/> for the channel's configuration.

                To fix the problem you currently have, you can add the following configuration at META-INF/wlevs/config.xml(or other file names)

                <channel>
                <name>mesEventOutputChannel</name>
                <selector>mesEventQuery</selector>
                </channel>

                <channel>
                <name>inputPetitionOutputChannel</name>
                <selector>inputPetitionEventQuery</selector>
                </channel>

                I suppose you defined two queries, mesEventQuery used mesEventChannel while inputPetitionEventQuery uses inputPetitionChannel
                • 5. Re: Can inherited events be used with only one processor?
                  902696
                  Thanks!

                  It has apparently worked. As you say, it appears to be not very proper to receive more than one event type from the same source so I guess I have to implement two queues (each one for each event), don't have?

                  I have also tried to run a JOIN between both events as follows but it doesn't work neither:

                  select m.mesMessage, m.origin, i.mesMessage from mesEventsChannel as m, inputPetitionChannel as i where m.mesMessage=i.mesMessage

                  The compiler says in my mother language something like a not linked flow is not allowed. What does it mean?

                  Thanks!
                  • 6. Re: Can inherited events be used with only one processor?
                    902696
                    I have achieved the compiler not to show any error with the JOIN sentence that follows, but it doesn't work (I think it's because no output channel is listening):

                    <query id="joinQuery">
                    <!-- RSTREAM (select m.mesMessage, m.origin, i.mesMessage from mesEventsChannel as m, inputPetitionChannel as i where m.mesMessage=i.mesMessage) -->
                    select m.mesMessage, m.origin, i.mesMessage from mesEventsChannel as m, inputPetitionChannel as i where m.mesMessage=i.mesMessage
                    </query>

                    I have set both streams as relations in the EPN configuration file setting the parameter is-relation to true.

                    Also, if I change channels' tags and include the query, the compiler shows an error. As I understand following the official CEP documentation, this query would insert both event types in both output channels when the condition is fulfilled.

                    The compiler does not show any error setting channels as follows:

                    <channel>
                         <name>mesEventsOutputChannel</name>
                         <selector>mesEventsQuery joinQuery</selector>
                    </channel>

                    <channel>
                         <name>inputPetitionOutputChannel</name>
                         <selector>inputPetitionEventQuery</selector>
                    </channel>

                    <channel>
                         <name>inputPetitionOutputChannel2</name>
                         <selector>inputPetitionEventQuery2</selector>
                    </channel>

                    In this way, the compiler shows an error which I write at the end:

                    <channel>
                         <name>mesEventsOutputChannel</name>
                         <selector>mesEventsQuery joinQuery</selector>
                    </channel>

                    <channel>
                         <name>inputPetitionOutputChannel</name>
                         <selector>inputPetitionEventQuery joinQuery</selector>
                    </channel>

                    <channel>
                         <name>inputPetitionOutputChannel2</name>
                         <selector>inputPetitionEventQuery2</selector>
                    </channel>

                    The stage "inputPetitionOutputChannel" is improperly connected to other EPN elements. This problem
                    will prevent queries for this processor configuration element from being validated. Channels
                    inputPetitionOutputChannel and mesEventsOutputChannel from the same query must have the same
                    event type

                    What happens?

                    Thanks!
                    • 7. Re: Can inherited events be used with only one processor?
                      902696
                      What I exactly mean is how to send both events types from a single join query to two different output channels. Shall I use "selector" tag? I have tried it but the compiler doesn't allow me to do it.

                      Thanks!
                      • 9. Re: Can inherited events be used with only one processor?
                        User757087-Oracle
                        If there is a single query, then there is only one set of attributes so you should be able to use the same event-type on both downstream channels. It looks like you want one to be set to the event-type of one channel to the parent and the other listening channel to be the event-type of the child. If your single join query, is outputting the values of the child you won't be able to use the parent event-type on the subsequent listening channel. You'll get a compiler error because there is no way to set one of the output attributes. You'll need to use a separate query that only outputs the attributes of the parent event-type. Also, you may not need to worry about having two queries. The server optimizes them to run together (within the same processor); they don't run sequentially separately.
                        • 10. Re: Can inherited events be used with only one processor?
                          902696
                          Thanks friend, but my question refereed to a general situation in which I have a JOIN query and I want to send each set of events of each event type to each output channel to be used in the bean. I'm not able to send each set of events to a different output channel because the compiler doesn't allow me to do it, neither only one set of events to one output channel (ignoring the others), because when I run the application on the server, the join query doesn't work.
                          • 11. Re: Can inherited events be used with only one processor?
                            alexalves
                            Hi,

                            Can you post the exact compiler error and the query that is not working?

                            Thanks
                            Alex
                            • 12. Re: Can inherited events be used with only one processor?
                              902696
                              Here you are:

                              In the congig.xml:

                              select i.mesMessage, o.mesMessage from inputPetitionChannel as i, outputPetitionChannel as o where i.mesMessage="InputPetition" and o.mesMessage="OutputPetition"

                              <channel>
                                   <name>joinChannelInputPetition</name>
                                   <selector>joinQuery</selector>
                              </channel>

                              In the context.xml:

                              <wlevs:channel id="joinChannelInputPetition" event-type="InputPetition" advertise="true">
                              <wlevs:listener>
                              <bean class="com.bea.wlevs.example.mesevents.MeSEventsBean"/>
                              </wlevs:listener>
                              <wlevs:source ref="mesEventsProcessor"/>
                              </wlevs:channel>

                              ----------------------

                              InputPetition events doesn't go through joinChannelInputPetition, why? And, how can I use OutputPetition events from this query?

                              Thanks!
                              • 13. Re: Can inherited events be used with only one processor?
                                902696
                                I have not achieved it yet. I'll ask it again simplier:

                                I need to execute a join CQL query between two input channles and send each event type through each output channel.

                                I also need to execute an avg CQL query and send the result (I guess a double) through another output channel. I need to know how to configure an output channel to send a double through it. I mean I need a double to be sent (instead of an event) through an output channel and I don't know how to configure it, I haven't seen how to do it in the official documentation.

                                Does anybody know how to do both?

                                Thanks!
                                • 14. Re: Can inherited events be used with only one processor?
                                  720657
                                  1) For your query , "select m.mesMessage, m.origin, i.mesMessage from mesEventsChannel as m, inputPetitionChannel as i where m.mesMessage=i.mesMessage"

                                  You are trying to JOIN 2 unbounded streams (mesEventsChannel , inputPetitionChannel ) which is not allowed. You will need to use a WINDOW over the each Stream for a meaningful JOIN

                                  2) "l. I need to know how to configure an output channel to send a double through it. I mean I need a double to be sent (instead of an event) through an output channel and I don't know how to configure "

                                  How about creating an event-type with exactly 1 double attribute
                                  1 2 Previous Next