Example #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="config"></param>
        public AppStore(Config config) : base(config)
        {
            OAuthTokenServiceClient = SingletonStore <OAuthTokenV2ServiceClient>
                                      .Get(() => new OAuthTokenV2ServiceClient(Config));

            SyncSettingV2ServiceClient = SingletonStore <SyncSettingV2ServiceClient>
                                         .Get(() => new SyncSettingV2ServiceClient(Config));

            ServiceBusClient = SingletonStore <SQSServiceBusClient>
                               .Get(() => new SQSServiceBusClient(Config.ServiceBusClientConfig));

            SalesforceOAuthServiceClient = new SalesforceOAuthServiceClient(
                Config.SalesforceOAuthServiceClientConfig
                );

            OAuthTokenManager = new OAuthTokenManager(new OAuthTokenManagerConfig
            {
                IntegrationType    = CRMIntegrationTypes.Salesforce,
                AWSRegionEndpoint  = Config.AWSRegionEndpoint,
                AWSSecretKey       = Config.AWSSecretKey,
                AWSAccessKey       = Config.AWSAccessKey,
                AWSAccountId       = Config.AWSAccountId,
                OAuthServiceClient = SalesforceOAuthServiceClient,
                SlackAlertChannel  = Config.SlackAlertRefreshTokenChannel
            });

            if (!string.IsNullOrEmpty(Config.RedisConnectionString))
            {
                RedisDB = ConnectionMultiplexer.Connect(Config.RedisConnectionString).GetDatabase();
            }

            RemoteDataServiceClient = SingletonStore <RemoteDataServiceClient> .Get(
                () => new RemoteDataServiceClient(Config)
                );
        }
Example #2
0
        public AppStore(Config config) : base(config)
        {
            // service clients
            SyncSettingV2ServiceClient = SingletonStore <SyncSettingV2ServiceClient> .Get(
                () => new SyncSettingV2ServiceClient(Config)
                );

            RemoteDataServiceClient = SingletonStore <RemoteDataServiceClient> .Get(
                () => new RemoteDataServiceClient(Config)
                );

            ContactsServiceClient = SingletonStore <ContactsServiceClient> .Get(
                () => new ContactsServiceClient(new ContactsServiceConfig
            {
                ApiEndpoint = Config.ContactsServiceApiEndpoint
            })
                );

            SalesforceOAuthServiceClient = new SalesforceOAuthServiceClient(
                Config.SalesforceOAuthServiceClientConfig
                );
            OAuthTokenManager = new OAuthTokenManager(new OAuthTokenManagerConfig
            {
                IntegrationType    = CRMIntegrationTypes.Salesforce,
                AWSRegionEndpoint  = Config.AWSRegionEndpoint,
                AWSSecretKey       = Config.AWSSecretKey,
                AWSAccessKey       = Config.AWSAccessKey,
                AWSAccountId       = Config.AWSAccountId,
                OAuthServiceClient = SalesforceOAuthServiceClient,
                SlackAlertChannel  = Config.SlackAlertRefreshTokenChannel
            });

            // comparers
            SalesforceTopicMappingComparer = SingletonStore <SalesforceTopicMappingComparer> .Get(
                () => new SalesforceTopicMappingComparer()
                );
        }