/** * This method looks up in the statestore for cluster information for a given key. * * @param vpc VPC of the region that the cluster belongs to. Eg: us-east-1-vpc-defa0000 * @param env Environment the cluster belongs to * @param hint Additional information that works in combination with vpc * @param actorType Type that defines if the operation is happening for a producer or consumer * @return ClusterValue * @throws ClusterNotFoundException thrown if no cluster is found in the region */ protected ClusterValue getClusterDetails(String vpc, String env, String hint, String actorType) throws ClusterNotFoundException { log.info("Cluster Details: vpc: {}, env: {}, hint: {}, actorType: {}", vpc, env, hint, actorType); ClusterKey clusterKey = new ClusterKey(vpc, env, hint, null); Optional<ClusterValue> clusterValue = infraManager.getClusterByKey(clusterKey); if (clusterValue.isPresent()) { log.info("Cluster Information found - {}", clusterValue); return clusterValue.get(); } // If no cluster information is found set the actorType and look again. clusterKey.setType(actorType); clusterValue = infraManager.getClusterByKey(clusterKey); if (clusterValue.isPresent()) { log.info("Cluster Information found - {}", clusterValue); return clusterValue.get(); } else { log.info("Cluster Information not found for key - {}", clusterKey); throw new ClusterNotFoundException(clusterKey.toString()); } }