此内容没有您所选择的语言版本。

Chapter 14. CDI Integration


14.1. CDI Integration

To make use of jbpm-kie-services in your system, you will need to provide some mbeans to satisfy all dependencies of the services. There are several mbeans that depend on actual scenarios.

  • Entity manager and entity manager factory
  • User group callback for human tasks
  • Identity provider to pass authenticated user information to the services

When running in JEE environment, like JBoss Application Server, the mbean should satisfy all requirements of the jbpm-kie-services:

public class EnvironmentProducer {

    @PersistenceUnit(unitName = "org.jbpm.domain")
    private EntityManagerFactory emf;

    @Inject
    @Selectable
    private UserGroupCallback userGroupCallback;

    @Produces
    public EntityManagerFactory getEntityManagerFactory() {
        return this.emf;
    }

    @Produces
    @RequestScoped
    public EntityManager getEntityManager() {
        EntityManager em = emf.createEntityManager();
        return em;
    }

    public void close(@Disposes EntityManager em) {
        em.close();
    }

    @Produces
    public UserGroupCallback produceSelectedUserGroupCalback() {
        return userGroupCallback;
    }
    @Produces

    public IdentityProvider produceIdentityProvider {
        return new IdentityProvider() {
             // implement IdentityProvider
        };
    }
}
Copy to Clipboard Toggle word wrap

Then the deployments/business-central.war/WEB-INF/beans.xml file may be configured to change the current settings of the new usergroupcallback implementation:

<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://docs.jboss.org/cdi/beans_1_0.xsd">

<alternatives>
  <class>org.jbpm.services.task.identity.JAASUserGroupCallbackImpl</class>
</alternatives>

</beans>
Copy to Clipboard Toggle word wrap
Note

org.jbpm.services.task.identity.JAASUserGroupCallbackImpl is just an example here to demonstrate the settings of the application server regardless of what it actually is (LDAP, DB, etc).

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat