Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-2029

Able to use a custom DataStream in declared RuleUnitData

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 0.10.0
    • Core Engine
    • None
    • 3
    • 2020 Week 16-18 (from Apr 13), 2020 Week 19-21 (from May 4), 2020 Week 22-24 (from May 25)

      If you try to use a custom DataStream in declared RuleUnitData,

      declare AlertingService extends RuleUnitData
         eventData: DataStream<Event>
         alertData: MyDataStream<Alert>
      end
      

      It throws an Exception during build due to generated DTO code.

      2020-04-29 15:43:36,258 ERROR [io.qua.dep.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
      	[error]: Build step org.kie.kogito.quarkus.deployment.KogitoAssetsProcessor#generateModel threw an exception: java.lang.IllegalStateException: src/main/java/org/example/alerts/AlertingServiceDTO.java (15:31) : incompatible types: org.kie.kogito.rules.DataStream<org.example.alerts.Alert> cannot be converted to org.example.alerts.MyDataStream<org.example.alerts.Alert>
      src/main/java/org/example/alerts/AlertingServiceDTO.java (15:31) : incompatible types: org.kie.kogito.rules.DataStream<org.example.alerts.Alert> cannot be converted to org.example.alerts.MyDataStream<org.example.alerts.Alert>
      	at org.kie.kogito.quarkus.deployment.KogitoAssetsProcessor.register(KogitoAssetsProcessor.java:314)
      	at org.kie.kogito.quarkus.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:197)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:931)
      	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:479)
      

      The DTO doesn't use the custom DataStream.

      public class AlertingServiceDTO implements java.util.function.Supplier<AlertingService> {
      
          @Override()
          public AlertingService get() {
              AlertingService unit = new AlertingService();
              {
                  org.kie.kogito.rules.DataStream<org.example.alerts.Event> eventData = org.kie.kogito.rules.DataSource.createStream();
                  unit.setEventData(eventData);
                  this.eventData.forEach(unit.getEventData()::append);
              }
              {
                  org.kie.kogito.rules.DataStream<org.example.alerts.Alert> alertData = org.kie.kogito.rules.DataSource.createStream();
                  unit.setAlertData(alertData);
                  this.alertData.forEach(unit.getAlertData()::append);
              }
              return unit;
          }
          ...
      

      The same applies to a custom DataStore.

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Marian Macik Marian Macik
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: