[jboss-dev-forums] [Design of JBoss jBPM] - Re: MessageService and JMS

mteira do-not-reply at jboss.com
Mon Oct 16 07:35:03 EDT 2006


Hello again.

I was not able to make it work with the configuration you pasted here. But I found the code where the configuration is parsed and I think that the only way to inject fields into a factory is to declare explicitly to be a BeanInfo. Looking at the code in JbpmContextInfo constructor, while iterating over the serviceElements:

      if (serviceElement.hasAttribute("factory")) {
  |         String factoryClassName = serviceElement.getAttribute("factory");
  |         BeanInfo beanInfo = new BeanInfo();
  |         beanInfo.setClassName(factoryClassName);
  |         serviceFactoryObjectInfo = beanInfo;
  |       } else {
  |         Element factoryElement = XmlUtil.element(serviceElement, "factory");
  |         if (factoryElement==null) {
  |           throw new ConfigurationException("element 'service' requires either a factory attribute or a factory element");
  |         }
  |         Element factoryBeanElement = XmlUtil.element(factoryElement);
  |         if (factoryBeanElement==null) {
  |           throw new ConfigurationException("element 'factory' requires either a bean or ref element");
  |         }
  |         serviceFactoryObjectInfo = objectFactoryParser.parse(factoryBeanElement);
  |       }

I understand that when the 'factory' attribute is present, a BeanInfo is created using the no-args constructor, and then, only the className is set. The only way to create a BeanInfo with fields to inject is to create it using the 

  | public BeanInfo(Element beanElement, ObjectFactoryParser objectFactoryParser)

constructor. So, I've used this configuration to create the service factory:

    <service name="message">
  |     	<factory><bean class="org.jbpm.msg.jms.JmsMessageServiceFactoryImpl">
  | 	    	<field name="connectionFactoryJndiName"><string value="java:/XAConnectionFactory"/></field>
  | 	    	<field name="destinationJndiName"><string value="queue/JbpmCommandQueue"/></field>
  | 	    </bean></factory>
  |     </service>

As you can see, I've used the same JbpmCommandQueue as the destination for the JMS Message Service, but I was not really sure about that. I was hypothesizing that everything that the message service can generate were Command instances, so new Commands would be generated after processing the Process Instance nodes, and those Commands would be also consumed by the CmdListener MDB.

When I tried to send a Composite Command with (NewProcessInstanceCommand, SignalCommand) I finally got an Exception caused by:

  | org.jbpm.JbpmException: command listener bean only can handle object messages with Command's as the object.

So, I think I'm missing part of the picture, and perhaps there's another queue involved. Could you please explain me the whole workflow of the JMS Message Service System?

Best regards.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978492#3978492

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978492



More information about the jboss-dev-forums mailing list