[jBPM Users] - Re: How to use timers?
by mauromol
Thank you Martin, you actually helped me and I got it to work!!
I'm going to summarize it up because I think that certain things are not so intuitive for a "jBPM scheduler"-newbie like me.
First of all, the default implementation of the scheduler service, provided by jBPM, is DbSchedulerServiceFactory, which uses the database to store information about scheduled actions associated with timers. This means that a database is needed even to write a simple JUnit test case that uses timers and this justifies the need to deploy your process definition (it's needed to store the related timers and timer jobs in the database, as well). I would assume that a different scheduler service implementation could be made to avoid the use of a database, however let's talk about the default implementation.
Even if a database is needed, there's no need to extend AbstractDbTestCase, which provides many methods to create and clean the schema and to interact with the database. In fact, in the simplest case, jBPM (thanks to Hibernate) will create automatically an in-memory database for you when you go to deploy your process definition and/or schedule a timer action. In this case, however, you should take care of the db lifecycle, however I think (but I may be wrong) that if you destory the jbpmConfiguration (by calling close) the in-memory db will be destroyed too...
Anyway, in my case I was running an only test method, so it's not so important how the db is handled between multiple test methods invocations.
In my previous example (TRIAL 2) timer actions were correctly saved in the database by the DbSchedulerServiceFactory, but they were not executed because no JobExecutor thread was started. The JobExecutor thread is actually a thread that periodically reads from the database, searching for saved timer actions (jobs) and executes them.
So, if I change my test case by calling jbpmConfiguration.startJobExecutor() just after the configuration creation, I make sure that the "scheduler" is started. Actually, I would rather say that there is no scheduler to start, but that the default scheduler service implementation expects that a JobExecutor thread is present to execute timer actions. In other words, the JobExecutor is itself part of the default scheduler service implementation. I think that this only sentence would be enough to say that my original problem is not so stupid as kukeltje says and that the documentation could be drastically improved on this subject (I'm also wondering what is http://docs.jboss.com/jbpm/v3.2/userguide/html_single/#schedulerdeployment all about!?).
Anyway, this is not enough, because another action is needed in order to make the JobExecutor run timer actions in my test case: just after the signal invocation, that moves my process instance to the waiting state (with attached timer), I have to close the jBPM context in order to commit things (the deployed process definition, the process instance state and the related saved timers and jobs), otherwise the JobExecutor, which works on another thread, wouldn't find anything to executoe. Having the whole scenario cleared, this sounds reasonable and obvious, but I think it might not be so straight away for a first time user that is writing a simple JUnit test case. Using the AbstractDbTestCase class mentioned by Martin, this would be automatically achieved because the method processJobs(long) does a "commit" before starting the JobExecutor.
Thank you again Martin and please correct me if I've written something wrong.
Anyway, if this is considered to be a simple answer to a basic question (as kukeltje said)... well, I'm wondering why kukeltje couldn't write it himself: he would have certainly spent much less time that writing his two previous smart posts, as Martin's kind answer demonstrated.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267259#4267259
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267259
16 years, 5 months
[JBoss Portal Users] - Using WYSIWYG editor for entering UTF-8 characters
by skhobarekar
I have a requirement to use UTF-8 character for some bilingual requirement. Where in the text that is displayed is not english. I am using the CMS portlet to upload the content and assign it in the CMS portlet which is then displayed in the Portal page. The issues arises when I try to edit the content in the WYSIWYG editor. Whenever the content is opened for editing in the editor and I click on the save (create) button of the editor the content is converted to junk character specifically this - "?????? ???? ???" and displayed.
This is not an issue with the DB (portal DB). I checked the DB table; the content is save in a different pattern when the file uploaded. However the same content gets converted to ???? ??? ?? in the table when the content is edited using the WYSIWYG editor.
Any help on this front is appreciated
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267256#4267256
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267256
16 years, 5 months
[JMX] - Mbean depends on deployment of EJB3 jar?
by sverker
Hi
I have a mbean that is deployed with a *-service.xml file. The issue I see is that it has to be dependant on an EJB3 jar. I.e. it can't start until the ejb3 jar is deployed and it must stop before it is undeployed.
I was able to make that work in JBoss 4.2, but not in JBoss 5.1. I can set a dependency on an EJB2 jar in the same ear and that works, but not on the EJB3. The *-service.xml file is in the same .ear as the others.
My dependency look like this (I've tried other variants as well, it wasn' the same in JBoss 4.2):
<depends>jboss.j2ee:ear=LimeSms-1.2-SNAPSHOT.ear,jar=ejb3-limesms-1.2-SNAPSHOT.jar,service=EJB3</depends>
and I can see this exact name in the jmx-console. I've tried other variants as well.
The dependency on ejb2 jar looks like this, and it works:
<depends>jboss.j2ee:module="ejb2-limesms-1.2-SNAPSHOT.jar",service=EjbModule</depends>
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267252#4267252
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267252
16 years, 5 months