// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ServicebusOptions servicebusOptions) { app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Creator API"); }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Creator API", Version = "v1" }); }); var serviceBusOptions = new ServicebusOptions(); serviceBusOptions.TopicName = "metadata-topic"; Configuration.Bind("Servicebus", serviceBusOptions); services.AddSingleton(serviceBusOptions); services.AddTransient <IMessagingClient, ServicebusClient>(); }
public ServicebusClient(ServicebusOptions options) { _options = options; _topicClient = new TopicClient(_options.ConnectionString, entityPath: options.TopicName); }