Unfortunately, now I'm having some issues when saving the knowledge
base: StartProcessEventListener is required to be serialized, (and if I do
declare it as Serializable, then ProcessRuntimeImpl is also required to be
serialized)
I think the problem is that the knowledge base is trying to serialize the
new listener added in line 201 of ProcessRuntimeImpl.java
Do you think there's a way to skip that listener from being serialized?
Thanks!
On Mon, May 16, 2011 at 11:12 PM, Kris Verlaenen <kverlaen(a)redhat.com>wrote:
Thanks, this indeed seems to be an issue with dynamically loading
this
process to the knowledge base.
I've create a JIRA issue for this and will look at fixing this:
https://issues.jboss.org/browse/JBPM-3197
Kris
Federico Feller wrote:
> Hi All,
>
> I need some help with the signal start event of bpmn2
> It seems that the signal start event doesn't work when a process
> definition is added to a knowledge base of an already created session.
> I have slightly modified the testSignalStart() unit test of
> SimpleBPMNProcessTest.java to reproduce the problem
> Firstly, I've added a new process definition named
> BPMN2-SignalStart2.bpmn2, based on the original BPMN2-SignalStart.bpmn2,
> just renaming the signal name from MySignalStart to MySignalStart2 and
> renaming the process id from Minimal to Minimal2
>
> The following test runs without any problem, since both process
> definitions are added before the session is created
>
> public void testSignalStart() throws Exception {
> KnowledgeBase kbase =
> createKnowledgeBase("BPMN2-SignalStart.bpmn2");
> KnowledgeBase kbase2 =
> createKnowledgeBase("BPMN2-SignalStart2.bpmn2");
> kbase.addKnowledgePackages(kbase2.getKnowledgePackages());
> StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
> final List<Long> list = new ArrayList<Long>();
> ksession.addEventListener(new DefaultProcessEventListener() {
> public void afterProcessStarted(ProcessStartedEvent event) {
> list.add(event.getProcessInstance().getId());
> }
> });
> ksession.signalEvent("MyStartSignal", "NewValue");
> ksession.signalEvent("MyStartSignal2", "NewValue");
> assertEquals(2, list.size());
> }
>
> However, the following test fail to run, as the process Minimal2 is never
> started when doing ksession.signalEvent("MyStartSignal2",
"NewValue");
> If I start the process directly using ksession.startProcess("Minimal2")
> then the test passes.
> public void testSignalStart2() throws Exception {
> KnowledgeBase kbase =
> createKnowledgeBase("BPMN2-SignalStart.bpmn2");
> KnowledgeBase kbase2 =
> createKnowledgeBase("BPMN2-SignalStart2.bpmn2");
> StatefulKnowledgeSession ksession =
> createKnowledgeSession(kbase);
>
> ksession.getKnowledgeBase().addKnowledgePackages(kbase2.getKnowledgePackages());
> final List<Long> list = new ArrayList<Long>();
> ksession.addEventListener(new DefaultProcessEventListener() {
> public void afterProcessStarted(ProcessStartedEvent event) {
> list.add(event.getProcessInstance().getId());
> }
> });
> ksession.signalEvent("MyStartSignal", "NewValue");
> ksession.signalEvent("MyStartSignal2",
"NewValue");
> //ksession.startProcess("Minimal2");
> assertEquals(2, list.size());
> }
>
> I found some clues on why this is happening.
> The first test works because, when the session is created, the method
> ProcessRuntimeImpl::initProcessEventListeners() is invoked, and the event
> listeners are properly initialized
> But in the second test, the event listeners are not initialized since
> adding a package does not reinitialize the session.
> Any ideas on where I can start looking to fix this? or any workaround?
>
> Thanks!
>
> Federico
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> jbpm-dev mailing list
> jbpm-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/jbpm-dev
>
>