actorBuilder.setName(actor.getName()); actorBuilder.setRegionStreamConfigurations(actor.getRegionStreamConfigurations()); actorBuilder.setRegionStreamConfigurations(new ArrayList<>()); Map<String, String> configMap = new HashMap<>(); new RegionStreamConfiguration(region, clusterName.get(), topics, configMap); actorBuilder.getRegionStreamConfigurations().add(regionStreamConfiguration); } else if (operation.equalsIgnoreCase(OPERATION.UPDATE.name())) { for (RegionStreamConfiguration regionStreamConfiguration : actor.getRegionStreamConfigurations()) { actor.getName(), region, bootstrapServers, schemaRegistryURL, hint, clusterName); return actorBuilder.build();
/** * Creates a Builder by copying an existing Builder. * @param other The existing Builder to copy. */ private Builder(com.homeaway.digitalplatform.streamregistry.Actor.Builder other) { super(other); if (isValidValue(fields()[0], other.name)) { this.name = data().deepCopy(fields()[0].schema(), other.name); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.regionStreamConfigurations)) { this.regionStreamConfigurations = data().deepCopy(fields()[1].schema(), other.regionStreamConfigurations); fieldSetFlags()[1] = true; } }
@Override @SuppressWarnings("unchecked") public Actor build() { try { Actor record = new Actor(); record.name = fieldSetFlags()[0] ? this.name : (java.lang.String) defaultValue(fields()[0]); record.regionStreamConfigurations = fieldSetFlags()[1] ? this.regionStreamConfigurations : (java.util.List<com.homeaway.digitalplatform.streamregistry.RegionStreamConfiguration>) defaultValue(fields()[1]); return record; } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
private Optional<com.homeaway.streamplatform.streamregistry.model.Consumer> createConsumer(AvroStream avroStream, String consumerName, String region) { log.info("==>>> getting into creating consumer. Initial Stream: {}", avroStream.toString()); if (!regionDao.getSupportedRegions(avroStream.getTags().getHint()).contains(region)) throw new UnknownRegionException(region); List<com.homeaway.digitalplatform.streamregistry.Consumer> listConsumers = avroStream.getConsumers(); if (listConsumers == null) { listConsumers = new ArrayList<>(); } com.homeaway.digitalplatform.streamregistry.Consumer consumer = com.homeaway.digitalplatform.streamregistry.Consumer .newBuilder() .setActor(Actor.newBuilder() .setName(consumerName) .build()) .build(); String streamHint = avroStream.getTags().getHint(); String hint = (streamHint == null || streamHint.trim().matches("(?i:string)?")) ? AbstractDao.PRIMARY_HINT : streamHint.trim().toLowerCase(); Actor actor = populateActorStreamConfig(avroStream.getName(), region, consumer.getActor(), OPERATION.CREATE.name(), TOPIC_POST_FIXES, hint, ACTOR_TYPE, avroStream.getTopicConfig()); consumer = Consumer.newBuilder() .setActor(actor) .build(); listConsumers.add(consumer); avroStream.setConsumers(listConsumers); updateAvroStream(avroStream); return Optional.of(AvroToJsonDTO.getJsonConsumer(consumer)); }
private Optional<com.homeaway.streamplatform.streamregistry.model.Producer> registerProducer(AvroStream avroStream, String producerName, String region) { if (!regionDao.getSupportedRegions(avroStream.getTags().getHint()).contains(region)) throw new UnknownRegionException(region); List<com.homeaway.digitalplatform.streamregistry.Producer> listProducers = avroStream.getProducers(); if (listProducers == null) { listProducers = new ArrayList<>(); } com.homeaway.digitalplatform.streamregistry.Producer producer = com.homeaway.digitalplatform.streamregistry.Producer.newBuilder() .setActor(Actor.newBuilder() .setName(producerName) .build()) .build(); String streamHint = avroStream.getTags().getHint(); String hint = (streamHint == null || streamHint.trim().matches("(?i:string)?")) ? AbstractDao.PRIMARY_HINT : streamHint.trim().toLowerCase(); Actor actor = populateActorStreamConfig(avroStream.getName(), region, producer.getActor(), OPERATION.CREATE.name(), topicPostFixes, hint, ACTOR_TYPE, avroStream.getTopicConfig()); Producer newProducer = com.homeaway.digitalplatform.streamregistry.Producer.newBuilder() .setActor(actor) .build(); listProducers.add(newProducer); avroStream.setProducers(listProducers); updateAvroStream(avroStream); return Optional.of(AvroToJsonDTO.getJsonProducer(newProducer)); }
@Override @SuppressWarnings("unchecked") public Consumer build() { try { Consumer record = new Consumer(); if (actorBuilder != null) { record.actor = this.actorBuilder.build(); } else { record.actor = fieldSetFlags()[0] ? this.actor : (com.homeaway.digitalplatform.streamregistry.Actor) defaultValue(fields()[0]); } return record; } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
@Override @SuppressWarnings("unchecked") public Producer build() { try { Producer record = new Producer(); if (actorBuilder != null) { record.actor = this.actorBuilder.build(); } else { record.actor = fieldSetFlags()[0] ? this.actor : (com.homeaway.digitalplatform.streamregistry.Actor) defaultValue(fields()[0]); } return record; } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
/** * Creates a Builder by copying an existing Actor instance * @param other The existing instance to copy. */ private Builder(com.homeaway.digitalplatform.streamregistry.Actor other) { super(SCHEMA$); if (isValidValue(fields()[0], other.name)) { this.name = data().deepCopy(fields()[0].schema(), other.name); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.regionStreamConfigurations)) { this.regionStreamConfigurations = data().deepCopy(fields()[1].schema(), other.regionStreamConfigurations); fieldSetFlags()[1] = true; } }
/** * Checks whether the 'name' field has been set. * * Application name of the actor * @return True if the 'name' field has been set, false otherwise. */ public boolean hasName() { return fieldSetFlags()[0]; }
/** * Creates a new Actor RecordBuilder by copying an existing Builder. * @param other The existing builder to copy. * @return A new Actor RecordBuilder */ public static com.homeaway.digitalplatform.streamregistry.Actor.Builder newBuilder(com.homeaway.digitalplatform.streamregistry.Actor.Builder other) { return new com.homeaway.digitalplatform.streamregistry.Actor.Builder(other); }
/** * Sets the value of the 'name' field. * * Application name of the actor * @param value The value of 'name'. * @return This builder. */ public com.homeaway.digitalplatform.streamregistry.Actor.Builder setName(java.lang.String value) { validate(fields()[0], value); this.name = value; fieldSetFlags()[0] = true; return this; }
/** * Clears the value of the 'name' field. * * Application name of the actor * @return This builder. */ public com.homeaway.digitalplatform.streamregistry.Actor.Builder clearName() { name = null; fieldSetFlags()[0] = false; return this; }
/** * Creates a new Actor RecordBuilder by copying an existing Actor instance. * @param other The existing instance to copy. * @return A new Actor RecordBuilder */ public static com.homeaway.digitalplatform.streamregistry.Actor.Builder newBuilder(com.homeaway.digitalplatform.streamregistry.Actor other) { return new com.homeaway.digitalplatform.streamregistry.Actor.Builder(other); }
/** * Checks whether the 'regionStreamConfigurations' field has been set. * * Stream configuration key/value map * @return True if the 'regionStreamConfigurations' field has been set, false otherwise. */ public boolean hasRegionStreamConfigurations() { return fieldSetFlags()[1]; }
/** * Sets the value of the 'regionStreamConfigurations' field. * * Stream configuration key/value map * @param value The value of 'regionStreamConfigurations'. * @return This builder. */ public com.homeaway.digitalplatform.streamregistry.Actor.Builder setRegionStreamConfigurations(java.util.List<com.homeaway.digitalplatform.streamregistry.RegionStreamConfiguration> value) { validate(fields()[1], value); this.regionStreamConfigurations = value; fieldSetFlags()[1] = true; return this; }
/** * Clears the value of the 'regionStreamConfigurations' field. * * Stream configuration key/value map * @return This builder. */ public com.homeaway.digitalplatform.streamregistry.Actor.Builder clearRegionStreamConfigurations() { regionStreamConfigurations = null; fieldSetFlags()[1] = false; return this; }
/** * Creates a new Actor RecordBuilder. * @return A new Actor RecordBuilder */ public static com.homeaway.digitalplatform.streamregistry.Actor.Builder newBuilder() { return new com.homeaway.digitalplatform.streamregistry.Actor.Builder(); }