JBoss Community

Re: Create Custom Implementation for Human Task WorkItemHandler, Which class I should extend?

created by Timothy Charman in jBPM - View the full discussion

No, just the session manager.  There's a hook for contributing your own, see how the session manager instantiates a MVELSingleSessionManager if you don't give it one below.

 

We give it our own so we can add them programmatically rather than using the config file.  Our session manager does what the MVEL one does but doesn't use a template, it adds the task handlers in code.

 

 

 

    @SuppressWarnings("unchecked")

    public static SessionManager newSessionManager(KnowledgeBase kbase) {

        String sessionManager = System.getProperty("jbpm.session.manager");

        if (sessionManager == null) {

            return new MVELSingleSessionManager(kbase);

        }

       

        SessionManager sessionManagerInstance = null;

        try {

            // build session manager based on given class

            Class<SessionManager> sessionManagerClass = (Class<SessionManager>) Class.forName(sessionManager);

            Constructor<SessionManager> c = sessionManagerClass.getConstructor(KnowledgeBase.class);

            sessionManagerInstance = c.newInstance(kbase);

        } catch (Exception e) {

            throw new RuntimeException("Cannot create SessionManager from class " + sessionManager, e);

        }

       

        return sessionManagerInstance;

    }

Reply to this message by going to Community

Start a new discussion in jBPM at Community