14 Replies Latest reply on Jun 4, 2013 3:45 PM by dward

    Is a different inbound payload allowed when signaling a BPM process?

    dustin.barlow

      Here is the BPM process model:

      Async-Signal-BPM-Service.png

      I have the following interface:

       

      public interface AsyncSignalEvent {
                public RequestAck startProcess(ProcessInfo processInfo);
                public RequestAck updateTask(TaskInfo taskInfo);
      }
      

       

      I am mapping the two methods to the following BPM actions:

       

      Async-Signal-Start-Process.png

      The updateTask method is mapped to a SIGNAL_EVENT:

       

      Async-Signal-Update-Task.png

      I am able to map the inputMessage and the outputMessage variables found on the I/O Parameters properties tab on all the BPM tasks.  The inputMessage variable correctly gives a fully populated instance of the ProcessInfo class.  The outputMessage variable correctly returns an instance of the RequestAck class to my JUnit test client.

       

      My issue is how to now get the TaskInfo object into my signal flow.  I thought that since the signalInput variable was not showing up in any of the I/O Parameters properties tab, that I needed to add it to the Data Items sections similiar to how the _inputMessage and _outputMessage were done.  However, when I do this, as shown in the image below, I don't have the option of selecting any form of TaskInfo as a data type.

       

      Async-Signal-Data-Items.png

      So then I go to the Data Definitions area thinking I need to define a new data definition so that it will show up in the Data Mappings area.

       

      Async-Signal-Definitions.png

      When I save the project and try to run it even before I try to map it to any of my BPM tasks, I get the following stack trace:

       

       

      21:20:31,212 ERROR [xml.ExtensibleXmlParser] (null: 10, 48): cvc-complex-type.2.4.a: Invalid content was found starting with element 'bpmn2:documentation'. One of '{"http://www.omg.org/spec/BPMN/20100524/MODEL":supportedInterfaceRef, "http://www.omg.org/spec/BPMN/20100524/MODEL":ioSpecification, "http://www.omg.org/spec/BPMN/20100524/MODEL":ioBinding, "http://www.omg.org/spec/BPMN/20100524/MODEL":auditing, "http://www.omg.org/spec/BPMN/20100524/MODEL":monitoring, "http://www.omg.org/spec/BPMN/20100524/MODEL":property, "http://www.omg.org/spec/BPMN/20100524/MODEL":laneSet, "http://www.omg.org/spec/BPMN/20100524/MODEL":flowElement, "http://www.omg.org/spec/BPMN/20100524/MODEL":artifact, "http://www.omg.org/spec/BPMN/20100524/MODEL":resourceRole, "http://www.omg.org/spec/BPMN/20100524/MODEL":correlationSubscription, "http://www.omg.org/spec/BPMN/20100524/MODEL":supports}' is expected.
      21:20:31,243 ERROR [xml.ExtensibleXmlParser] (null: 86, 28): cvc-complex-type.2.4.a: Invalid content was found starting with element 'bpmn2:outMessageRef'. One of '{"http://www.omg.org/spec/BPMN/20100524/MODEL":documentation, "http://www.omg.org/spec/BPMN/20100524/MODEL":extensionElements, "http://www.omg.org/spec/BPMN/20100524/MODEL":inMessageRef}' is expected.
      java.lang.IllegalArgumentException: No messages found
      21:20:31,249 ERROR [impl.KnowledgeBuilderImpl] ProcessLoadError: unable to parse xml : Exception class java.lang.IllegalArgumentException : No messages found
                at org.jbpm.bpmn2.xml.InMessageRefHandler.end(InMessageRefHandler.java:62)
                at org.drools.xml.ExtensibleXmlParser.endElement(ExtensibleXmlParser.java:422)
                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
                at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:828)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2939)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
                at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
                at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
                at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:301)
                at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:180)
                at org.jbpm.compiler.xml.XmlProcessReader.read(XmlProcessReader.java:46)
                at org.jbpm.compiler.ProcessBuilderImpl.addProcessFromXml(ProcessBuilderImpl.java:262)
                at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:673)
                at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:709)
                at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
                at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
                at org.switchyard.component.common.knowledge.util.Resources.addResources(Resources.java:62)
                at org.switchyard.component.common.knowledge.session.KnowledgeBaseSessionFactory.newBase(KnowledgeBaseSessionFactory.java:115)
                at org.switchyard.component.common.knowledge.session.KnowledgeBaseSessionFactory.<init>(KnowledgeBaseSessionFactory.java:58)
                at org.switchyard.component.common.knowledge.session.KnowledgeSessionFactory.newSessionFactory(KnowledgeSessionFactory.java:122)
                at org.switchyard.component.common.knowledge.exchange.KnowledgeExchangeHandler.start(KnowledgeExchangeHandler.java:181)
                at org.switchyard.component.bpm.exchange.BPMExchangeHandler.start(BPMExchangeHandler.java:90)
                at org.switchyard.deploy.internal.Deployment.deployImplementations(Deployment.java:483)
                at org.switchyard.deploy.internal.Deployment.start(Deployment.java:140)
                at org.switchyard.test.SwitchYardTestKit.deploy(SwitchYardTestKit.java:277)
                at org.switchyard.test.SwitchYardTestKit.start(SwitchYardTestKit.java:180)
                at org.switchyard.test.SwitchYardRunner.createTest(SwitchYardRunner.java:65)
                at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236)
                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
                at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233)
                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
                at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
                at org.switchyard.test.SwitchYardRunner.run(SwitchYardRunner.java:90)
                at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
                at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      
      

       

      I searched around and really didn't find anything helpful as to why simply adding the TaskInfo object as a defintion caused this issue.  So, what am I doing wrong or what am I missing when it comes to creating a new defintion?

       

      I read elsewhere in an unrelated thread that you can only send a String object in as the payload type in a signal event.  Is that true?

       

      EDIT:  I am using switchyard version 0.8.Final, Eclipse JUNO SR2, and all the latest JBoss plugins.

       

      Thanks!

        • 1. Re: Is a different inbound payload allowed when signaling a BPM process?
          dward

          I know that there is a sensitivity that definitions need to be at the top of your bpmn file for jbpm to like it, even if the schema allows definitions anywhere, so you might want to try moving it up.  If this doesn't work, please attach your project.  I especially need to see the bpmn file and the switchyard.xml files.

           

          Regarding your question on a "signal event" payload type needing to be a String: This might have been true a long time ago, but not anymore.  Certainly not in 0.8.  To get the event data, it first looks in the context with an Object property of a specific name, if not found, it defaults to the payload (content) of the incoming message.

          • 2. Re: Is a different inbound payload allowed when signaling a BPM process?
            dustin.barlow

            Thank you for the tip David and the info.  Glad to hear that signal payloads are not limited to just String objects.  I'm not exactly sure I follow the rest of your response, but I'll leave that until this other issue with the data definition is solved.

             

            I tried what you suggested (or at least I think I did it) and it didn't seem to help.  I got the following stack trace when I tried to execute the unit test.

             

            6:10:29,136 ERROR [xml.ExtensibleXmlParser] (null: 11, 48): cvc-complex-type.2.4.a: Invalid content was found starting with element 'bpmn2:documentation'. One of '{"http://www.omg.org/spec/BPMN/20100524/MODEL":supportedInterfaceRef, "http://www.omg.org/spec/BPMN/20100524/MODEL":ioSpecification, "http://www.omg.org/spec/BPMN/20100524/MODEL":ioBinding, "http://www.omg.org/spec/BPMN/20100524/MODEL":auditing, "http://www.omg.org/spec/BPMN/20100524/MODEL":monitoring, "http://www.omg.org/spec/BPMN/20100524/MODEL":property, "http://www.omg.org/spec/BPMN/20100524/MODEL":laneSet, "http://www.omg.org/spec/BPMN/20100524/MODEL":flowElement, "http://www.omg.org/spec/BPMN/20100524/MODEL":artifact, "http://www.omg.org/spec/BPMN/20100524/MODEL":resourceRole, "http://www.omg.org/spec/BPMN/20100524/MODEL":correlationSubscription, "http://www.omg.org/spec/BPMN/20100524/MODEL":supports}' is expected.
            16:10:29,146 ERROR [xml.ExtensibleXmlParser] (null: 56, 31): cvc-complex-type.2.4.b: The content of element 'bpmn2:ioSpecification' is not complete. One of '{"http://www.omg.org/spec/BPMN/20100524/MODEL":inputSet, "http://www.omg.org/spec/BPMN/20100524/MODEL":outputSet}' is expected.
            16:10:29,152 ERROR [xml.ExtensibleXmlParser] (null: 96, 28): cvc-complex-type.2.4.a: Invalid content was found starting with element 'bpmn2:outMessageRef'. One of '{"http://www.omg.org/spec/BPMN/20100524/MODEL":documentation, "http://www.omg.org/spec/BPMN/20100524/MODEL":extensionElements, "http://www.omg.org/spec/BPMN/20100524/MODEL":inMessageRef}' is expected.
            java.lang.IllegalArgumentException: No messages found
            16:10:29,157 ERROR [impl.KnowledgeBuilderImpl] ProcessLoadError: unable to parse xml : Exception class java.lang.IllegalArgumentException : No messages found
                      at org.jbpm.bpmn2.xml.InMessageRefHandler.end(InMessageRefHandler.java:62)
                      at org.drools.xml.ExtensibleXmlParser.endElement(ExtensibleXmlParser.java:422)
                      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
                      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:828)
                      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
                      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2939)
                      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
                      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
                      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
                      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
                      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
                      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
                      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
                      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
                      at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
                      at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:301)
                      at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:180)
                      at org.jbpm.compiler.xml.XmlProcessReader.read(XmlProcessReader.java:46)
                      at org.jbpm.compiler.ProcessBuilderImpl.addProcessFromXml(ProcessBuilderImpl.java:262)
                      at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:673)
                      at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:709)
                      at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
                      at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
                      at org.switchyard.component.common.knowledge.util.Resources.addResources(Resources.java:62)
                      at org.switchyard.component.common.knowledge.session.KnowledgeBaseSessionFactory.newBase(KnowledgeBaseSessionFactory.java:115)
                      at org.switchyard.component.common.knowledge.session.KnowledgeBaseSessionFactory.<init>(KnowledgeBaseSessionFactory.java:58)
                      at org.switchyard.component.common.knowledge.session.KnowledgeSessionFactory.newSessionFactory(KnowledgeSessionFactory.java:122)
                      at org.switchyard.component.common.knowledge.exchange.KnowledgeExchangeHandler.start(KnowledgeExchangeHandler.java:181)
                      at org.switchyard.component.bpm.exchange.BPMExchangeHandler.start(BPMExchangeHandler.java:90)
                      at org.switchyard.deploy.internal.Deployment.deployImplementations(Deployment.java:483)
                      at org.switchyard.deploy.internal.Deployment.start(Deployment.java:140)
                      at org.switchyard.test.SwitchYardTestKit.deploy(SwitchYardTestKit.java:277)
                      at org.switchyard.test.SwitchYardTestKit.start(SwitchYardTestKit.java:180)
                      at org.switchyard.test.SwitchYardRunner.createTest(SwitchYardRunner.java:65)
                      at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236)
                      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
                      at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233)
                      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
                      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
                      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
                      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
                      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
                      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
                      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
                      at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
                      at org.switchyard.test.SwitchYardRunner.run(SwitchYardRunner.java:90)
                      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
                      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
                      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
                      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
                      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
            

             

            I also attached the project if you'd like to take a look. Note: With the exception of the modification you suggested, the switchyard and bmpn files are all generated by the tooling.

             

            My goal with the prototype is to prove the concept of an async jBPM task that doesn't complete its work item.  The signal event portion of the flow completes it based on the TaskInfo data passed into it.  Once working, I want to expose it either via SOAP or JMS so outside systems can callback the switchyard instance and inform the BPM process that the task is completed so the workflow can move forward.

             

            Disclaimer:  This is not a fully functioning prototype.  I'm still in the beginning phases so anyone else looking to view this as an example of what to do should beware!

            • 3. Re: Is a different inbound payload allowed when signaling a BPM process?
              dward

              Hmmm... I don't think you need this line in your bpmn file:

               

              <bpmn2:signal id="taskUpdateSignalEventDefinition" name="TaskUpdateSignalEventDefinition"/>

               

              If you want to leave it, move it up above your <process> element.

               

              If that doesn't work, I apologize, but you might want to open a thread in the jbpm forum

              • 4. Re: Is a different inbound payload allowed when signaling a BPM process?
                dustin.barlow

                Thanks for taking a look.

                 

                I added the signal portion because I thought I needed to in order to turn a generic catch event into a signal one.  Some of the other BPM signal examples I ran across looked this way so I just followed suit.  I'll remove it and try it again but I have a feeling that it isn't really the issue with my adding of a new data type definition is somehow generating incomplete or incorrect BPMN2 xml.

                 

                I'll try as well on the jBPM forum.  I wasn't sure exactly where the dividing line between what is a Switchyard issue and a jBPM issue so apologies if I should have started this thread there.

                 

                One other mystery related to this is as I showed in the original post, I have the following interface going into the jBPM service in Switchyard.  This is also the interface that I use to promote the jBPM process to a SOAP endpoint.

                 

                 

                public interface AsyncSignalEvent {
                          public RequestAck startProcess(ProcessInfo processInfo);
                          public RequestAck updateTask(TaskInfo taskInfo);
                }
                

                 

                In the same project I attached above, if you run the unit test, you'll see that on the final out message, the ProcessInfo object is being returned and not the RequestAck.

                 

                 

                Operation -> startProcess
                Phase -> OUT
                State -> OK
                Exchange Context -> 
                          org.switchyard.exchangeDurationMS : 549
                Message Context -> 
                          org.switchyard.contentType : java:com.example.switchyard.RequestAck
                          org.switchyard.relatesTo : 1582c0ad-d73a-4e1b-aaba-1e4215822551
                          org.switchyard.messageId : 7e91803c-38b3-4b05-910a-ae0518ae69be
                          {urn:switchyard-component-bpm:bpm:1.0}processInstanceId : 1
                Message Content -> 
                com.example.switchyard.ProcessInfo@4514f313
                

                 

                As you can see, the contentType is correct in that it should be a RequestAck object being return.  However, the Message Content is actually returning a ProcessInfo object.  Any clues as to why this might be happening?

                • 5. Re: Is a different inbound payload allowed when signaling a BPM process?
                  dward

                  I don't see an <outputs><mapping> inside:

                  <bpm:action id="taskUpdateSignalEventDefinition" operation="updateTask" type="SIGNAL_EVENT">

                   

                  You will want one in there, just like you do inside:

                  <bpm:action operation="startProcess" type="START_PROCESS">

                   

                  Aside, I think you were lucking out that you were getting the right content back in your startProcess, because if it doesn't work, then you could be hitting #2 here, which will be fixed in 1.0.

                  • 6. Re: Is a different inbound payload allowed when signaling a BPM process?
                    dustin.barlow

                    Yes, the above version I attached didn't have an output mapping defined because when I did have it mapped to the contentOutput, the payload was still being returned as a ProcessInfo object which confused me.  So I thought, since I read somewhere in the docs, that if you don't have a mapping defined, Switchyward defaults to contentInput (should be type ProcessInfo) and contentOutput (should be RequestAck).

                     

                    What was throwing me off is how Switchyard knew the org.switchyard.contentType was java:com.example.switchyard.RequestAck but yet was returning a ProcessInfo object in the Message Content.

                    • 7. Re: Is a different inbound payload allowed when signaling a BPM process?
                      dward

                      Yeah but I don't think you have a contentOutput process-level variable defined in your process, right?

                       

                      And yeah, in that same jira I pointed you to, it mentions the response type.

                      • 8. Re: Is a different inbound payload allowed when signaling a BPM process?
                        dustin.barlow

                        I used the variable names inputMessage and outputMessage since that is the variable name I typed in the content in and content out fields of the new service wizard when I initially created the BPM service.  I then mapped that in each Task for both the input and the output.

                         

                        TaskMappings.png

                         

                        I did end up changing my local copy to contentInput and contentOutput thinking maybe there was something odd going on in the default mapping where it expected the variable name to be contentInput/contentOutput.  Plus, the BPM quickstart and the docs used variable names of contentInput and contentOutput as well so I figured I would rule that possibility out.  Unfortunately, the results were the same.  I got the ProcessInfo instance back but the type was RequestAck

                         

                        So are you suggesting that I switch to 1.0 or is there a work around I can try?  It doesn't appear the bug has been fixed in 1.0 according to the Jira link.  Is there a known work-around?

                         

                         

                        David Ward wrote:

                         

                        Yeah but I don't think you have a contentOutput process-level variable defined in your process, right?

                         

                        And yeah, in that same jira I pointed you to, it mentions the response type.

                        • 9. Re: Is a different inbound payload allowed when signaling a BPM process?
                          dustin.barlow

                          Hi Dave,

                           

                          I believe I found what was causing the wrong payload issue and the possible workaround.  The person who did this video http://www.youtube.com/watch?feature=player_detailpage&v=ac3mooANDoY#t=221s also shows the same issue which is what prompted me to try it as well.

                           

                          I decided to start over with a new project and carefully add back all the stuff in the original project one step at a time while verifying the XML produced in both the switchyard.xml file as well as the BPMN file.

                           

                          This is the interface I'm using for the BPMN service (which will also serve eventually as the inteface for the SOAP exposed endpoint).

                           

                          public interface ProcessController {
                                    RequestAck startProcess(ProcessInfo processInfo);
                                    RequestAck updateTask(TaskInfo taskInfo);
                          }
                          

                           

                          Here is the very simple Switchyward process view:

                           

                          SwitchYardProcessView.png

                          Here is the mapping I did from Switchyard to BMPN (Notice the lack of an output mapping):

                           

                          SwitchyardToBPMNMapping.png

                           

                          The BPMN process looks like this:

                           

                          SwitchyardBPMNProcessView.png

                           

                          The mappings for the AcknowledgeTask looks like this:

                           

                          SwitchyardAcknowledgeTaskMappings.png

                           

                          Since I'm just using a standard Task, not a Switchyard Dynamic Task, I provided the WorkItemHandler which looks like this:

                           

                           

                          import java.util.HashMap;
                          import java.util.Map;
                          
                          import org.kie.runtime.process.WorkItem;
                          import org.kie.runtime.process.WorkItemHandler;
                          import org.kie.runtime.process.WorkItemManager;
                          
                          /**
                           * @author dbarlow
                           * 
                           */
                          public class AckowledgeTaskWorkItemHandler implements WorkItemHandler {
                          
                           /*
                                     * (non-Javadoc)
                                     * 
                                     * @see
                                     * org.kie.runtime.process.WorkItemHandler#executeWorkItem(org.kie.runtime
                                     * .process.WorkItem, org.kie.runtime.process.WorkItemManager)
                                     */
                           @Override
                                    public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
                                              System.out.println("****** AckowledgeTaskWorkItemHandler : workItem: "
                                                                  + workItem.getId() + " " + workItem.getName()
                                                                  + " : parameters: " + workItem.getParameters() + " : results: "
                                                                  + workItem.getResults());
                            
                                              Map<String, Object> results = new HashMap<String, Object>();
                                              RequestAck requestAck = new RequestAck();
                                              requestAck.setStatus(true);
                                              requestAck.setStatusMsg("Job is processing");
                                              results.put("contentOutput", requestAck);
                          
                                              System.out
                                                                  .println("AckowledgeTaskWorkItemHandler : Completing Work Item");
                                              manager.completeWorkItem(workItem.getId(), results);
                                    }
                          
                           /*
                                     * (non-Javadoc)
                                     * 
                                     * @see
                                     * org.kie.runtime.process.WorkItemHandler#abortWorkItem(org.kie.runtime
                                     * .process.WorkItem, org.kie.runtime.process.WorkItemManager)
                                     */
                           @Override
                                    public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
                          
                                    }
                           }
                          
                          

                           

                          When running the unit test for this process with tracing on, I get the following:

                           

                          ------- Begin Message Trace -------
                          Service -> {urn:com.example.switchyard:switchyard-quickstart-bpm-signal-demo:1.0}ProcessController
                          Operation -> startProcess
                          Phase -> OUT
                          State -> OK
                          Exchange Context -> 
                                    org.switchyard.exchangeDurationMS : 431
                          Message Context -> 
                                    org.switchyard.contentType : java:com.example.switchyard.switchyard_quickstart_bpm_signal_demo.RequestAck
                                    org.switchyard.relatesTo : c9feb2aa-f96e-4385-997b-7da5004852bc
                                    {urn:switchyard-component-bpm:bpm:1.0}processInstanceId : 1
                                    org.switchyard.messageId : 3a7f5c91-e81f-4241-ba22-1939b5d0ce20
                          Message Content -> 
                          com.example.switchyard.switchyard_quickstart_bpm_signal_demo.RequestAck@3f2a09d5
                          ------ End Message Trace -------
                          
                          

                           

                          This is the behavior I expected. 

                           

                          However, if I go back and add the output Mapping to the switchyard.xml like this:

                           

                           

                          <bpm:action operation="startProcess" type="START_PROCESS">
                                      <bpm:inputs>
                                           <bpm:mapping expression="message.content" variable="contentInput"/>
                                      </bpm:inputs>
                                      <bpm:outputs>
                                           <bpm:mapping expression="message.content" variable="contentOutput"/>
                                      </bpm:outputs>
                          </bpm:action>
                          
                          
                          

                           

                          When I run the unit test again, this is the trace output:

                           

                           

                          ------- Begin Message Trace -------
                          Service -> {urn:com.example.switchyard:switchyard-quickstart-bpm-signal-demo:1.0}ProcessController
                          Operation -> startProcess
                          Phase -> OUT
                          State -> OK
                          Exchange Context -> 
                                    org.switchyard.exchangeDurationMS : 456
                          Message Context -> 
                                    org.switchyard.relatesTo : 5a966d35-be8a-4949-98fe-990704beb86d
                                    org.switchyard.messageId : fc5d47b4-98fe-4095-b27a-9245f7312147
                                    {urn:switchyard-component-bpm:bpm:1.0}processInstanceId : 1
                                    org.switchyard.contentType : java:com.example.switchyard.switchyard_quickstart_bpm_signal_demo.RequestAck
                          Message Content -> 
                          com.example.switchyard.switchyard_quickstart_bpm_signal_demo.ProcessInfo@642ddc4c
                          ------ End Message Trace -------
                          
                          

                           

                          The org.switchyard.contentType is correct, but the message content payload is incorrect as we've discussed previously.

                           

                          I have attached the project if you'd like to run it yourself or look at anything else.

                          • 10. Re: Is a different inbound payload allowed when signaling a BPM process?
                            dward

                            Dustin Barlow wrote:

                            <bpm:action operation="startProcess" type="START_PROCESS">
                                        <bpm:inputs>
                                             <bpm:mapping expression="message.content" variable="contentInput"/>
                                        </bpm:inputs>
                                        <bpm:outputs>
                                             <bpm:mapping expression="message.content" variable="contentOutput"/>
                                        </bpm:outputs>
                            </bpm:action>

                             

                            Hi Dustin.  Sorry for the late reply.  This morning I submitted pull requests for SWITCHYARD-1382.  In short, you hit a big skeleton in my closet that's finally been fixed.

                             

                            My guess is that you changing your output mapping to this might help:

                             

                            <bpm:mapping expression="contentOutput" variable="contentOutput"/>

                             

                            .  That is, if your bpmn2 file properly maps the task's contentOutput to the processs' contentOutput.  Then, the variable is the same name, since that is the hardcoded "special" variable that's looked for.  Fortunately, the hardcoding is gone for 1.0.  Now you can have a to expression to specify exactly where you want output to go.  So, like this:

                             

                            <bpm:output from="contentOutput" to="message.content"/>

                             

                            You can read more about it here: Rules and BPM Component Configuration Changes for 1.0

                             

                            Thanks again for you patience.

                            1 of 1 people found this helpful
                            • 11. Re: Is a different inbound payload allowed when signaling a BPM process?
                              dustin.barlow

                              No worries Dave.  Thanks for the update. 

                               

                              I'm just glad I wasn't crazy since I had been trying every combination of things I could think of over the past few weeks and was getting no where with it.

                               

                              Will your fix also make the inbound and outbound payload for SIGNAL_EVENT calls work properly as well?  I've had zero luck at getting my BPMN signal process flow to take in any type of payload which effectively makes it useless for what I'm trying to accomplish.  I know I've sortof mixed in some other topics in this thread as well, so I appreciate your patience with me trying to unravel this mystery.

                               

                              Also, if I were to want to get your updates, I presume I'd need to switch to the nightly builds of the 1.0 release or build it myself from the git sources correct? 

                               

                              What about the Eclipse tooling as well since I do use Eclipse to run unit tests which I presume would not pick up your updates until the JBoss Tools team does a new build of the Switchyard runtime?

                               

                              I will try what you suggested against the 0.8.FINAL release and report back as soon as I can.

                              • 12. Re: Is a different inbound payload allowed when signaling a BPM process?
                                dward

                                Sorry for contributing to you banging your head against the wall.   I'm thinking you're gonna like the runtime changes.

                                 

                                Yes, I also found and fixed the SIGNAL_EVENT input/output mapping bug.  It's also mentioned on that "config changes" article link I posted above.

                                 

                                I don't know when my fix will get processed, but once it does, you would be able to find it in the nightly hudson/snapshot builds.

                                 

                                Regarding the tooling, there is a different jira to update the tooling to match my runtime changes.  That is SWITCHYARD-1521.

                                • 13. Re: Is a different inbound payload allowed when signaling a BPM process?
                                  dustin.barlow

                                  Anytime you use a "community" version of software, a little bit of head banging is expected. 

                                   

                                  I read through your link and it certainly seems like you've addressed all the issues I've run into so far.  Looking forward to trying it out.

                                   

                                  In the meantime though, is there a work-around for the SIGNAL_EVENT payload similar to the one you gave for the START_PROCESS output mapping?

                                   

                                  I did try what you suggested by adding the <bpm:output from="contentOutput" to="message.content"/> to the output section for the START_PROCESS.  It worked just like leaving the output mapping out completely also worked.

                                   

                                  As a side note and once I get everything working, I'd like to submit this prototype I'm working as a possible addition to the Switchyard quickstarts so that others can benefit from what I feel to be a pretty common pattern of having to call, orchestrate, and manage async tasks.  Is there a document somewhere that describes what is expected as far as project layout, naming conventions, etc.?

                                  • 14. Re: Is a different inbound payload allowed when signaling a BPM process?
                                    dward

                                    I don't think there's a workaround for the signalEvent like there is for the startProcess. Sorry.  :/

                                     

                                    Hmmm... regarding contributing to the quickstarts, there is a community agreement that has to be signed, and then the development process is documented here: Development on SwitchYard.

                                    You can then issue pull requests and one of the core developers can give you feedback and process the request when it is satisfactory.  I would say just look through all the other quickstarts on github and get a feel for their structure.  I don't know if we have a documented set of naming convensions, etc...  Oh wait, here's one from two years ago: SwitchYard Quickstart Naming Convention 

                                    1 of 1 people found this helpful