private void parseTopics() { if (state.getProperty(TOPIC_LIST) != null) { byte[] data = base64.decodeBase64(state.getProperty(TOPIC_LIST)); BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(data, null); SpecificDatumReader<Topic> avroReader = new SpecificDatumReader<>(Topic.class); try { // NOSONAR Topic decodedTopic; while (!decoder.isEnd()) { decodedTopic = avroReader.read(null, decoder); LOG.debug("Loaded {}", decodedTopic); topicMap.put(decodedTopic.getId(), decodedTopic); } } catch (Exception e) { LOG.error("Unexpected exception occurred while reading information from decoder", e); } } else { LOG.info("No topic list found in state"); } }
@Override public void addTopic(Topic topic) { if (topicMap.get(topic.getId()) == null) { topicMap.put(topic.getId(), topic); if (topic.getSubscriptionType() == SubscriptionType.MANDATORY_SUBSCRIPTION) { nfSubscriptions.put(topic.getId(), 0); LOG.info("Adding new seqNumber 0 for {} subscription", topic.getId()); } hasUpdate = true; LOG.info("Adding new topic with id {}", topic.getId()); } }