Ejemplo n.º 1
0
        public AzureFunctionsFabric(
            ISerializerFactorySelector serializerFactorySelector,
            INumericIdGenerator idGenerator,
            ITransitionRunner transitionRunner,
            IAzureWebJobsEnviromentalSettings azureWebJobsEnviromentalSettings,
            ICloudStorageAccountFactory cloudStorageAccountFactory,
            AzureFunctionsFabricSettings settings,
            IServiceProxyBuilder serviceProxyBuilder,
            IRoutineMethodResolver routineMethodResolver,
            IMethodInvokerFactory methodInvokerFactory,
            IServiceRegistry serviceRegistry)
        {
            _transitionRunner      = transitionRunner;
            _idGenerator           = idGenerator;
            _settings              = settings;
            _serviceProxyBuilder   = serviceProxyBuilder;
            _routineMethodResolver = routineMethodResolver;
            _methodInvokerFactory  = methodInvokerFactory;
            _serviceRegistry       = serviceRegistry;

#warning Need configurable serializer
            // Hard-code this for now.
            _defaultSerializer = serializerFactorySelector.Select("dasyncjson").Create();

            _storageAccountConnectionString = azureWebJobsEnviromentalSettings.DefaultStorageConnectionString;
            _storageAccount = cloudStorageAccountFactory.Create(_storageAccountConnectionString);

            //#warning make sure that site name is alpha-numeric and does not start with a number
            //            var prefix = azureWebJobsEnviromentalSettings.WebSiteName.ToLowerInvariant();
            var prefix = "";
            _routinesTable = _storageAccount.TableClient.GetTableReference(prefix + "routines");
            _servicesTable = _storageAccount.TableClient.GetTableReference(prefix + "services");
        }
Ejemplo n.º 2
0
        public HttpRequestHandler(
            ICommunicationModelProvider communicationModelProvider,
            IDomainServiceProvider domainServiceProvider,
            IRoutineMethodResolver routineMethodResolver,
            IMethodInvokerFactory methodInvokerFactory,
            ISerializerFactorySelector serializerFactorySelector,
            IEnumerable <IEventDispatcher> eventDispatchers,
            IUniqueIdGenerator idGenerator,
            ITransitionCommitter transitionCommitter,
            IRoutineCompletionNotifier routineCompletionNotifier,
            IEnumerable <IHttpIntentPreprocessor> intentPreprocessors,
            IEnumerable <IRoutineTransitionAction> transitionActions,
            ITransitionUserContext transitionUserContext)
        {
            _communicationModelProvider = communicationModelProvider;
            _domainServiceProvider      = domainServiceProvider;
            _routineMethodResolver      = routineMethodResolver;
            _methodInvokerFactory       = methodInvokerFactory;
            _eventDispatcher            = eventDispatchers.FirstOrDefault();
            _idGenerator               = idGenerator;
            _transitionCommitter       = transitionCommitter;
            _routineCompletionNotifier = routineCompletionNotifier;
            _intentPreprocessor        = new AggregateHttpIntentPreprocessor(intentPreprocessors);
            _transitionActions         = transitionActions;
            _transitionUserContext     = transitionUserContext;

            _dasyncJsonSerializer = serializerFactorySelector.Select("dasync+json").Create();

            JsonSettings.Converters.Add(new EntityProjectionConverter(communicationModelProvider.Model));
        }
Ejemplo n.º 3
0
        public PlatformHttpClient(
            IServiceDefinition serviceDefinition,
            ISerializerFactorySelector serializerFactorySelector,
            IServiceHttpConfigurator serviceHttpConfigurator)
        {
            _serviceDefinition         = serviceDefinition;
            _serializerFactorySelector = serializerFactorySelector;
            _serviceHttpConfigurator   = serviceHttpConfigurator;

            _httpClient = new HttpClient();
            serviceHttpConfigurator.ConfigureBase(_httpClient, _serviceDefinition);

            _dasyncJsonSerializer = serializerFactorySelector.Select("dasync+json").Create();
        }
        public IFabricConnector Create(ServiceId serviceId, object configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var config = (FileBasedFabricConnectorConfiguration)configuration;

            var serializerFactory = _serializerFactorySelector.Select(config.SerializerFormat);
            var serializer        = serializerFactory.Create();

            return(new FileBasedFabricConnector(
                       config.TransitionsDirectory,
                       config.RoutinesDirectory,
                       serializer,
                       config.SerializerFormat));
        }
        public IFabricConnector Create(ServiceId serviceId, object configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var config = (InMemoryFabricConnectorConfiguration)configuration;

            if (!InMemoryDataStore.TryGet(config.DataStoreId, out var dataStore))
            {
                throw new InvalidOperationException($"In-memory data store with ID '{config.DataStoreId}' does not exist.");
            }

            var serializerFactory = _serializerFactorySelector.Select(config.SerializerFormat);
            var serializer        = serializerFactory.Create();

            return(new InMemoryFabricConnector(dataStore, serializer, config.SerializerFormat));
        }
        public IFabricConnector Create(ServiceId serviceId, object configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var config = (AzureStorageFabricConnectorConfiguration)configuration;

            var serializerFactory = _serializerFactorySelector.Select(config.SerializerFormat);
            var serializer        = serializerFactory.Create();

            var connectionString = _storageAccontConnectionStringResolver.Resolve(config.StorageAccountName);
            var storageAccount   = _cloudStorageAccountFactory.Create(connectionString);
            var transitionsQueue = storageAccount.QueueClient.GetQueueReference(config.TransitionsQueueName);
            var routinesTable    = storageAccount.TableClient.GetTableReference(config.RoutinesTableName);

            return(new AzureStorageFabricConnectorWithConfiguration(
                       serviceId, _idGenerator, transitionsQueue, routinesTable, serializer, config));
        }