I'm getting a little stuck around how to get some extra fact data from a bean service implementation, across into a rules implementation and i'm hoping you guys can help clarify where the documentation fails to make it clear.
I've got a fairly basic switchyard project, which has a SOAP binding promoted, interfaced to a CDI bean service, with a Smooks transformer to take the XML to java (need to do custom stuff JAXB can't do)
this CDI bean does some basic database lookups for reference data and stores them in a container managed infinispan L2 cache.
All fairly normal so far (and if i leave it at this, it all works, and i can take data from the input, populate a response and get the data back out).
the next part of what i'm trying to do is to incorporate a Rules service, in the same composite, called as an @Reference from the CDI bean service impl.
The problem i have is that i want to pass in the transformed java version of the message (simple, done for me), one or more of the lists/maps of reference data as extra facts, and a List<String> as a global which i'll use to hold error codes returned by the rules.
I've created an interface with a
void runRules(MyMainDataObject mmdo)
type signature, created a rules file, sorted my imports etc.
Then I run into problem 1. according to the docs I can find, i can only pass 1 parameter into a rules service, so how do i get my extra lists etc of facts into my rule?
problem 2 is that i have
which gives me in my CDI bean the switchyard context, and I add a property to it called 'errors' with my errors list as a value (I've tried scoping it alternately as MESSAGE and EXCHANGE just in case), and then in the switchyard properties for the rules, i try to add a 'global' with my from as context['errors'] and my to mapped as per the name of my drools global, but i get an NPE from deep in the code, and it looks like, what i've put onto the context, hasn't actually carried through from my CDI bean to the part of switchyard that starts to set up the drools facts.
So basically i want to
pass multiple different facts to a drool
have a global list that i can populate from my drool, that i can then pick up on from my CDI bean so that i can carry on.
can anyone recommend how this can be achieved? thanks in advance