Source:
<code>public SubscriptionManager subscriptionManager(GlobalPropertiesRepo globalPropertiesRepo, final List<AccountComponentCache<?>> componentCaches, String appName) { try { GlobalProperties props = globalPropertiesRepo.findAll().get(0); String queueName = "node-queue-" + appName + "-" + Inet4Address.getLocalHost().getHostName().replace(".", "_"); SubscriptionManager subscriptionManager; <START> if (props.getNotifierType().equalsIgnoreCase("RABBITMQ")) { <END> subscriptionManager = new RabbitMQSubscriptionManager(props.getRabbitmqHost(), props.getRabbitmqPort(), props.getRabbitmqVhost(), props.getRabbitmqExchange(), props.getRabbitmqUsername(), props.getRabbitmqPassword(), queueName); } else { subscriptionManager = new SnsSubscriptionManager(AmazonSQSClientBuilder.defaultClient(), AmazonSNSClientBuilder.defaultClient(), props.getInstanceNotificationTopicArn(), queueName); } subscriptionManager.addListener(new MessageListener() { @Override public void onMessage(Message message) { log.info("message received: " + message); log.debug("message body: " + message.getBody()); JsonFactory factory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(factory); TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() { }; String body = message.getBody(); try { Map<String, String> map = mapper.readValue(body, typeRef); AccountChangeEvent event = AccountChangeEvent.deserialize(map.get("Message")); for (AccountComponentCache<?> cache : componentCaches) { cache.onEvent(event); } } catch (IOException e) { log.warn("unable to dispatch message: " + message + " : " + e.getMessage(), e); } } @Override public void onMessage(String message) { log.info("message received: " + message); try { AccountChangeEvent event = AccountChangeEvent.deserialize(message); for (AccountComponentCache<?> cache : componentCaches) { cache.onEvent(event); } } catch (Exception e) { log.warn("unable to dispatch message: " + message + " : " + e.getMessage(), e); } } }); return subscriptionManager; } catch (UnknownHostException e) { throw new DuraCloudRuntimeException(e); } }</code><technical_language>String RABBITMQ is in places. Enum for NotifierType (that includes types) a constant</technical_language>

Target:
public SubscriptionManager subscriptionManager(GlobalPropertiesRepo globalPropertiesRepo, final List<AccountComponentCache<?>> componentCaches, String appName) { try { GlobalProperties props = globalPropertiesRepo.findAll().get(0); String queueName = "node-queue-" + appName + "-" + Inet4Address.getLocalHost().getHostName().replace(".", "_"); SubscriptionManager subscriptionManager; NotifierType notifierType = NotifierType.fromString(props.getNotifierType()); if (notifierType == NotifierType.RABBITMQ) { subscriptionManager = new RabbitMQSubscriptionManager(props.getRabbitmqHost(), props.getRabbitmqPort(), props.getRabbitmqVhost(), props.getRabbitmqExchange(), props.getRabbitmqUsername(), props.getRabbitmqPassword(), queueName); } else { subscriptionManager = new SnsSubscriptionManager(AmazonSQSClientBuilder.defaultClient(), AmazonSNSClientBuilder.defaultClient(), props.getInstanceNotificationTopicArn(), queueName); } subscriptionManager.addListener(new MessageListener() { @Override public void onMessage(Message message) { log.info("message received: " + message); log.debug("message body: " + message.getBody()); JsonFactory factory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(factory); TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() { }; String body = message.getBody(); try { Map<String, String> map = mapper.readValue(body, typeRef); AccountChangeEvent event = AccountChangeEvent.deserialize(map.get("Message")); for (AccountComponentCache<?> cache : componentCaches) { cache.onEvent(event); } } catch (IOException e) { log.warn("unable to dispatch message: " + message + " : " + e.getMessage(), e); } } @Override public void onMessage(String message) { log.info("message received: " + message); try { AccountChangeEvent event = AccountChangeEvent.deserialize(message); for (AccountComponentCache<?> cache : componentCaches) { cache.onEvent(event); } } catch (Exception e) { log.warn("unable to dispatch message: " + message + " : " + e.getMessage(), e); } } }); return subscriptionManager; } catch (UnknownHostException e) { throw new DuraCloudRuntimeException(e); } }