Skip to content

Failed to get TLS config. Continuing without TLS." error="No TLS config provided. ,cannot create a kafka writer with a nil address #84

@kusumkappdirect

Description

@kusumkappdirect

My configuration fille is :
export var configuration = JSON.stringify({
"producer": {
"keySerializer": "org.apache.kafka.common.serialization.StringSerializer",
"valueSerializer": "io.confluent.kafka.serializers.KafkaAvroSerializer",
},
"schemaRegistry": {
"url": __ENV.KAFKA_CONFLUENT_SCHEMA_REGISTRY_URL
},
});

Script file is::
import { check } from "k6";
import {
writer,
produceWithConfiguration,
createTopic
} from "k6/x/kafka";

import {configuration} from "./configuration.js"

const bootstrapServers = [__ENV.KAFKA_BOOTSTRAP_SERVERS];
const topic = "quotes-test.itg-load.default";

const username = __ENV.KAFKA_USERNAME;
const password = __ENV.KAFKA_PASSWORD;
const protocol = __ENV.KAFKA_SECURITY_PROTOCOL;
console.log("protocol is :"+protocol);

const auth = JSON.stringify({
username: username,
password: password,
algorithm: "PLAIN"
});

const producer = writer( bootstrapServers, topic, auth);

const valueSchema = { "type": "record", "namespace": "com.appdirect.prm.quotes.event", "name": "QuoteStatusChanged", "fields": [ { "name": "previousStatus", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "eventMetadata", "type": { "fields": [ { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "timestamp", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "type", "type": { "avro.java.string": "String", "type": "string" } }, { "default": null, "name": "operation", "type": [ "null", { "avro.java.string": "String", "type": "string" } ] } ], "name": "EventMetadata", "namespace": "com.appdirect.common.event", "type": "record" } }, { "name": "quote", "type": { "fields": [ { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "default": null, "name": "name", "type": [ "null", { "avro.java.string": "String", "type": "string" } ] }, { "name": "createdOn", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "tenant", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "ownerUser", "type": { "fields": [ { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "company", "type": { "fields": [ { "name": "name", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "isReseller", "type": "boolean" } ], "name": "Company", "type": "record" } }, { "name": "email", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "firstName", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "lastName", "type": { "avro.java.string": "String", "type": "string" } } ], "name": "User", "type": "record" } }, { "name": "source", "type": { "fields": [ { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "sourceType", "type": { "avro.java.string": "String", "type": "string" } } ], "name": "Source", "type": "record" } }, { "name": "customerUser", "type": "User" }, { "name": "createdBy", "type": "User" }, { "name": "status", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "displayId", "type": { "avro.java.string": "String", "type": "string" } } ], "name": "Quote", "type": "record" } } ] };

export default function () {
console.log("BootServer connected"+bootstrapServers);
const schemaConfig=__ENV.KAFKA_CONFLUENT_SCHEMA_REGISTRY_URL;
console.log("schema connected"+schemaConfig);

    let messages = [
        {
            key: "546e3fa1-3c42-46f5-8a39-be3d0a01450",
            value: JSON.stringify({
                "eventMetadata": {
                    "id": "365ea153-5011-4692-b677-d4e667013488",
                    "timestamp": "2022-04-22T05:44:56+00:00",
                    "type": "QuoteStatusChanged",
                    "operation": null
                },
                "quote":{
                    "id": "c4cfcd3c-090f-4770-91eb-aed66daf5d08",
                    "name":null,
                    "createdOn": "2022-04-22T05:44:51.762Z",
                    "tenant": "ITGDI",
                    "ownerUser":{
                        "id":"kusum",
                        "company": {
                            "id":"123",
                            "name": "1630556e-3e55-4ac9-8078-956ea525fcbc",
                            "isReseller":true
                        },
                        "email": "kusum.khandelwal+itgdi@appdirect.com",
                        "firstName": "MM",
                        "lastName": "NAME CHANGE"
                    },
                    "customerUser": {
                        "id": "9df5537f-148d-4f55-a57f-6572d3d90832",
                        "company": {
                            "id": "ecfd1e97-6785-4096-850a-6977e733817e",
                            "name": "ABC Enterprises",
                            "isReseller": false
                        },
                        "email": "kusum.khandelwal+c2@appdirect.com",
                        "firstName": "Company",
                        "lastName": "1"
                    },
                    "createdBy": {
                        "id": "80d36759-ba84-46d5-a7f2-4fa9740b1585",
                        "company": {
                            "id": "1630556e-3e55-4ac9-8078-956ea525fcbc",
                            "name": "AppDirect",
                            "isReseller": false
                        },
                        "email": "kusum.khandelwal+itgdi@appdirect.com",
                        "firstName": "MM",
                        "lastName": "NAME CHANGE"
                    },

                    "source": {
                        "id": "3eb68099-f05e-4040-86e5-842c3168f105",
                        "sourceType": "OPPORTUNITY"
                    },
                    "status": "PENDING",

                    "displayId": "Q6000678"
                },

                "previousStatus": "OPEN"
            })
        }];
    let error = produceWithConfiguration(
        producer,
        messages,
        configuration,
        null,
        valueSchema
    );
    check(error, {
        "is sent": (err) => err == undefined,
    });

}
export function teardown( data ) {
producer.close();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    2️⃣ DuplicateThis issue or pull request already exists🐛 BugSomething isn't working

    Projects

    Status

    Release

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions