I have just installed RedHat Decision Manager 7.3 and can deploy a decision service. So far, I have been using the /server/containers/instances/{containerId}
endpoint to call my service, where the payload lists commands to insert objects into working memory.
However, this is a stateful session, and I am trying to work out how you call a decision service using stateless sessions. The documentation is not at all clear on how to do this via the REST API, but has plenty of examples if you were using the Java API (unless I have missed something).
Does anyone have any examples on how to do this via REST?
Any help is gratefully received.
UPDATE First I meant version 7.3 not 7.4, but the documentation looks the same.
So it looks like I was not a million miles away, it looks like from the documentation supplied that I need to specify a session Id in a lookup
param, so my request will be something like this:
{
"lookup": "mysession",
"commands": [
{
"insert": {
"object": {
"com.indecision.baggage.Result": {}
},
"return-object": true,
"out-identifier": "results"
}
},
{
"insert": {
"object": {
"com.indecision.baggage.Booking": {
"fareClass": "First",
"baggageItems": [
{
"com.indecision.baggage.BaggageItem": {
"width": 100,
"height": 100,
"depth": 100,
"weight": 20
}
}
]
}
},
"return-object": true,
"out-identifier": "booking"
}
},
{
"insert": {
"object": {
"com.indecision.baggage.FlightInformation": {
"currentWeight": 100000,
"flightNumber": "IA001",
"maxOperatingWeight": 200000
}
},
"return-object": true,
"out-identifier": "flightInfo"
}
},
{
"fire-all-rules": {
"out-identifier": "firedActivations"
}
}
]
}
However when I send in the request, I get the following error message:
{
"type": "FAILURE",
"msg": "Error calling container Indecision-Airlines-Baggage-Fee-Calculator: Session 'mysession' not found on container 'Indecision-Airlines-Baggage-Fee-Calculator_1.0.0-SNAPSHOT'.",
"result": null
}
Now in RH Business Central under the server configurations you can specify a session Id for the decision service, but the Save button is always greyed out regardless of what I try. So my first question is any ideas as to why or how enable the setting of this config?
My second question is if session Id's have to be defined up front then really these services cannot be truly stateless across multiple requests? As I see it, they would need to up front specify what session Id they want to execute under, rather than new requests having a new session created for them by the KIE engine. Or have I got that wrong?
Again thanks in advance for any answers.