How to use a bonita connector when creating a process programatically?

Hi

We are creating a process programatically, out-of-the box by using the bonita REST API via the bonita-client available in:

<bonita.bpm.version>7.0.0</bonita.bpm.version> .. <dependency> <groupId>org.bonitasoft.engine</groupId> <artifactId>bonita-client</artifactId> <version>${bonita.bpm.version}</version> </dependency>

We are able to create and deploy a simple process (and execute it via the bonita portal). However now we are trying to programatically create a service task with a REST connector call. To to it, we use:

ConnectorDefinitionBuilder connectorBuilder = automatctask.addConnector("CallRestDATA", "rest-get", "1.0.0", ConnectorEvent.ON_ENTER); connectorBuilder.ignoreError();

However we always get an error, and in bonita portal we can see the following message:

The Process cannot be enabled. Connectors must be resolved before enabling the Process.

Intuitively, we have tried to instantiate a ConnectorDescriptor but we don’t know to link with the task. We couldn’t find in the documentation any example. Do you have any hint?

Thanks in advance.

1 Like

Have you added the correct code to

Add resource:

BusinessArchiveBuilder.addClasspathResource(org.bonitasoft.engine.bpm.bar.BarResource)

Add connector implementation

BusinessArchiveBuilder.addConnectorImplementation(org.bonitasoft.engine.bpm.bar.BarResource)

regards
Seán

PS: As this reply offers an answer your question, and if you like it, please Mark UP or as Resolved.

Dear,

Sean McP, thanks for your response. We have put an example of how to do it, here:

https://github.com/jozemi/bonita.explore/blob/master/src/main/java/com/xerox/explore/bonita/api/ProcessWithConnectorExample.java

Maybe this can be helpful for other people.

Thanks.