@Override
    public void processRestApiCallToRuleEngine(TenantId tenantId, UUID requestId, TbMsg request, boolean useQueueFromTbMsg, Consumer<TbMsg> responseConsumer) {
        log.trace("[{}] Processing REST API call to rule engine: [{}] for entity: [{}]", tenantId, requestId, request.getOriginator());
        requests.put(requestId, responseConsumer);
        sendRequestToRuleEngine(tenantId, request, useQueueFromTbMsg);
        scheduleTimeout(request, requestId, requests);
    }
@Test
    void givenRequest_whenProcessRestApiCallToRuleEngine_thenPushMsgToRuleEngineAndCheckRemovedDueTimeout() {
        long timeout = 1L;
        long expTime = System.currentTimeMillis() + timeout;
        HashMap<String, String> metaData = new HashMap<>();
        UUID requestId = UUID.randomUUID();
        metaData.put("serviceId", "core");
        metaData.put("requestUUID", requestId.toString());
        metaData.put("expirationTime", Long.toString(expTime));
        TbMsg msg = TbMsg.newMsg(DataConstants.MAIN_QUEUE_NAME, TbMsgType.REST_API_REQUEST, TENANT_ID, new TbMsgMetaData(metaData), "{\"key\":\"value\"}");

        Consumer<TbMsg> anyConsumer = TbMsg::getData;
        doAnswer(invocation -> {
            //check the presence of request in the map after pushMsgToRuleEngine()
            assertThat(requests.size()).isEqualTo(1);
            assertThat(requests.get(requestId)).isEqualTo(anyConsumer);
            return null;
        }).when(tbClusterServiceMock).pushMsgToRuleEngine(any(), any(), any(), anyBoolean(), any());
        ruleEngineCallService.processRestApiCallToRuleEngine(TENANT_ID, requestId, msg, true, anyConsumer);

        verify(tbClusterServiceMock).pushMsgToRuleEngine(TENANT_ID, TENANT_ID, msg, true, null);
        //check map is empty after scheduleTimeout()
        Awaitility.await("Await until request was deleted from map due to timeout")
                .pollDelay(25, TimeUnit.MILLISECONDS)
                .atMost(10, TimeUnit.SECONDS)
                .until(requests::isEmpty);
    }