public HandlerGenerator(string projectName, AzureServiceBusQueue azureServiceBusQueue, MessageBusHandlerInterfaceGenerator messageBusHandlerInterface, IList <TriggeredAction> modelParameters, IList <ActionGenerator> actions, OperationInterfaceGenerator operationInterface) : base( projectName, "Services", azureServiceBusQueue.Name + "Handler", typeof(HandlerTemplate), modelParameters, azureServiceBusQueue.Name + "Handler") { Actions = actions.Where(x => modelParameters.Select(y => y.Name).Contains(x.Key)).ToList(); OperationInterface = operationInterface; AzureServiceBusQueue = azureServiceBusQueue; MessageBusHandlerInterface = messageBusHandlerInterface; }
public AzureServiceBusServer() { Messages = new ObservableCollection <string>(); // Create a cancellationTokenSource which will be passed to the task _tokenSource = new CancellationTokenSource(); // Create a Queueclient that will connect to our // Service Bus item. var sb = QueueClient.CreateFromConnectionString(AzureServiceBusQueue.GetListenerConnectString()); _client = sb.MessagingFactory.CreateQueueClient("testqueue"); }
public AzureServiceBusClient() { // Set the buttons to enabled/disabled CanStart = true; CanStop = false; // Create a cancellationTokenSource which will be passed to the task _tokenSource = new CancellationTokenSource(); // Create a Queueclient that will connect to our // Service Bus item. var sb = QueueClient.CreateFromConnectionString(AzureServiceBusQueue.GetSenderConnectString()); _client = sb.MessagingFactory.CreateQueueClient("testqueue"); }
public IQueue <T> CreateQueue <T>(string name) where T : class { var logger = _loggerFactory.CreateLogger(GetType()); logger.LogInformation("Create new AzureServiceBus Queue {Name} for {Type}", name, typeof(T).Name); var iopt = _serviceProvider.GetService <IOptions <AzureServiceBusQueueOptions <T> > >(); if (iopt == null) { throw new InvalidOperationException($"Please Register AzureServiceBusQueueOptions {typeof(T).FullName}"); } var options = iopt.Value; options.ConnectionString = _messageBusOptions.ConnectionString; options.Name = name; options.LoggerFactory = _loggerFactory; var queue = new AzureServiceBusQueue <T>(options); return(queue); }
private void PrepareResource(AzureServiceBusQueue resource) { Console.WriteLine("Making AzureServiceBusQueue: " + resource.Name); var queueName = resource.Name; var serviceBusNamespace = _azure.ServiceBusNamespaces .Define(SdkContext.RandomResourceName("namespace", 20)) .WithRegion(_resourceGroup.RegionName) .WithExistingResourceGroup(_resourceGroup) .WithNewQueue(queueName, resource.SizeInGB * 1024) .Create(); var firstQueue = serviceBusNamespace.Queues.GetByName(queueName); var rule = firstQueue.AuthorizationRules.Define("rulerule").WithManagementEnabled().Create(); resource.ConnectionString = rule.GetKeys().PrimaryConnectionString; Console.WriteLine("Making AzureServiceBusQueue: " + resource.Name); PreparedResources.Add(resource); _serviceQueues.Add(resource, firstQueue); Console.WriteLine("Done: " + resource.Name); }