Пример #1
0
        /// <summary>
        /// This is the Microservice constructor.
        /// </summary>
        /// <param name="name">The Microservice name.</param>
        /// <param name="serviceId">The service id.</param>
        /// <param name="description">An optional description for the Microservice.</param>
        /// <param name="policySettings">The policy settings.</param>
        /// <param name="properties">Any additional property key.</param>
        /// <param name="serviceVersionId">This is the version id of the calling assembly as a string.</param>
        public Microservice(
            string name          = null
            , string serviceId   = null
            , string description = null
            , IEnumerable <PolicyBase> policySettings          = null
            , IEnumerable <Tuple <string, string> > properties = null
            , string serviceVersionId = null
            )
            : base(name)
        {
            Policy = new PolicyWrapper(policySettings, () => Status);
            //Id
            if (string.IsNullOrEmpty(name))
            {
                name = GetType().Name;
            }

            Id = new MicroserviceId(name
                                    , serviceId: serviceId
                                    , description: description
                                    , serviceVersionId: serviceVersionId ?? Assembly.GetCallingAssembly().GetName().Version.ToString()
                                    , serviceEngineVersionId: GetType().Assembly.GetName().Version.ToString()
                                    , properties: properties);
            //Security
            mSecurity = InitialiseSecurityContainer();
            Security  = new SecurityWrapper(mSecurity, () => Status);
            //Communication
            mCommunication = InitialiseCommunicationContainer();
            Communication  = new CommunicationWrapper(mCommunication, () => Status);
            //Commands
            mCommands = InitialiseCommandContainer();
            Commands  = new CommandWrapper(mCommands, () => Status);
            //Resources
            mResourceMonitor = InitialiseResourceMonitor();
            ResourceMonitor  = new ResourceWrapper(mResourceMonitor, () => Status);
            //Data Collection
            mDataCollection = InitialiseDataCollectionContainer();
            DataCollection  = new DataCollectionWrapper(mDataCollection, () => Status);
            //Events
            mEventsWrapper = new EventsWrapper(this, mDataCollection, () => Status);
            Events         = mEventsWrapper;
            //Serializer
            mSerializer   = InitialiseSerializationContainer();
            Serialization = new SerializationWrapper(mSerializer, () => Status);
        }
Пример #2
0
        /// <summary>
        /// THis method returns the default scheduler container.
        /// </summary>
        protected virtual SerializationContainer InitialiseSerializationContainer()
        {
            var container = new SerializationContainer(Policy.Serialization);

            return(container);
        }
 internal SerializationWrapper(SerializationContainer container, Func <ServiceStatus> getStatus) : base(getStatus)
 {
     mContainer = container;
 }