1 2 3 Previous Next 32 Replies Latest reply on Nov 6, 2008 5:28 AM by Kevin Conner

    replyTo in jBPM calls

    Piotr Hrebieniuk Newbie

      Hi there,

      I have a problem with configuring Jbpm called from ESB as Kevin Conner described it here: https://jira.jboss.org/jira/browse/JBESB-1457 . I get an exception:

      java.lang.IllegalArgumentException: null 'value' arg in method call.
      at org.jboss.internal.soa.esb.assertion.AssertArgument.isNotNull(AssertArgument.java:43)
      at org.jboss.internal.soa.esb.message.format.xml.BodyImpl.add(BodyImpl.java:81)
      at org.jboss.soa.esb.services.jbpm.cmd.NewProcessInstanceFacade.setJBPMContextParameters(NewProcessInstanceFacad
      e.java:97)
      at org.jboss.soa.esb.services.jbpm.actions.BpmProcessor.process(BpmProcessor.java:73)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:1
      02)
      at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProce
      ssor.java:74)
      at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:316)
      at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:53
      0)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)

      i figured out, that the name of parameter, which value is null, is "jbpmFaultTo". I don't know where to put such a setting. My config:

      end state config:

      <end-state name="end-state1">


      reply


      </end-state>

      the calling service action:

      < action name="create_new_process_instance"
      class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
      < property name="command" value="StartProcessInstanceCommand" />
      < property name="reply-to-originator" value="true"/>
      < property name="process-definition-name" value="processdefinition"/>
      < property name="esbToBpmVars">
      < mapping esb="payload" bpm="theBody" />
      </ property>
      </ action>


      thanks,
      Piotr

        • 1. Re: replyTo in jBPM calls
          Kevin Conner Master

          Unfortunately you are suffering from https://jira.jboss.org/jira/browse/JBESB-1921

          The fix is already in trunk, can you build that and try again?

          • 2. Re: replyTo in jBPM calls
            Piotr Hrebieniuk Newbie

            Should i download whole AS? Can you please provide a path to appropriate repo? I'd be gratefull.

            • 3. Re: replyTo in jBPM calls
              Kevin Conner Master

              You can download it through subversion from http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk

              Once downloaded, go into product and run 'ant dist'

              • 4. Re: replyTo in jBPM calls
                Piotr Hrebieniuk Newbie

                Hi there,

                I did what you told me, but it didn't solved my problem.
                ant dist went ok (with some warnings ), but the 'ant deploy' task failed with "cannot find JMS provider".
                I tried to deploy my esb to new server instance (in product\build\jbossesb-server-4.4.GA) and it worked. So, i changed deploy.properties in my project, deployed it and started. Here's what went wrong:

                org.jbpm.JbpmException: couldn't execute org.jboss.soa.esb.services.jbpm.cmd.CommandExecutor$AsyncStartProcessInstanceCommand@7d29df
                at org.jboss.command.impl.CommandServiceImpl.execute(CommandServiceImpl.java:73)

                I found that the original exception thrown from AsyncStartProcessCommand says that:

                'org.jbpm.JbpmException: can't create a process instance when processDefinition is null"

                Any ideas?

                • 5. Re: replyTo in jBPM calls
                  Piotr Hrebieniuk Newbie

                  ok, i'm sorry for this - i've forgot to deploy the process :\
                  The error i've claimed to solve doesn't show now, but i still can't get response to go.
                  Question for now is: where exactly should i wait for reply ? in X_reply queue? (where queue X is the origin process initiator queue) When i synchronously get a response from service starting process (by ServiceInvoker.deliverSync()) the response is a message from before the process (and, in fact, i get the reply before the process ends).

                  I'm glad i have no exceptions, but it's not enough :)

                  Thanks,
                  Piotrek

                  • 6. Re: replyTo in jBPM calls
                    Jiri Pechanec Apprentice

                    Hi,

                    you can simulate synchronous invocation of jBPM orchestarted process in this way
                    1) Configure the action that starts jBPM process as mep="OneWay"
                    2) Prepare the reply message in JBPM process
                    3) Associate ESBNotifier action with last transition in the jBPM process and use < property name="reply-to-originator" value="true"/>, map the prepared response to ESB message
                    4) Call the starter service with deliverSync and do not forget to set ReplyTo header on the message

                    J.

                    • 7. Re: replyTo in jBPM calls
                      Piotr Hrebieniuk Newbie

                      Hi there!

                      Thanks for your reply.
                      As far as i know, storing replyTo field in message isn't obligatory - when there's no such field, queueName_reply is used. The thing is this queue (reply) is defined, but i get reply even before the process ends..

                      • 8. Re: replyTo in jBPM calls
                        Kevin Conner Master

                        Storing the reply is not obligatory but, as Jirka pointed out, you should make sure that the service which creates the service instance is marked as OneWay.

                        This will prevent the initial pipeline from responding and allow the jBPM process to assume that role.

                        • 9. Re: replyTo in jBPM calls
                          Piotr Hrebieniuk Newbie

                          i'm afraid it's not working.
                          I've set mep=OneWay on the service wich starts the process, and with mappings and replyToOriginator property set as a last action of a last node of a process, or as an action of end state(the results are equal).
                          What i get is JBoss tries to run process twice ( i don't know why) - it runs correctly, but i get unresponsive EPR on every try (on the queue from wich process was started). Then i see a "Delivering message" to the same queue. After that i get an exception (MessageDeliverException) telling me that it can't deliver a message to my bpmStarter service (in fact it correctly points this service's _reply queue).

                          Thanks,
                          Piotrek

                          • 10. Re: replyTo in jBPM calls
                            Jiri Pechanec Apprentice

                            Hi,

                            this definitely works for me. Can you please post the snippet of jboss-esb.xml file and porcessdefinition.xml file. Also please the snippet of the code you are using. I think we are near the solution - maybe type or overlooking is in place.

                            J.

                            • 11. Re: replyTo in jBPM calls
                              Piotr Hrebieniuk Newbie

                              Thank you very much for your willing to help.

                              Here is my piece of jboss-esb.xml:

                              <service category="BPM" name="BPMStarter"
                               description="BPM Orchestration Sample 1: Use this service to start a process instance">
                               <listeners>
                               <jms-listener name="Gateway" busidref="testingFirstjBPMGwChannelNew"
                               is-gateway="true" />
                               <jms-listener name="ESB-Listener" busidref="testingSecondjBPMEsbChannelNew"/>
                               </listeners>
                               <actions mep="OneWay">
                               <action name="create_new_process_instance"
                               class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
                               <property name="command" value="StartProcessInstanceCommand" />
                               <property name="reply-to-originator" value="true"/>
                               <property name="process-definition-name" value="testBPM"/>
                               <property name="esbToBpmVars">
                               <mapping esb="payload" bpm="theBody" />
                               </property>
                               </action>
                               </actions>
                               </service>
                              


                              process definition:

                              <?xml version="1.0" encoding="UTF-8"?>
                              
                              <process-definition xmlns="" name="testBPM">
                               <start-state name="firstJBPM">
                               <transition to="someService"></transition>
                               </start-state>
                               <node name="someService">
                               <action class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
                               <esbServiceName>
                               testingResponseNew
                               </esbServiceName>
                               <esbCategoryName>
                               testowe
                               </esbCategoryName>
                               <bpmToEsbVars>
                               <mapping bpm="theBody" esb="payload" />
                               </bpmToEsbVars>
                               <esbToBpmVars>
                               <mapping bpm="theBody" esb="payload" />
                               </esbToBpmVars>
                               </action>
                               <transition to="someService2"></transition>
                               </node>
                               <node name="someService2">
                               <action class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
                               <esbServiceName>
                               testingResponseNew
                               </esbServiceName>
                               <esbCategoryName>
                               testowe
                               </esbCategoryName>
                               <bpmToEsbVars>
                               <mapping bpm="theBody" esb="payload" />
                               </bpmToEsbVars>
                               <esbToBpmVars>
                               <mapping bpm="theBody" esb="payload" />
                               </esbToBpmVars>
                               </action>
                               <transition to="end-state1"></transition>
                               </node>
                               <end-state name="end-state1">
                               <action class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbNotifier">
                               <property name="reply-to-originator" value="true"/>
                               <replyToOriginator>true</replyToOriginator>
                               <bpmToEsbVars>
                               <mapping bpm="theBody" esb="payload" />
                               </bpmToEsbVars>
                               <esbToBpmVars>
                               <mapping bpm="theBody" esb="payload" />
                               </esbToBpmVars>
                               </action>
                               </end-state>
                              </process-definition>
                              

                              Note here, that it doesn't matter wether i put the EsbNotifier action in last node or end state.

                              the code i use to call this service:
                              System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
                              
                               ServiceInvoker invoker = new ServiceInvoker(this.getTargetCategory(), this.getTargetService());
                               Message requestMessage = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
                               requestMessage.getBody().add(PAYLOAD_NAME,msg);
                              
                               Message replyMessage = invoker.deliverSync(requestMessage, 6000);
                              

                              Where PAYLOAD_NAME is a simple string indicating where is my payload located, getTargetService() and getTargetCategory() returns names of service and it's category which i want send messages to.

                              Thanks one more time, hope we figure something out.

                              • 12. Re: replyTo in jBPM calls
                                Jiri Pechanec Apprentice

                                Thanks, I'm looking at it. Can you just (as a quick fix) try to increase the timeout to at least 30 secs (just for sure).

                                • 13. Re: replyTo in jBPM calls
                                  Jiri Pechanec Apprentice

                                  Plese use

                                  <replyToOriginator>reply</replyToOriginator>
                                  not
                                  <replyToOriginator>true</replyToOriginator>


                                  • 14. Re: replyTo in jBPM calls
                                    Piotr Hrebieniuk Newbie

                                    The change of replyToOriginator didn't made any difference - the exception still occurs. The bigger wait time let the process to run not 2, but 4 times ( each time the unresponsive EPR took place).

                                    1 2 3 Previous Next