本文整理汇总了C#中JobHost.RunAndBlock方法的典型用法代码示例。如果您正苦于以下问题:C# JobHost.RunAndBlock方法的具体用法?C# JobHost.RunAndBlock怎么用?C# JobHost.RunAndBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JobHost
的用法示例。
在下文中一共展示了JobHost.RunAndBlock方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
CreateDemoData();
JobHost host = new JobHost();
host.RunAndBlock();
}
示例2: Run
public static void Run(string connectionString)
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
CreateTestQueues(queueClient);
try
{
CloudQueue firstQueue = queueClient.GetQueueReference(_nameResolver.ResolveInString(FunctionChainingPerfTest.FirstQueueName));
firstQueue.AddMessage(new CloudQueueMessage("Test"));
_startBlock = MeasurementBlock.BeginNew(0, HostStartMetric);
JobHostConfiguration hostConfig = new JobHostConfiguration(connectionString);
hostConfig.NameResolver = _nameResolver;
hostConfig.TypeLocator = new FakeTypeLocator(typeof(FunctionChainingPerfTest));
JobHost host = new JobHost(hostConfig);
_tokenSource = new CancellationTokenSource();
Task stopTask = null;
_tokenSource.Token.Register(() => stopTask = host.StopAsync());
host.RunAndBlock();
stopTask.GetAwaiter().GetResult();
}
finally
{
DeleteTestQueues(queueClient);
}
}
示例3: QueueMessageLeaseRenew
/// <summary>
/// There is a function that takes > 10 minutes and listens to a queue.
/// </summary>
/// <remarks>Ignored because it takes a long time. Can be enabled on demand</remarks>
// Uncomment the Fact attribute to run
//[Fact(Timeout = 20 * 60 * 1000)]
public void QueueMessageLeaseRenew()
{
_messageFoundAgain = false;
_queue.AddMessage(new CloudQueueMessage("Test"));
_tokenSource = new CancellationTokenSource();
JobHost host = new JobHost(_config);
_tokenSource.Token.Register(host.Stop);
host.RunAndBlock();
Assert.False(_messageFoundAgain);
}
示例4: Main
static void Main(string[] args)
{
CloudStorageAccount storageAccount;
if (CloudStorageAccount.TryParse(
ConfigurationManager.ConnectionStrings[STORAGE_CONN_STR_KEY_NAME].ConnectionString,
out storageAccount))
{
// Create the queue we're using to trigger on if it doesn't already exist.
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
CloudQueue queue = queueClient.GetQueueReference(PICTURE_LOADER_QUEUE_NAME.ToLower());
queue.CreateIfNotExists();
}
else
{
Console.WriteLine("Unable to initialize CloudStorageAccount.");
}
JobHost jobHost = new JobHost();
jobHost.RunAndBlock();
}
示例5: Main
static void Main(string[] args)
{
JobHost host = new JobHost();
host.RunAndBlock();
}
示例6: Main
private static void Main(string[] args)
{
var host = new JobHost();
host.RunAndBlock();
}
示例7: Main
// Please set the following connectionstring values in app.config
// AzureJobsRuntime and AzureJobsData
static void Main()
{
JobHost host = new JobHost();
host.RunAndBlock();
}
示例8: Main
private static void Main()
{
var host = new JobHost();
host.RunAndBlock();
}
示例9: Main
static void Main(string[] args)
{
var str = "DefaultEndpointsProtocol=https;AccountName=sychevigortestsite;AccountKey=dWDlc0DEcOvHufjiA2uZ7SjID5ZflmTeZvkhrEFIOQNFwqbZ3JNOjXgJ+GTYqvxhludZVVZBbTAQbnNTCBI/7g==";
var host = new JobHost(str, str);
host.RunAndBlock();
}