Greetings,
I have a question, I would be glad if you can help.

Consider an application that heavily handles messages coming from Rabbitmq 
queue. Meanwhile, it queries the database and the data is saved and updated.

My question is, it processes 500 of the 1000 incoming data, but the rest 
mostly gives the error I mentioned on the subject. "Pooled connection 
request timed out" I think the problem is from nhsession and somehow it 
fills the pool.

What should I do, what would you recommend?

Example configuration is below.

*private static object lockObject = new object();*
*        private static ISessionFactory sessionFactory;*
*        private static FluentConfiguration configuration;*
*        private static ISessionFactory SessionFactory*
*        {*
*            get  **{** lock (lockObject)**  {*
*              if (sessionFactory == null)*
*                    {*
*                        sessionFactory = 
configuration.BuildSessionFactory();*
*                    }*
*                    return sessionFactory;*
*                }*
*            }*
*        }*














*public static IServiceCollection AddSniffactorNhibernate(this 
IServiceCollection services, string connectionString)        {            
Check.NotNull(connectionString);            configuration = 
Fluently.Configure()                
.Database(OracleManagedDataClientConfiguration.Oracle10                
.ConnectionString(connectionString)               Mappings(m => 
m.FluentMappings.AddFromAssemblyOf<ISniffactorMapping>());            
services.AddSingleton(SessionFactory);            
services.AddScoped(factory => 
configuration.BuildSessionFactory().OpenSession());            
services.AddScoped(typeof(IRepository<>), typeof(NhRepositoryBase<>));      
      services.AddScoped(typeof(IUnitOfWork), typeof(NhUnitOfWork));        
    services;        }And example a repopublic class 
KeywordDetectionViewRepository : NhRepositoryBase<KeywordDetectionView>, 
IKeywordDetectionViewRepository    {        private readonly ISession 
_session;        public KeywordDetectionViewRepository(ISession session) : 
base(session)        {            _session = session;        }        
public async Task<List<KeywordDetectionView>> GetKeywordsAsync(string 
source, string tag, LanguageTypes languageTypes)        {            var 
query = _session.CreateCriteria<KeywordDetectionView>();            int 
keywordId = int.Parse(tag.Substring(2));            if 
(tag.StartsWith("k_"))            {                
query.Add(Restrictions.Eq("KeywordId", keywordId));            }            
else if (tag.StartsWith("v_"))            {                
query.Add(Restrictions.Eq("VariationId", keywordId));            }          
  query.Add(Restrictions.Eq("SourceCode", source));            
query.Add(Restrictions.Or(Restrictions.Eq("LanguageCode", 
languageTypes.ToString().ToLowerInvariant()), 
Restrictions.IsNull("LanguageCode")));            var result = await 
query.SetCacheable(false).ListAsync<KeywordDetectionView>();            
return (List<KeywordDetectionView>)result;        }    }*

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nhusers/ff0cbb51-f210-412e-9058-4db704eea99fn%40googlegroups.com.

Reply via email to