[ https://issues.apache.org/jira/browse/CAMEL-12964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16703250#comment-16703250 ]
ASF GitHub Bot commented on CAMEL-12964: ---------------------------------------- mswiderski commented on a change in pull request #2644: CAMEL-12964: Initial import of jBPM CamelWIH and Command. URL: https://github.com/apache/camel/pull/2644#discussion_r237504946 ########## File path: components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/InOutCamelWorkItemHandler.java ########## @@ -0,0 +1,119 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.camel.component.jbpm.workitem; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; +import org.apache.camel.Message; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.ExchangeBuilder; +import org.drools.core.process.instance.impl.WorkItemImpl; +import org.jbpm.process.workitem.core.util.Wid; +import org.jbpm.process.workitem.core.util.WidMavenDepends; +import org.jbpm.process.workitem.core.util.WidParameter; +import org.jbpm.process.workitem.core.util.WidResult; +import org.jbpm.process.workitem.core.util.service.WidAction; +import org.jbpm.process.workitem.core.util.service.WidService; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.process.WorkItem; +import org.kie.api.runtime.process.WorkItemHandler; +import org.kie.api.runtime.process.WorkItemManager; + +/** + * Camel jBPM {@link WorkItemHandler} that sends {@link Exchange Exchanges} with an <code>InOut</code> Message Exchange Pattern. + * <p/> + * This handler parses the response message from the given Camel route and completes the {@link WorkItem}. The use-case for this handler is + * synchronous, request-response style, communication. + * <p/> + * The handler creates a Camel Exchange and sets the {@link WorkItem} as the body of the {@link Message}. Furthermore, the following message + * headers are set: + * <ul> + * <li>deploymentId</li> + * <li>processInstanceId</li> + * <li>workItemId</li> + * </ul> + */ +@Wid( + widfile = "InOutCamelConnector.wid", + name = "InOutCamelConnector", + displayName = "InOutCamelConnector", + defaultHandler = "mvel: new org.apache.camel.component.jbpm.workitem.InOutCamelWorkitemHandler()", + documentation = "${artifactId}/index.html", + parameters = { + @WidParameter(name = "camel-endpoint-id") + }, + results = { + @WidResult(name = "response"), + @WidResult(name = "message") }, + mavenDepends = { + @WidMavenDepends(group = "${groupId}", + artifact = "${artifactId}", + version = "${version}") + }, + serviceInfo = @WidService(category = "${name}", + description = "${description}", + keywords = "apache,camel,payload,route,connector", + action = @WidAction(title = "Send payload to a Camel endpoint"))) +public class InOutCamelWorkItemHandler extends AbstractCamelWorkItemHandler { + + private static final String RESPONSE_PARAM = "response"; + private static final String MESSAGE_PARAM = "message"; Review comment: I guess these are used in the command as well so might be good to move them to JBPMConstants ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Create new CamelWIH to integrate with recently added Camel support in > jBPM/KIE-Server > -------------------------------------------------------------------------------------- > > Key: CAMEL-12964 > URL: https://issues.apache.org/jira/browse/CAMEL-12964 > Project: Camel > Issue Type: New Feature > Components: camel-jbpm > Affects Versions: 2.23.0 > Reporter: Duncan Doyle > Assignee: Maciej Swiderski > Priority: Major > > The new camel-jbpm component allows CamelContexts and Routes to be defined on > both a global (KIE-Server) and runtimeManager/deploymentUnit/KJAR level. A > new CamelWorkItemHandler that integrates with these CamelContexts and routes > would allow easy integration with external resources throuch Camel Components > from within a process/case definition. > See: https://issues.jboss.org/browse/JBPM-7995 -- This message was sent by Atlassian JIRA (v7.6.3#76005)