JBoss Community

Re: understanding taskclient

created by Diduch Cordova in jBPM - View the full discussion

I AM WORKING WITH THIS... IN THE PROPERTIES OF THE EMAIL SERVICE TASK, I FILLED TO,SUBJECT,FROM AND BODY... WHEN I RUNNING DE PROCESS IN DEBUG.. THE PROCESS COMES TO THE EMAIL TASK BUT DONT SEND THE EMAIL AND DONT PASS TO NEXT USER TASK....

 

public static final void main(String[] args) {

        try {

            // load up the knowledge base

            KnowledgeBase kbase = readKnowledgeBase();

            StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

            KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);

            ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());

            // start a new process instance           

            Map<String, Object> params = new HashMap<String, Object>();

            params.put("employee", "krisv");

            EmailWorkItemHandler handler = new EmailWorkItemHandler("smtp.gmail.com", "465", "user@gmail.com","password");

            ksession.getWorkItemManager().registerWorkItemHandler("Email", handler);

            ksession.startProcess("com.sample.evaluation", params);   

            logger.close();

        } catch (Throwable t) {

            t.printStackTrace();

        }

    }

 

    private static KnowledgeBase readKnowledgeBase() throws Exception {

        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

        kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"), ResourceType.BPMN2);       

        return kbuilder.newKnowledgeBase();

    }

Reply to this message by going to Community

Start a new discussion in jBPM at Community