Ejemplo n.º 1
0
 public EventHubClient GetEventHubClient()
 {
     if (_messageFactoryPool.Count > 0)
     {
         int mfpPoolIx = new Random().Next(_messageFactoryPool.Count);
         MessagingFacotryPoolItem mfpi = _messageFactoryPool[mfpPoolIx];
         return(mfpi.GetRandomEventHubClient());
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 2
0
 public void InitPool()
 {
     _messageFactoryPool = new List <MessagingFacotryPoolItem>();
     try
     {
         for (int i = 0; i < _numMessagingFactories; i++)
         {
             MessagingFacotryPoolItem mf = new MessagingFacotryPoolItem(_sbConnectionString, _eventHubName, _numEventHubClients);
             _messageFactoryPool.Add(mf);
         }
         _poolInitialized = true;
     }
     catch (ApplicationException ex)
     {
         throw new ApplicationException("InitPool exception", ex);
     }
 }