imranmomin/Hangfire.AzureDocumentDB

Getting migration issue when using azure cosmos db with hangfire

Closed this issue · 1 comments

var migrationOptions = new MongoMigrationOptions
{
Strategy = MongoMigrationStrategy.Migrate,
BackupStrategy = MongoBackupStrategy.Collections
};
var storageOptions = new MongoStorageOptions
{
MigrationOptions = migrationOptions,
ConnectionCheckTimeout = TimeSpan.FromSeconds(100),
MigrationLockTimeout=TimeSpan.FromSeconds(100)
};
// Azure cosomos db connection string GlobalConfiguration.Configuration.UseMongoStorage("mongodb://username:password@azure_url/?ssl=true&sslAllowInvalidCertificates=true", "ApplicationDatabase", storageOptions);

Error:
could not complete migration. Never acquired lock within allowed time: 00:01:00
Either another server did not complete the migration or migration was abruptly interrupted"

Just in case, if the above config is wrong, how to get the auth token below ( i have username and password from azure cosmos DB connections strings)
var storageOptions = new DocumentDbStorageOptions
{
ConnectionProtocol=Protocol.Https,
};
GlobalConfiguration.Configuration.UseAzureDocumentDbStorage("azuredburl", "what is this??", "ApplicationDatabase", "collectionname in cosmos db", storageOptions);

please let me know

U need to pass the primary key i.e authSecret

image