Working Sample for Sending JMS from a Workflow

391 views
Skip to first unread message

Kay

unread,
Aug 8, 2017, 2:34:03 AM8/8/17
to jBPM Development
Hi all,

I am evaluating jBPM for the purpose of replacing our current Oracle Workflow engine.

I have spent several weeks playing around jBPM (still a newbie for sure :-). One thing I really couldn't figure out and couldn't find any useful answer online is how to send a JMS messages from a Workflow. There are REST, Email, Log, and WS Service Tasks. But there is not JMS Service Task. I guess that I need to use Send and Receive tasks to implement the JMS sending and receiving.

Our jBPM workflows need to send JMS messages to the external systems for updating the external systems. The results of the updating need to be sent back to the jBPM workflows so that the workflows can continue. So it is pretty classic. The external systems are very old and only have JMS interfaces (no WS and REST interfaces).

Could anyone point me to the right places somewhere on the Internet or write something describing in details how to create a such kind of workflow step by step from workflow design to Java coding?

I am using jBPM 7.0.

Many thanks.

Kay

Maciej Swiderski

unread,
Aug 8, 2017, 3:09:25 AM8/8/17
to Kay, jBPM Development
Here is a JMS implementation of work item handler that you could use for Send Task https://github.com/kiegroup/jbpm/blob/master/jbpm-workitems/src/main/java/org/jbpm/process/workitem/jms/JMSSendTaskWorkItemHandler.java

see this article [1] of how it is used by external signals, though it might be more than that. In addition you could override createMessage method of that class to alter behavior according to your needs.

Maciej

--
You received this message because you are subscribed to the Google Groups "jBPM Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-developme...@googlegroups.com.
To post to this group, send email to jbpm-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-development/246ac5eb-4f98-4930-8d52-1f75ec6be33d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kay

unread,
Aug 8, 2017, 9:20:21 PM8/8/17
to jBPM Development, mao...@gmail.com
Thanks Maciej for your quick response. I will give it a go.

Regards,

Kay

Kay

unread,
Aug 14, 2017, 8:06:44 PM8/14/17
to jBPM Development, mao...@gmail.com
Hi Maciej,

Sorry for troubling you again.

I created a custom task to use your JMS class. I could successfully send messages out to a queue  and received by the external Java application. 

However, the workflow simply stopped once this custom task is completed (your executeWorkItem method is executed). It didn't go to the next task.

Can you tell me what I missed out?

BTW, I did add a Timer.sleep() in ProcessMain.java which doesn't make any difference.

Regards,

Kay

Kevin Hirschmann

unread,
Aug 15, 2017, 3:02:37 AM8/15/17
to jBPM Development, mao...@gmail.com
Hi,

it seems the method executeWorkItem misses a " manager.completeWorkItem(workItem.getId(), parameters);" at its end.

Kind regards,

Kevin

Maciej Swiderski

unread,
Aug 15, 2017, 6:43:56 AM8/15/17
to Kay, jBPM Development, Kevin Hirschmann
As Kevin mentioned, completeWorkItem is required, though that JMSWorkItemHandler actually does complete the work item after sending JMS message. But to properly troubleshoot the issue you would have to share your process definition so we could figure out where does it stop.

Maciej
--
You received this message because you are subscribed to the Google Groups "jBPM Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-developme...@googlegroups.com.
To post to this group, send email to jbpm-dev...@googlegroups.com.

Kay

unread,
Aug 15, 2017, 8:31:58 PM8/15/17
to jBPM Development, mao...@gmail.com, khirs...@huebinet.de
Thanks Keven and Maciej for your kind reply.

After adding "manager.completeWorkItem(workItem.getId(), parameters);"  it works. The workflow continues to the next task.

Regards,

Kay


Reply all
Reply to author
Forward
0 new messages