-
1. Re: CDI-based WorkItemHandler deployment using KIE Workbench
swiderski.maciej Dec 9, 2013 1:50 AM (in response to jay.guidos-bidstrading.com)1 of 1 people found this helpfulin general, I would recommend following approach:
1. have the kjar that contains only the business assets
2. have separate jar that contains the handler which is considered technical asset
3. both should be maven based modules to simplify usage of them
4. for CDI based handlers add beans.xml into the handlers jar and provide WorkItemHandlerProducer to create instances of the handler when asked by the workbench. when you look at the producer interface you'll see it provides some parameters and one of the parameters will be runtime manager so you can use it within your handler
5. use maven to build the modules (clean install)
6. place you handler jar on workbench classpath (WEB-INF/lib)
7. use deployments view to deploy kjar into workbench by specifying GAV
and that should allow you to successfully run your processes with CDI based handlers. Please note that you can use non CDI based handler as well where you would use the "old" way to register handlers via conf file (drools.session.conf and CustomWorkItemHandlers.conf).
HTH
-
2. Re: CDI-based WorkItemHandler deployment using KIE Workbench
jay.guidos-bidstrading.com Dec 9, 2013 2:14 PM (in response to swiderski.maciej)Hi Maciej!
Steps 1-5 make perfect sense, I had already guessed that, which is a good indication of how intuitive the new deployment approach is.
For step 6, how do I put my KJars on the workbench classpath? I was going to just make them dependencies of my main project POM, which I am allowed to edit directly from the workbench. That isn't good enough?
For 7, I have already tried deploying into the workbench manually via its GAV, and that works OK. If I use the same GAV twice (i.e. do a redeploy) it does not do a replace, it appends something to the jar name and I get two deployments with the same GAV. How does the workbench decide which one to use? And also, there doesn't seem to be any way to delete a deployment via the GUI, how to delete old deployments?
Also, I thought it would be good to have my work hander jar deploy itself to the workbench maven repo during my builds. I added the repo location to my pom and added a <server> entry in my settings.xml, but I always get a permission denied error from Maven. Is this supported? I was using krisv/krisv, which works from the GUI.
Jay
-
3. Re: CDI-based WorkItemHandler deployment using KIE Workbench
swiderski.maciej Dec 10, 2013 2:25 AM (in response to jay.guidos-bidstrading.com)1 of 1 people found this helpfulJay Guidos wrote:
Hi Maciej!
Steps 1-5 make perfect sense, I had already guessed that, which is a good indication of how intuitive the new deployment approach is.
For step 6, how do I put my KJars on the workbench classpath? I was going to just make them dependencies of my main project POM, which I am allowed to edit directly from the workbench. That isn't good enough?
I mentioned two jars involved here:
1. kjar that consists fo business assets like processes and rules, etc
2. handler that consists of technical components like work item handler, listeners, etc
so the first is deployed in maven repo and then you use deployments view to put it on jbpm runtime, second usually is directly placed on classpath of jbpm console (jbpm-console.war/WEB-INF/lib). Alternatively you can make a reference to it via pom as well, although it makes it only scoped to the given kjar only and you cannot use "global" ways to register handler on the ksession - like using CDI producer or conf files.
Jay Guidos wrote:
For 7, I have already tried deploying into the workbench manually via its GAV, and that works OK. If I use the same GAV twice (i.e. do a redeploy) it does not do a replace, it appends something to the jar name and I get two deployments with the same GAV. How does the workbench decide which one to use? And also, there doesn't seem to be any way to delete a deployment via the GUI, how to delete old deployments?
on deployments view there are icons on the right hand side where one of them allows to remove deployments, with limitation that no active process instances can be present while removing it.
Jay Guidos wrote:
Also, I thought it would be good to have my work hander jar deploy itself to the workbench maven repo during my builds. I added the repo location to my pom and added a <server> entry in my settings.xml, but I always get a permission denied error from Maven. Is this supported? I was using krisv/krisv, which works from the GUI.
Jay
there seems to be an issue with security settings for internal (jbpm) maven repo. Just for tests (and if that is ok from your project point of view) you could disable maven repo security in web.xml of jbpm-console web app.
HTH