Exemple #1
0
        public Host(IStaticApplicationInfo applicationInfo, FunctionsHostConfiguration configuration, ILogger logger, uint processId, Stopwatch stopwatch, Guid invocationId)
        {
            this.processId       = processId;
            this.stopwatch       = stopwatch;
            this.applicationInfo = applicationInfo;
            this.configuration   = configuration;
            this.hostName        = Environment.MachineName;
            bool cloud = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("REACTIVE_MACHINE_DIR"));

            CombinedLogger    = new CombinedLogger(logger, configuration, processId, cloud);
            HostLogger        = new LoggerWrapper(CombinedLogger, $"[p{processId:d3} host] ", configuration.HostLogLevel);
            ApplicationLogger = new LoggerWrapper(CombinedLogger, $"[p{processId:d3} application] ", configuration.ApplicationLogLevel);
            RuntimeLogger     = new LoggerWrapper(CombinedLogger, $"[p{processId:d3} runtime] ", configuration.RuntimeLogLevel);

            this.application = applicationInfo.Build(new ReactiveMachine.ApplicationCompiler().SetConfiguration(configuration));

            this.invocationId              = invocationId;
            this.payloadSerializer         = new DataContractSerializer(typeof(List <KeyValuePair <long, IMessage> >), application.SerializableTypes);
            this.payloadSerializerLoopback = new DataContractSerializer(typeof(List <IMessage>), application.SerializableTypes);
            this.Connections = new EventHubsConnections(processId, HostLogger, configuration.ehConnectionString);

            if (application.TryGetConfiguration <ReactiveMachine.TelemetryBlobWriter.Configuration>(out var config))
            {
                this.collectHostEvents     = config.CollectHostEvents;
                this.blobTelemetryListener = new TelemetryCollector(config, application, processId, this.GetType());
            }
        }
Exemple #2
0
 public RequestSender(uint processId, EventHubsConnections connections,
                      ILogger logger, DataContractSerializer payloadSerializer, FunctionsHostConfiguration configuration)
     : base(processId, connections, logger, payloadSerializer, configuration,
            connections.GetProcessSender(processId))
 {
     this.processId = processId;
     doorbell       = connections.GetDoorbellSender(processId);
 }
Exemple #3
0
 public RemoteSender(uint processId, uint destination, EventHubsConnections connections,
                     ILogger logger, DataContractSerializer payloadSerializer, FunctionsHostConfiguration configuration, DateTime deploymentTimestamp)
     : base(destination, connections, logger, payloadSerializer, configuration)
 {
     this.processId           = processId;
     this.deploymentTimestamp = deploymentTimestamp;
     doorbell = connections.GetDoorbellSender(destination);
 }
 public BatchSender(uint destination, EventHubsConnections connections, ILogger logger,
                    DataContractSerializer payloadSerializer, FunctionsHostConfiguration configuration, PartitionSender sender)
 {
     this.destination       = destination;
     this.connections       = connections;
     this.payloadSerializer = payloadSerializer;
     this.configuration     = configuration;
     this.logger            = new LoggerWrapper(logger, $" [sender{destination:d3}] ");
     this.sender            = sender;
 }
        private ClientConnection(IStaticApplicationInfo applicationInfo, ILogger logger)
        {
            this.applicationInfo = applicationInfo;
            var configuration = applicationInfo.GetHostConfiguration();

            this.logger            = new LoggerWrapper(logger, $"[client] ", configuration.HostLogLevel);
            this.application       = applicationInfo.Build(new ReactiveMachine.ApplicationCompiler().SetConfiguration(configuration));
            this.payloadSerializer = new DataContractSerializer(typeof(List <IMessage>), application.SerializableTypes);
            this.processId         = (uint)new Random().Next((int)application.NumberProcesses); // we connect to a randomly selected process
            this.connections       = new EventHubsConnections(processId, logger, configuration.ehConnectionString);
            this.sender            = new RequestSender(processId, connections, logger, payloadSerializer, configuration);
        }
Exemple #6
0
 private Client(ILogger logger)
 {
     this.random             = new Random();
     this.applicationInfo    = new TStaticApplicationInfo();
     this.configuration      = applicationInfo.GetHostConfiguration();
     this.logger             = new LoggerWrapper(logger, $"[client] ", configuration.HostLogLevel);
     this.application        = Compilation.Compile <TStaticApplicationInfo>(applicationInfo, configuration);
     this.processId          = (uint)random.Next((int)application.NumberProcesses); // we connect to a randomly selected process
     this.responsePartition  = (uint)random.Next(ResponseSender.NumberPartitions);  // we receive on a randomly selected partition
     this.connections        = new EventHubsConnections(processId, logger, configuration.EventHubsConnectionString);
     this.requestSender      = new RequestSender(processId, connections, logger, new DataContractSerializer(typeof(List <IMessage>), application.SerializableTypes), configuration);
     this.responseSenders    = new Dictionary <uint, ResponseSender>();
     this.continuations      = new ConcurrentDictionary <Guid, object>();
     this.serializer         = new Serializer(application.SerializableTypes);
     this.responseSerializer = new DataContractSerializer(typeof(List <IResponseMessage>), application.SerializableTypes);
     var ignoredTask = ListenForResponses();
 }
Exemple #7
0
 public LoopbackSender(uint processId, EventHubsConnections connections,
                       ILogger logger, DataContractSerializer payloadSerializer, FunctionsHostConfiguration configuration, DateTime deploymentTimestamp)
     : base(processId, connections, logger, payloadSerializer, configuration)
 {
     this.deploymentTimestamp = deploymentTimestamp;
 }
Exemple #8
0
 public ResponseSender(uint processId, uint partitionId, EventHubsConnections connections,
                       ILogger logger, DataContractSerializer payloadSerializer, FunctionsHostConfiguration configuration)
     : base(processId, connections, logger, payloadSerializer, configuration,
            connections.GetResponseSender(partitionId))
 {
 }