Drools - Values in result of `from` caluse: are they facts? why Drools try to marshal them?

18 views
Skip to first unread message

Reza Same'ei

unread,
Jul 30, 2019, 7:49:20 AM7/30/19
to Drools Development

I'm implementing a software using Drools and Saxon; In the LHS I use load a xml-dom (via `from` clause) 
and run some queries on it (using XPath); then I use that xml-dom in in RHS to generate a fact!

```
global XmlService xml;

rule "look for oid"
when
uri : String()
doc : Doc(
hasValue("/Tag/@OID")
) from xml.load(uri)
then
insert(new Id(doc.getValue("/Tag/@OID")));
end
```

When I insert a `String` (as `uri`) I see this line in logs:
```
15:55:57.540 INFO  org.drools.core.event.DebugAgendaEventListener - ==>[BeforeActivationFiredEvent:  getActivation()=[[ ... ] [ [fact 0:39:1623992162:1623992162:39:DEFAULT:NON_TRAIT:com.example.Doc:com.example.Doc@60cc2762]
```

Also when I'm trying to marshalize my session I see that Drools is trying to serialize them and because it's not `Serializable`, it fails.
I'll add this fact that when I try to retrieve facts from `KieSession` it don't return those values, it only returns `Id`s. but Drools also
prevent GC from removing those values from heap!

Is this behaviour normal? Is my understanding correct? How I can change it?

Drools/Kie version : 7.24.Final
Reply all
Reply to author
Forward
0 new messages