nstream.adapter.common.ext.NatsIngressSettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nstream-adapter-common Show documentation
Show all versions of nstream-adapter-common Show documentation
General server-side data flow templates with Swim
// Copyright 2015-2024 Nstream, inc.
//
// Licensed under the Redis Source Available License 2.0 (RSALv2) Agreement;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://redis.com/legal/rsalv2-agreement/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package nstream.adapter.common.ext;
import nstream.adapter.common.AdapterSettings;
import swim.codec.Format;
import swim.codec.Output;
import swim.structure.Form;
import swim.structure.Kind;
import swim.structure.Tag;
import swim.structure.Value;
/**
* Provides a concrete class to parse and store agent configuration
* used for NATS JetStream ingress by {@code nstream.adapter.nats.NatsIngestingAgent} and
* {@code NatsIngestingPatch}.
*/
@Tag("natsIngressSettings")
public class NatsIngressSettings implements AdapterSettings {
private static final NatsIngressSettings DEFAULT = new NatsIngressSettings();
@Kind
private static Form form;
private final String connectionProvisionName;
// private final String consumerConfigurationProvisionName;
// private final String pullSubscriberOptionsProvisionName;
private final String natsIngressSubjectName;
private final String natsIngressStreamName;
private final String contentTypeOverride;
private final Value relaySchema;
public NatsIngressSettings(String connectionProvisionName,
String natsIngressSubjectName, String natsIngressStreamName,
String contentTypeOverride, Value relaySchema) {
this.connectionProvisionName = connectionProvisionName;
this.natsIngressSubjectName = natsIngressSubjectName;
this.natsIngressStreamName = natsIngressStreamName;
this.contentTypeOverride = contentTypeOverride;
this.relaySchema = relaySchema;
}
public NatsIngressSettings() {
this("natsConnectionProvision", "UndefinedStream", "UndefinedSubject", null, null);
}
public static Form form() {
if (NatsIngressSettings.form == null) {
NatsIngressSettings.form = Form.forClass(NatsIngressSettings.class);
}
return NatsIngressSettings.form;
}
public static NatsIngressSettings defaultSettings() {
return NatsIngressSettings.DEFAULT;
}
public String getConnectionProvisionName() {
return this.connectionProvisionName;
}
/**
* Name of the Subject name to be used for ingestion.
*
* @return the Subject name string
*/
public String getNatsIngressSubjectName() {
return this.natsIngressSubjectName;
}
/**
* Name of the Stream name to be used for ingestion.
*
* @return the Stream name string
*/
public String getNatsIngressStreamName() {
return this.natsIngressStreamName;
}
public String contentTypeOverride() {
return this.contentTypeOverride;
}
public Value relaySchema() {
return this.relaySchema;
}
@Override
public Output debug(Output output) {
output = output.write("NatsIngressSettings").write('.').write("of").write('(').write(')')
.write('.').write("connectionProvisionName").write('(').debug(this.connectionProvisionName).write(')')
.write('.').write("natsIngressStreamName").write('(').debug(this.natsIngressStreamName).write(')')
.write('.').write("natsIngressSubjectName").write('(').debug(this.natsIngressSubjectName).write(')')
.write('.').write("contentTypeOverride").write('(').debug(this.contentTypeOverride).write(')')
.write('.').write("relaySchema").write('(').debug(this.relaySchema).write(')');
return output;
}
@Override
public String toString() {
return Format.debug(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy