public Task <object> InitPool(Dictionary <string, string> input) { if (_poolInitialized) { //NOP - do nothing return(Task.FromResult <object>(string.Format("The pool is already initialied"))); } try { _connectionString = input["EventHubConnectionString"]; _serviceBusName = input["ServiceBusNameSpace"]; _hubname = input["EventHubName"]; } catch (KeyNotFoundException knfe) { throw new ApplicationException("InitPool: dictionary values are missing", knfe); } finally { //reset the state of the connection pool to known state _eventHubConnectionPool = null; } _eventHubConnectionPool = new EventHubConnectionPool(_serviceBusName, _connectionString, _hubname, _numMessagingFactories, _numEventHubClients); _eventHubConnectionPool.InitPool(); return(Task.FromResult <object>(string.Format("The pool is initialied to: factories: {0}, clients/factory: {1}", _numMessagingFactories, _numEventHubClients))); }
public void ClosePool() { try { _eventHubConnectionPool.ClosePool(); } finally { _eventHubConnectionPool = null; } }