Exemplo n.º 1
0
 public void WriteNamespaces(IndentWriter writer, ServiceSchema schema)
 {
     writer.WriteLine("using Astral.Rabbit;");
 }
Exemplo n.º 2
0
        public void WriteServiceAttributes(IndentWriter writer, ServiceSchema schema)
        {
            var serviceExt = new ServiceSchemaExtension(schema);

            WriteCommonAttributes(writer, serviceExt);
        }
        public HttpServiceListener(
            IActivator activator,
            IWorker worker,
            IServiceEndPointDefinition serviceEndPointDefinition,
            ICertificateLocator certificateLocator,
            ILog log,
            IEnumerable <ICustomEndpoint> customEndpoints,
            IEnvironment environment,
            JsonExceptionSerializer exceptionSerializer,
            ServiceSchema serviceSchema,
            Func <LoadShedding> loadSheddingConfig,
            IServerRequestPublisher serverRequestPublisher,
            CurrentApplicationInfo appInfo,
            Func <MicrodotHostingConfig> microdotHostingConfigFactory,
            IMicrodotTypePolicySerializationBinder serializationBinder)
        {
            ServiceSchema           = serviceSchema;
            _serverRequestPublisher = serverRequestPublisher;

            ServiceEndPointDefinition = serviceEndPointDefinition;
            Worker              = worker;
            Activator           = activator;
            Log                 = log;
            CustomEndpoints     = customEndpoints.ToArray();
            Environment         = environment;
            ExceptionSerializer = exceptionSerializer;
            LoadSheddingConfig  = loadSheddingConfig;
            AppInfo             = appInfo;

            JsonSettings.SerializationBinder = serializationBinder;

            if (ServiceEndPointDefinition.HttpsPort != null && ServiceEndPointDefinition.ClientCertificateVerification != ClientCertificateVerificationMode.Disable)
            {
                var serviceCertificate = certificateLocator.GetCertificate("Service");
                Log.Info(_ => _($"Service certificate loaded: {serviceCertificate.FriendlyName}",
                                unencryptedTags: new
                {
                    Thumbprint = serviceCertificate.Thumbprint.Substring(serviceCertificate.Thumbprint.Length - 5),
                }));
                ServerRootCertHash = serviceCertificate.GetHashOfRootCertificate();
            }

            Listener = new HttpListener {
                IgnoreWriteExceptions = true
            };

            _uriPrefixes = new List <string>();

            if (ServiceEndPointDefinition.HttpsPort != null)
            {
                _uriPrefixes.Add($"https://+:{ServiceEndPointDefinition.HttpsPort}/");
            }
            if (ServiceEndPointDefinition.HttpPort != null)
            {
                _uriPrefixes.Add($"http://+:{ServiceEndPointDefinition.HttpPort}/");
            }
            if (!_uriPrefixes.Any())
            {
                Log.Warn(_ => _("HttpServiceListener is not listening on any ports, no HTTP or HTTPS ports in ServiceEndPointDefinition"));
            }
            else
            {
                foreach (string prefix in _uriPrefixes)
                {
                    Listener.Prefixes.Add(prefix);
                }
            }


            var context = Metric.Context("Service").Context(AppInfo.Name);

            _serializationTime          = context.Timer("Serialization", Unit.Calls);
            _deserializationTime        = context.Timer("Deserialization", Unit.Calls);
            _roundtripTime              = context.Timer("Roundtrip", Unit.Calls);
            _metaEndpointsRoundtripTime = context.Timer("MetaRoundtrip", Unit.Calls);
            _successCounter             = context.Counter("Success", Unit.Calls);
            _failureCounter             = context.Counter("Failed", Unit.Calls);
            _activeRequestsCounter      = context.Timer("ActiveRequests", Unit.Requests);
            _endpointContext            = context.Context("Endpoints");
        }
Exemplo n.º 4
0
 public ArticleController()
 {
     serviceArticle = new ServiceArticle();
     serviceSchema  = new ServiceSchema();
     serviceAdmUser = new ServiceAdmUser();
 }
Exemplo n.º 5
0
 public SchemaController()
 {
     serviceSchema = new ServiceSchema();
 }