Help needed: Analytics Builder custom block calling Cumulocity microservice

Hi everyone,

I’m currently working on integrating a custom microservice with an Analytics Builder custom block in Cumulocity, and I would really appreciate some guidance or examples.

:wrench: What I’m trying to achieve

I have:

  • A Node.js microservice deployed in Cumulocity (/service/temp-classifier)
  • A custom Analytics Builder block written in EPL

The goal is:
:right_arrow: From the custom block, send an HTTP request to the microservice
:right_arrow: Receive a JSON response
:right_arrow: Use the response inside the block logic


:white_check_mark: Microservice (working)

The microservice exposes:

  • GET /health → returns { "status": "UP" }
  • POST /classify → accepts:
{ "temperature": 40 }

returns:

{ "category": "Hot" }

:cross_mark: Issue

I’m facing multiple issues when integrating from the custom block:

  1. Runtime errors like:

    • Unexpected termination of monitor
  2. JSON parsing issues in EPL

  3. Difficulty handling async HTTP responses properly

  4. apama-ctrl readiness probe failures (503)


:test_tube: Current EPL approach (simplified)

Request req := cumulocity.createRequest(
    "POST",
    "/service/temp-classifier/classify",
    body
);

req.execute(handleResponse);

:red_question_mark: My questions

  1. What is the recommended pattern to call a microservice from an Analytics Builder block?
  2. How should I properly handle asynchronous HTTP responses in EPL?
  3. Is there an official or best-practice example for this use case?
  4. Are there known limitations when calling microservices from Analytics Builder blocks?

:folded_hands: What I’m looking for

  • A minimal working example (EPL + microservice call)
  • Best practices for stability (avoiding monitor crashes)
  • Any documentation or sample projects

Thanks in advance for your help! :raising_hands:

HI,

there is a complete example to do rest requests in the contrib repository:

In general, I would recommend to run the block locally using Pysys tests before deploying to Cumulocity. The project also includes 4 tests for this block:

The SDK documentation explains how to write your own tests:

1 Like