[jboss-user] [jBPM] - How to trigger a Process by signal from external source?

Leo Tseng do-not-reply at jboss.com
Mon Oct 31 02:43:14 EDT 2011


Leo Tseng [http://community.jboss.org/people/leovleov] created the discussion

"How to trigger a Process by signal from external source?"

To view the discussion, visit: http://community.jboss.org/message/634202#634202

--------------------------------------------------------------
Hi
I've tried a example that can start a process by signal event in eclipse environment.

Like:

public static final void main(String[] args) {
        try {
            KnowledgeBase kbase = readKnowledgeBase();
            StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("x", "Ya!");
            params.put("y", "Cool!");
            ksession.signalEvent("MySignal", params);
        } catch (Throwable t) {
            t.printStackTrace();
        }        
    }

    private static KnowledgeBase readKnowledgeBase() throws Exception {
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newClassPathResource("SignalSTest.bpmn"), ResourceType.BPMN2);
        kbuilder.add(ResourceFactory.newClassPathResource("SignalSReTest.bpmn"), ResourceType.BPMN2);
        return kbuilder.newKnowledgeBase();
    }

In Process define:

<startEvent id="_1" name="Start" >
      <dataOutput id="_1_Output" />
      <dataOutputAssociation>
        <sourceRef>_1_Output</sourceRef>
        <targetRef>x</targetRef>
      </dataOutputAssociation>
      <outputSet>
        <dataOutputRefs>_1_Output</dataOutputRefs>
      </outputSet>
      <signalEventDefinition signalRef="MySignal" />
 </startEvent>

It does work.
But my question is,
when I deploy the process to Guvnor and build the package.
I don't know how to trigger the process in JBPM server from external environment.
I know there are some REST command to start the process, but it can't carry parameters like signal does and it can't trigger multiple processes once.
Is there any way to send a signal into JBPM server in order to trigger a process?

Any suggention will be appreciate.
Thanks for help.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/634202#634202]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111031/7c347533/attachment.html 


More information about the jboss-user mailing list