[jboss-user] [jBPM] - Jbpm 3 jms state problem

Giovanni Marigi do-not-reply at jboss.com
Mon Nov 1 13:37:18 EDT 2010

Giovanni Marigi [http://community.jboss.org/people/hifly81] created the discussion

"Jbpm 3 jms state problem"

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

I'm using jbpm 3 and I want to realize a state node as a jms topic subscriber.
Basically I want to call the *leaveNode()* inside my "jms handler" as soon as a message comes to the topic.
The problem is that I can't call the *leaveNode() *without hibernate exceptions** cause the *executionContext inside the onMessage method* is not the same
*executionContext inside the execute method.
I think beacuse they are running in separate threads?*

I'm not so good in jbpm and maybe my approach is completely wrong!


public class WaitForJmsHandler implements ActionHandler {  

    Context jndiContext = null;
    *ExecutionContext executionContext = null;*
    TopicConnectionFactory topicConnectionFactory = null;
    TopicConnection topicConnection = null;
    TopicSession topicSession = null;
    Topic topic = null;
    TopicSubscriber topicSubscriber = null;

    public void execute(ExecutionContext ctx) throws Exception {
        this.executionContext = ctx;

        Hashtable props = new Hashtable();
        props.put(javax.naming.Context.PROVIDER_URL, "");
        jndiContext = new InitialContext(props);

        topicConnectionFactory = (TopicConnectionFactory)
        topic = (Topic) jndiContext.lookup("topic/testTopic");

        topicConnection = topicConnectionFactory.createTopicConnection();
        topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        topicSubscriber = topicSession.createSubscriber(topic);
        topicSubscriber.setMessageListener(new CustomJMSListener() {
            public void onMessage(Message message) {
                try {
                    System.out.println("Received message:["+message+"]");
                    System.out.println("Leaving node....");
                catch(Exception ex) {
                    try {
                    } catch (JMSException e) {
                        // TODO Auto-generated catch block

        JbpmContext jbpmContext = executionContext.getJbpmContext();


Reply to this message by going to Community

Start a new discussion in jBPM at Community

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

More information about the jboss-user mailing list