Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
validateType("hostName", hostName, true, "string");
validateType("namespace", namespace, true, "string");
validateType("eventHubPath", eventHubPath, true, "string");
validateType("credentials", credentials, true, "object");
validateType("checkpointManager", checkpointManager, true, "object");
validateType("leaseManager", leaseManager, true, "object");
validateType("options", options, false, "object");
if (!namespace.endsWith("/")) namespace += "/";
const connectionString =
`Endpoint=sb://${namespace};SharedAccessKeyName=defaultKeyName;` +
`SharedAccessKey=defaultKeyValue;EntityPath=${eventHubPath}`;
const ephOptions: EventProcessorHostOptions = {
...options,
tokenProvider: new AadTokenProvider(credentials),
eventHubPath: eventHubPath,
eventHubConnectionString: connectionString,
checkpointManager: checkpointManager,
leaseManager: leaseManager
};
return new EventProcessorHost(hostName, ephOptions);
}
validateType("hostName", hostName, true, "string");
validateType("storageConnectionString", storageConnectionString, true, "string");
validateType("storageContainerName", storageContainerName, true, "string");
validateType("namespace", namespace, true, "string");
validateType("eventHubPath", eventHubPath, true, "string");
validateType("credentials", credentials, true, "object");
validateType("options", options, false, "object");
if (!namespace.endsWith("/")) namespace += "/";
const connectionString =
`Endpoint=sb://${namespace};SharedAccessKeyName=defaultKeyName;` +
`SharedAccessKey=defaultKeyValue;EntityPath=${eventHubPath}`;
const ephOptions: EventProcessorHostOptions = {
...options,
tokenProvider: new AadTokenProvider(credentials),
storageConnectionString: storageConnectionString,
storageContainerName: storageContainerName,
eventHubPath: eventHubPath,
eventHubConnectionString: connectionString
};
return new EventProcessorHost(hostName, ephOptions);
}