Cannot add a custom REST service to a Spring Boot Camunda app

Hi all,

I was able to build a Spring Boot App with embedded Camunda. It’s super and works pretty well.

I have been trying to add a RestService of mine which should act like a sort of adapter with my custom Rest Api.
image

image

Unfortunately the new Service is ignored as all requests are intercepted by the Camunda WebApps and I get a 404…
image

I read you can deactivate the default forwarding to app by means of something like:
image
but that doesn’t solve my problem…

I think one should get it by implementing something like in the default rest App:
image

I didn’t find anything in the documentation and I suppose that’s not the right way to solve it…

Do you have any tip?
Thank you very much
Fabio

Hi all,

I believe I can get this conversion in a TaskListener done…The message is intercepted and variables converted…So I can use the standard Camunda Rest API. :grinning:

Regards
Fabio

Hi @Fabio_Salvi,

To register your custom controller class, extend the class CamundaJerseyResourceConfig

@Configuration
@ApplicationPath("/camundabpmserver")
public class CamundaJerseyConfig extends CamundaJerseyResourceConfig {

  @Override
  public void afterPropertiesSet() throws Exception {
    registerCamundaRestResources();
    registerAdditionalResources();
  }

  @Override
  protected void registerCamundaRestResources() {
    log.info("Configuring camunda rest api.");
    this.registerClasses(CamundaRestResources.getResourceClasses());
    this.registerClasses(CamundaRestResources.getConfigurationClasses());
    this.register(JacksonFeature.class);
    this.registerClasses(CustomTaskListController.class);
    CamundaRestResources.getResourceClasses().add(CustomTaskListController.class);
    log.info("Finished configuring camunda rest api.");
  }

  @Override
  protected void registerAdditionalResources() {
    register(CustomTaskListController.class);
    CamundaRestResources.getResourceClasses().add(CustomTaskListController.class);
  }
}

And register the above class to Jersey auto configuration like below:

@AutoConfigureBefore({ JerseyAutoConfiguration.class })
@AutoConfigureAfter({ CamundaBpmAutoConfiguration.class })
public class CamundaRestJerseyAutoConfiguration extends CamundaBpmRestJerseyAutoConfiguration {

  @Override
  @Bean
  @ConditionalOnMissingBean(CamundaJerseyConfig.class)
  public CamundaJerseyConfig createRestConfig() {
    return new CamundaJerseyConfig();
  }

}

Refer this example:

1 Like

Hi aravindhrs

super! Thank you very much!

Bye
Fabio

@Fabio_Salvi Great :blush: