开发者

Continuation of a process after a system crash/restart - Drools Flow

开发者 https://www.devze.com 2023-02-12 04:41 出处:网络
I\'ve been playing with examples I downloaded with the book Drools JBoss Rules 5.0.To my relief they work :)Drools Flow has been my point of interest as a possible workflow engine replacement.

I've been playing with examples I downloaded with the book Drools JBoss Rules 5.0. To my relief they work :) Drools Flow has been my point of interest as a possible workflow engine replacement.

As I'm trying to wrap my head around things, I've been wondering how a premature death of a rulesflow process gets restarted? What I'm mean is say a process is bouncing from one node to another like expected, then the containing process dies due to a crash, restart or whatever. Is the current node/place of the ruleflow process retained, and can it just continu开发者_开发知识库e from that point on system restart? If so how?

The group I work for is very Java EE centric with JBoss being our favorite application server. I see examples of Drools leveraging Spring's persistence and bean lookup support.

Are there examples of doing the same with JBoss?


If you persist the state of the process instances and tasks in the database. Even if the VM was down and restart again, you can retrieve the process instances.

Use the

To create the session

ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase,null,env)

To load the session with the session id.

ksession = JPAKnowledgeService.loadStatefulKnowledgeSession( sessionId, kbase,

You only need to know the session id. Session information will be store in SessionInfo table. Download the example project below.

http://dl.dropbox.com/u/2634115/drools-test.zip

The example is using Btm with H2 database, it also work well with mysql-connector-java-5.1.13 with Btm. Note that the process that are complete will be automatically deleted from the database.


You are looking at the basic concept of Process Migration. During what is known as strong migration, a process can be stopped on one machine and the entire state of the process migrated to another machine (including the program counter and all existing stacks). Before you go thinking that this is completely insane, think about this from a JVM perspective. Since you're application is already being run in virtual hardware; it isn't hard to stop the application and pick it back up where it left off since it is completely virtualized.

If you would like another example, look at VMWare; an entire machine can be paused and migrated to another machine and started again. It's very interesting stuff and usually relates mainly to Distributed Computing where you might have hundreds of agents that need to migrate from machine to machine as some go down for maintenance.

I realize that I didn't give an example of this through JBoss; but giving a background on what exactly you're looking for can give you a much better insight into what to look for going forward.

0

精彩评论

暂无评论...
验证码 换一张
取 消