Skip to content

Instantly share code, notes, and snippets.

@ankitvijay
Last active September 21, 2019 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ankitvijay/0ba925e99710f83fc8b997e12e37660b to your computer and use it in GitHub Desktop.
Save ankitvijay/0ba925e99710f83fc8b997e12e37660b to your computer and use it in GitHub Desktop.
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
namespace DemoNServiceBusSubscriberAndAzureFunctionPublisher
{
public static class TimerTriggerAzureFunction
{
[FunctionName("QueueMessageToWorker")]
public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
[ServiceBus("%AzureServiceBusQueue%", Connection = "AzureServiceBusConnectionString")]
ICollector<ExecuteSomeCommand> collectors,
ILogger log)
{
collectors.Add(new ExecuteSomeCommand(Guid.NewGuid().ToString()));
}
}
public class ExecuteSomeCommand
{
public ExecuteSomeCommand(string id)
{
Id = id;
}
public string Id { get; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment