/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2023 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.policy.models.sim.dmaap.provider;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response.Status;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.common.utils.services.ServiceManagerContainer;
List<String> lst = topic2data.computeIfAbsent(topicName, this::makeTopicData).read(consumerGroup, limit,
timeoutMs);
- if (lst.isEmpty() && timeoutMs > 0) {
- LOGGER.debug("Topic: {}, Timed out waiting for messages: {}: {}", topicName, consumerGroup, consumerId);
- return Response.status(Status.REQUEST_TIMEOUT).entity(lst).build();
-
- } else {
- LOGGER.debug("Topic: {}, Retrieved {} messages for: {}: {}", topicName, consumerGroup, lst.size(),
- consumerId);
- return Response.status(Status.OK).entity(lst).build();
- }
+ LOGGER.debug("Topic: {}, Retrieved {} messages for: {}: {}", topicName, lst.size(), consumerGroup,
+ consumerId);
+ return Response.status(Status.OK).entity(lst).build();
} catch (InterruptedException e) {
LOGGER.warn("Topic: {}, Request for DMaaP message interrupted: {}: {}", topicName, consumerGroup,
}
}
+ /**
+ * Returns the list of default topics.
+ *
+ * @return the topic list
+ */
+ public Response processDmaapTopicsGet() {
+
+ LOGGER.debug("Request for listing DMaaP topics");
+ var response = new DmaapGetTopicResponse();
+ response.setTopics(List.of("POLICY-PDP-PAP", "POLICY-NOTIFICATION", "unauthenticated.DCAE_CL_OUTPUT",
+ "POLICY-CL-MGT"));
+ return Response.status(Status.OK).entity(response).build();
+ }
+
/**
* Task to remove idle consumers from each topic.
*/