8 Replies Latest reply on Jan 7, 2009 11:16 AM by t0m.guenter

    jBPM process-definition-name read from message

    hauch

      I am using the BpmProcessor to deploy a new instance of a jbpm flow from the ESB.
      I would like to be able to read the name of the process definition from the message - as it is possible to do with the key.

      I have made the required changes locally, and know I would like to commit it.

      To use this functionality, use the property process-definition-name-location instead of process-definition-name or process-definition-id.

      This raises to questions:
      1. Is this a relevant feature?
      2. (if yes to 1.) How shall I commit the changes?

        • 1. Re: jBPM process-definition-name read from message
          kconner

          Sorry, can you explain further what you have done?

          If you are referring to creating a new process instance then I believe it is already possible to do this in the current codebase.

          Which version are you using?

          • 2. Re: jBPM process-definition-name read from message
            hauch

            Sure:

            I want to create a new jbpm process instance. It is possible at the moment (version 4.4), but you have to provide either the name or id of the process definition on which you want to create an instance.
            The feature I ask for, is to be able to read the name of process from the esb message (instead of a "hardcoded" property). A similar feature exists for the "key" property.

            So what I have done is to add support for a new property: process-definition-name-location, which has an expression pointing to the value.
            If neither the processid or -name property is present, this expression is evaluated using ObjectMapper. And the value is used as process definition name.

            Hope this makes my intend clearer?

            • 3. Re: jBPM process-definition-name read from message
              kconner

              I believe this is already possible in the current codebase.

              Did you try specifying the name/id in the message body? Try specifying the name in location jbpmProcessDefName or the id in location jbpmProcessDefId.

              • 4. Re: jBPM process-definition-name read from message
                camunda

                Can you please elaborate a bit more the intended use case?

                Because my spontaneous opinion is (and I didn't had other use cases in projects yet), that a service should start a defined process instance (so the name would be fixed).

                If you want to start different processes depending on message content or whatever, wouldn't the design be more clear if you route it to different services?

                But I also have some ideas in mind when this could maybe make sense, so it would by very interesting WHY you want to do that...

                Thanks! Bernd.

                • 5. Re: jBPM process-definition-name read from message
                  kconner

                   

                  "camunda" wrote:
                  Because my spontaneous opinion is (and I didn't had other use cases in projects yet), that a service should start a defined process instance (so the name would be fixed).

                  I believe this would be the general case but I do not believe there is anything in the current codebase which would prevent a more dynamic approach.

                  The documentation will probably not cover this however.

                  • 6. Re: jBPM process-definition-name read from message
                    camunda

                     

                    I believe this is already possible in the current codebase.


                    Yepp, it is called:
                    - jbpmProcessDefName
                    - jbpmProcessDefVersion
                    - jbpmProcessDefId

                    Add it on the body as Kevin wrote...

                    Basically specifing it in the jbpm-esb.xml just overwrites these values.

                    • 7. Re: jBPM process-definition-name read from message
                      hauch

                      Thanks for the replies.

                      Kevin:
                      You're right, the NewProcessInstanceFacade copies the field from ConfigTree to message.body if present. Later on the CommandExecutor tries to read it from the body.
                      So if you put in on the body and leave out the tag it works!
                      My only concern is that I'm coding against a current implementation, which might change - but I guess I can live with that....

                      Bernd:
                      I am starting a workflow dependent on the content of a message (xml). There are >10 possible workflows to choose among and I find it somewhat lame to repeat the same behaviour in separat services for all these.
                      Instead of using the content based router, I have made variant that based on the content picks a process definition name from a list and (after I have read Kevin's reply...) writes it to jbpmProcessDefName.

                      • 8. Re: jBPM process-definition-name read from message
                        t0m.guenter

                        Hi,
                        although this is an older thread, I still try to post a follow-up.

                        As far as I understood and could see in the sources, the messages you were talking about were the ESB internal messages of type org.jboss.soa.esb.message.Message.

                        This one supports the method:

                        message.getBody().addString("jbpmProcessDefName", "fooProcess");


                        In my system the message that triggers the jBPM execution is a JMS message. It there a possibility to get the information from the JMS message into the ESB message? If yes, could you give me an advise how I get this control information into the JMS message.

                        Every hint would be appreciated.

                        Thanks
                        tom