Ejemplo n.º 1
0
        static void RegisterXMS(IServiceCollection services, IbmMQConfigModel configModel)
        {
            //Register ConnectionFactory
            var factoryFactory    = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
            var connectionFactory = factoryFactory.CreateConnectionFactory();

            connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, configModel.Host);
            connectionFactory.SetIntProperty(XMSC.WMQ_PORT, configModel.Port);
            connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, configModel.Channel);
            connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, configModel.ManagerName);
            connectionFactory.SetStringProperty(XMSC.USERID, configModel.User);
            connectionFactory.SetStringProperty(XMSC.PASSWORD, configModel.Password);
            services.AddSingleton(connectionFactory);
        }
Ejemplo n.º 2
0
        private static IbmMQConfigModel LoadConfiguration(IServiceCollection services)
        {
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(System.IO.Directory.GetCurrentDirectory()) //Buranın çalışması için csproj'a ekleme yapıldı. Additions to csproj for this place to work.
                                .AddJsonFile("appconfig.json")
                                .Build();

            var configModel = new IbmMQConfigModel();
            var section     = configuration.GetSection(IbmMQConfigModel.ConfigSection);

            section.Bind(configModel);
            services.AddSingleton(configModel);
            return(configModel);
        }
Ejemplo n.º 3
0
 static ServiceProvider ConfigureServiceProvider(ServiceCollection services, IbmMQConfigModel configModel)
 {
     services.AddTransient <MainView>();
     if (configModel.UseMock)
     {
         services.AddSingleton <IQueueManager, MockMQService>();
     }
     else
     {
         RegisterXMS(services, configModel);
         services.AddSingleton <IQueueManager, IbmMQService>();
     }
     return(services.BuildServiceProvider());
 }
Ejemplo n.º 4
0
 public IbmMQService(IConnectionFactory connectionFactory, IbmMQConfigModel mqConfigModel)
 {
     _connectionFactory = connectionFactory;
     _mqConfigModel     = mqConfigModel;
 }