public SynchronizedCache(ManagementClient serviceBusManagementClient, ITopicClient serviceBusTopicClient) { this.serviceBusManagementClient = serviceBusManagementClient; this.topicClient = serviceBusTopicClient; this.cacheType = typeof(TValue).Name; this.subscriptionName = $"{cacheType}-{Environment.MachineName}"; this.lazyInitialization = new Lazy <Task>(EnsureInitializationAsync, LazyThreadSafetyMode.ExecutionAndPublication); }
/// <summary> /// Constructor /// </summary> /// <param name="client">Topic Client</param> public BusTopicClient(ITopicClient client) { if (null == client) { throw new ArgumentNullException("client"); } this.client = client; }
public TopicDispatcher(ITopicFactory <T> topicFactory) { if (topicFactory == null) { throw new ArgumentNullException(nameof(topicFactory)); } _client = topicFactory.Create(); }
public TopicClientSendOperations(string serviceBusConnectionString, string topicName, int maxRetryCountOnSend, int minimumBackOff = 1, int maximumBackOff = 10) { _serviceBusConnectionString = serviceBusConnectionString; _topicName = topicName; _minimumBackOff = minimumBackOff; _maximumBackOff = maximumBackOff; _maxRetryCountOnSend = maxRetryCountOnSend; CustomTopicClient = CreateTopicClient(); }
static async Task MainAsync() { topicClient = new TopicClient(ServiceBusConnectionString, TopicName); // Send messages. await SendMessagesAsync(NumberOfMessages); await topicClient.CloseAsync(); }
public OrdersController(IConfiguration configuration) { Configuration = configuration; connStr = Configuration["DbConnectionString"]; // Note 1: change from sb to https sbConnectionString = Configuration["SBConnectionString"]; topicName = Configuration["SBTopic"]; topicClient = new TopicClient(sbConnectionString, topicName); }
public DefaultServiceBusPersisterConnection(ServiceBusConnectionStringBuilder serviceBusConnectionStringBuilder, string subscriptionClientName) { _serviceBusConnectionStringBuilder = serviceBusConnectionStringBuilder ?? throw new ArgumentNullException(nameof(serviceBusConnectionStringBuilder)); _subscriptionClientName = subscriptionClientName; _subscriptionClient = new SubscriptionClient(_serviceBusConnectionStringBuilder, subscriptionClientName); _topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default); }
static void Main(string[] args) { var serviceBusConnectionString = ConfigurationManager.AppSettings["ServiceBusTopicSubscriptionSenderSharedAccessPolicy"]; var topicName = ConfigurationManager.AppSettings["ServiceBusTopicName"]; topicClient = new TopicClient(serviceBusConnectionString, topicName); SendMessageAsync().GetAwaiter().GetResult(); Console.ReadKey(); }
public ProcessSignatureEnqueuer( ITopicClient topicClient, IBrokeredMessageSerializer <SignatureValidationMessage> serializer, IOptionsSnapshot <ProcessSignatureConfiguration> configuration) { _topicClient = topicClient ?? throw new ArgumentNullException(nameof(topicClient)); _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); }
public ITopicClient CreateModel() { if (_topicClient.IsClosedOrClosing) { _topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default); } return(_topicClient); }
public TopicPublisherAgent() { if (string.IsNullOrEmpty(serviceBusConnectionString)) { throw new ConfigurationErrorsException(nameof(serviceBusConnectionString)); } topicClient = new TopicClient(serviceBusConnectionString, topicName); }
public DefaultServiceBusPersisterConnection(ServiceBusConnectionStringBuilder serviceBusConnectionStringBuilder, ILogger <DefaultServiceBusPersisterConnection> logger) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _serviceBusConnectionStringBuilder = serviceBusConnectionStringBuilder ?? throw new ArgumentNullException(nameof(serviceBusConnectionStringBuilder)); _topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default); }
public ServiceBusTopicHandler(string connectionString, string topic, string subscriptionName, Func <Message, CancellationToken, Task> onMessageRecivedCallBack) { // create connection link topicClient = new TopicClient(connectionString, topic); subscriptionClient = new SubscriptionClient(connectionString, topic, subscriptionName); // Register subscription message handler and receive messages in a loop RegisterOnMessageHandlerAndReceiveMessages(onMessageRecivedCallBack); }
public AzureServiceBusInstance(IMessageReceiver messageReceiver, ITopicClient topicClient, AzureServiceBusTransportSettings settings, ILogger logger, int connectionStringNumber) { this.messageReceiver = messageReceiver; this.topicClient = topicClient; this.settings = settings; this.logger = logger; this.connectionStringNumber = connectionStringNumber; detectFailureFast = true; }
public EmailMessageEnqueuer( ITopicClient topicClient, IServiceBusMessageSerializer serializer, ILogger <EmailMessageEnqueuer> logger) { _topicClient = topicClient ?? throw new ArgumentNullException(nameof(topicClient)); _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public DefaultServiceBusConnectionManager(IOptions <EventBusConnectionOptions> options) { if (options?.Value == null) { throw new ArgumentNullException(nameof(options)); } ServiceBusConnectionStringBuilder = new ServiceBusConnectionStringBuilder(options.Value.TopicConnectionString); _topicClient = new TopicClient(ServiceBusConnectionStringBuilder, RetryPolicy.Default); }
/// <summary> /// Creates a TopicClient which is used for all basic interactions with a Service Bus topic. /// </summary> /// <returns>Instance of TopicClient</returns> public ITopicClient CreateModel() { EnsureConnection(); if (topicClient == null || topicClient.IsClosedOrClosing) { topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default); } return(topicClient); }
public SymbolsMessageEnqueuer( ITopicClient topicClient, IBrokeredMessageSerializer <SymbolsValidatorMessage> serializer, TimeSpan?messageDelay) { _topicClient = topicClient ?? throw new ArgumentNullException(nameof(topicClient)); _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); _messageDelay = messageDelay; }
public ServiceBusLifeCycleEventHub( string connectionString, string topicName, string subscriptionName, ILoggerFactory logFactory) { _subscriptionClient = new SubscriptionClient(connectionString, topicName, subscriptionName); _topicClient = new TopicClient(connectionString, topicName); _logger = logFactory.CreateLogger(GetType()); }
public Application(IOptions <AppSettings> appSettings, ILogger <Application> log) { _appSettings = appSettings.Value; _log = log; _connString = _appSettings.PubEndpoint; _topicName = _appSettings.TopicName; _topicClient = new TopicClient(_connString, _topicName); }
public void GivenTopic_WhenAskingForClient_ThenItReturnsCorrectClient() { // arrange // act const string expected = "topic"; ITopicClient topicClient = ServiceBusTopic.Client(expected); // assert topicClient.TopicName.Should().Be(expected); }
public DefaultServiceBusPersisterConnection(ServiceBusConnectionStringBuilder serviceBusConnectionStringBuilder, ILogger <DefaultServiceBusPersisterConnection> logger) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _serviceBusConnectionStringBuilder = serviceBusConnectionStringBuilder ?? throw new ArgumentNullException(nameof(serviceBusConnectionStringBuilder)); _topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default); Console.WriteLine($"Servicebus topic for client {_topicClient.TopicName} created"); }
internal ServiceBusEventBus(ISubscriptionClient subscriptionClient, ITopicClient topicClient, ServiceBusOptions serviceBusOptions, ISubscriptionManager subscriptionManager, IHandlerResolver handlerResolver, ILogger <ServiceBusEventBus> logger) { _subscriptionClient = subscriptionClient ?? throw new ArgumentNullException(nameof(subscriptionClient)); _topicClient = topicClient ?? throw new ArgumentNullException(nameof(topicClient)); _serviceBusOptions = serviceBusOptions ?? throw new ArgumentNullException(nameof(serviceBusOptions)); _subscriptionManager = subscriptionManager ?? throw new ArgumentNullException(nameof(subscriptionManager)); _handlerResolver = handlerResolver ?? throw new ArgumentNullException(nameof(handlerResolver)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
static async Task MainAsync() { client = new TopicClient(ServiceBusConnectionString, TopicName); // Send messagee // await SendMessagesAsync(); System.Console.ReadKey(); await client.CloseAsync(); }
static async Task MainAsync() { const int numberOfMessages = 5; topicClient = new TopicClient(serviceBusConnectionString, topicName); await SendMessagesAsync(numberOfMessages); Console.ReadKey(); await topicClient.CloseAsync(); }
public DefaultServiceBusPersisterConnection(string serviceBusConnectionString, ILogger <DefaultServiceBusPersisterConnection> logger, string topicName) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _topicName = topicName ?? throw new ArgumentNullException(nameof(topicName)); ServiceBusConnectionStringBuilder = serviceBusConnectionString ?? throw new ArgumentNullException(nameof(serviceBusConnectionString)); _topicClient = new TopicClient(ServiceBusConnectionStringBuilder, _topicName, RetryPolicy.Default); }
private static async Task MainAsync() { const int numberOfMessages = 10; _topicClient = new TopicClient(ServiceBusConnectionString, TopicName); await SendMessageAsync(numberOfMessages); Console.ReadKey(); await _topicClient.CloseAsync(); }
static async Task MainAsync() { topicClient = new TopicClient(ServiceBusConnectionString, TopicName); await SendMessagesAsync(); Console.ReadKey(); await topicClient.CloseAsync(); }
public ServiceBusMQClient( IConfiguration configuration, ILogger <ServiceBusMQClient> logger) { this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); var connectionString = configuration.GetConnectionString("ServiceBus") ?? throw new ArgumentNullException("ServiceBus connection string missing!"); topicClient = new TopicClient(connectionString, TopicName); }
private ITopicClient GetTopicClient() { if (_topicClient != null) { return(_topicClient); } _topicClient = _queueManager.CreateTopicSender(_topicPath).Result; return(_topicClient); }