[rules-dev] Drools Flow in EJBs

tizo tizone at gmail.com
Mon Nov 8 12:24:18 EST 2010


On Mon, Nov 1, 2010 at 7:06 PM, Mark Proctor <mproctor at codehaus.org> wrote:

>  On 01/11/2010 19:05, tizo wrote:
>
>
>
> On Mon, Nov 1, 2010 at 4:21 PM, Mark Proctor <mproctor at codehaus.org>wrote:
>
>>  On 01/11/2010 15:31, tizo wrote:
>>
>>   On Wed, Oct 27, 2010 at 5:21 PM, tizo <tizone at gmail.com> wrote:
>>
>>> Hi there,
>>>
>>> I have seen in chapter 6 of the documentation, that Drools Flow can be
>>> configured to use JPA and transactions to persist the running states.
>>> However, I am in a EJB where I obtain entity managers with a
>>> @PersistenceContext annotation, and the transactions are managed by the
>>> container, whereas in the example an EntityManagerFactory and a
>>> TransactionManager are used.
>>>
>>> Could I configure Flow in a direct way to be used by my EJB?
>>>
>>> Thanks very much,
>>>
>>> tizo
>>>
>>>
>>  Ok, looking at the code, I guess that Drools flow is not ready to work
>> with standards EJBs. The reasons are the following:
>>
>>  * The JPA annotations are not standard JPA annotations, but hibernate
>> ones. For example "CollectionOfElements" in ProcessInstanceInfo class.
>>
>>  That was the one element we couldn't find a replacement for in JPA1, JPA2
>> fixes this, but we haven't updated to JPA2 yet. I don't believe we use any
>> other hibernate specific annotations.
>>
>>   * Transactions are managed by Drools, as opposed to some EJBs where
>> transactions are managed by the container.
>>
>>  You can use both JTA transactions and local entity transactions. So
>> transactions can be drools maintained or container/external maintained.
>>
>>
>> As for that, I will probably modify the codes, so Flow could be used in
>> our EJBs. I would like to know if someone could guide me on what should I
>> modify.
>>
>> I will post the modifications in case they are of interest to someone.
>>
>> Thanks very much,
>>
>> tizo
>>
>>    Mark,
>
> Thanks for your response. Could you tell me how can I use Drools with my
> container managed transactions, or where can I read how to do that?. I think
> that the example given in the documentation (Drools Flow, 6.1.4 -
> Transactions) does not apply to this case, and I can't figure out how to do
> it.
>
> Shows configuring a JTA transaction here:
>
> http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/javadocs/stable/drools-api/org/drools/persistence/jpa/JPAKnowledgeService.html
>
>
Ok, that works, but BMT (bean managed transactions) is used, instead of CMT
(container managed transactions).

In any way, that is not a big deal at this moment, because I am stuck trying
to imagine how a stateless session bean could start a flow process, persist
its state when a human task is reached (using WS-HumanTask or not), and be
reloaded at another time, when the human task is really done.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20101108/5dabc1d9/attachment.html 


More information about the rules-dev mailing list