[rules-users] Multi-user architecture of Drools Web Service.

Mauricio Salatino salaboy at gmail.com
Fri Aug 20 10:46:51 EDT 2010


Yes it's clear. But you are hiding a stateful session behind a stateless
service. It's a common problem. You need to fix that.

2010/8/20 tom ska <tiberium.linux at gmail.com>

> Well, I will explain my architecture as well as I can:
>
> - I created "Dynamic Web Project" with Eclipse based on AXIS1.4.1
> - I also added Drools Runtime to a project
> - In class I have  KnowledgeBase kbase attribute
> - Each time I use fn_Conclude function, I create new
> StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession() and
> use fireAllRules method.
>
> I understand, that user who uses fn_Conclude will get his own results, but
> I don't get how using StatefulKnowledgeSession can I guarantee that user,
> who added his facts will get results only from facts he added. I see problem
> in connecting facts to user,but meybe that's not good point of view. Facts
> adding is done by ksession object (each user has his own), but I want to
> have this web service with states... Then user can add his own facts, than
> do something else, then process only his facts. Between adding and
> processing, I want other user to do this same. I want Web Service to wait
> for each user after adding by him some facts.
>
> I hope, it is clear for You (my english... :/ )
>
> regards,
> tom.
>
>
> 2010/8/20 Mauricio Salatino <salaboy at gmail.com>
>
> It depends on how are you exposing web services or the component behind
>> those web services..
>> If you use a Stateful Session Bean, this component will do all the work
>> for you. But if your services are stateless by nature, you need to implement
>> the mechanism. You can implement this mechanism in two ways: In messages
>> (adding a session id that goes and come back with the response) or in server
>> side with a client id.
>>
>>
>> 2010/8/20 tom ska <tiberium.linux at gmail.com>
>>
>>> Thanks Esteban. I thought it could be a solution too, but I am not
>>> experienced (and my knowledge is not big either) in solving such a problems.
>>>
>>> If I would do, like You said - am I to write all communication between
>>> web service and client too? In web programming with browser, I have cookies.
>>> In them, I could keep some session ID. But using SOAP, I have to write this
>>> mechanisms alone, yes? Can AXIS do it for me? Or some other tool?
>>>
>>> regards,
>>> tom.
>>>
>>>
>>> 2010/8/20 Esteban Aliverti <esteban.aliverti at gmail.com>
>>>
>>> A basic solution could be to have each user identified with an unique id.
>>>> Then, in the server side you could have different ksessions (and not kbases)
>>>> for each user.
>>>>
>>>> Best,
>>>>
>>>> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>>>>
>>>> Esteban Aliverti
>>>> - Developer @ http://www.plugtree.com
>>>> - Blog @ http://ilesteban.wordpress.com
>>>>
>>>>
>>>> 2010/8/20 tom ska <tiberium.linux at gmail.com>
>>>>
>>>>>  Hi,
>>>>> what I have is SOAP Web Service with two methods: fn_AddFacts, and
>>>>> fn_Conclude. I defined special XML implementation to send various fact's
>>>>> types via SOAP. Model is defined in DRL/Guvnor - and rules too.
>>>>>
>>>>> So now, I can add some facts (web service creates them using Drools
>>>>> "reflection" API) to knowledge base. And then use fn_Conclude method, to
>>>>> fire "fireAllRules" method and get response with results. But.....
>>>>>
>>>>> What if now I have 100 users, and I don't want their's facts to
>>>>> interfere each other? I want, to use Drools to conclude for different users.
>>>>> I want to use this same rules, but on different knowledge bases (each user
>>>>> has own knowledge base of his facts).
>>>>>
>>>>> Please help me, how to solve this problem... I am new in JAVA EE, and I
>>>>> don't understand some elementary issues well. (But I am trying to understand
>>>>> them :D )
>>>>>
>>>>> regards,
>>>>> tom.
>>>>>
>>>>> _______________________________________________
>>>>> rules-users mailing list
>>>>> rules-users at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>>
>> --
>>  - CTO @ http://www.plugtree.com
>>  - MyJourney @ http://salaboy.wordpress.com
>>  - Co-Founder @ http://www.jbug.com.ar
>>
>>  - Salatino "Salaboy" Mauricio -
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100820/e11e2608/attachment.html 


More information about the rules-users mailing list