Beispiel #1
0
        protected override void DoConfigure(IConfigSectionNode node)
        {
            const string CONFIG = "configuring";

            base.DoConfigure(node);

            run(() => ConfigAttribute.Apply(this, node), CONFIG, "glue", Name, GetType());

            foreach (var pnode in node[CONFIG_PROVIDERS_SECTION].Children.Where(n => n.IsSameName(CONFIG_PROVIDER_SECTION)))
            {
                var name = pnode.AttrByName(CONFIG_NAME_ATTR).ValueAsString();
                run(() => FactoryUtils.MakeAndConfigure <Provider>(pnode, args: new object[] { this, name }), CONFIG, "provider", name);
            }

            foreach (var bnode in node[CONFIG_BINDINGS_SECTION].Children.Where(n => n.IsSameName(CONFIG_BINDING_SECTION)))
            {
                var name = bnode.AttrByName(CONFIG_NAME_ATTR).ValueAsString();
                run(() => FactoryUtils.MakeAndConfigure <Binding>(bnode, args: new object[] { this, name }), CONFIG, "binding", name);
            }

            foreach (var snode in node[CONFIG_SERVERS_SECTION].Children.Where(n => n.IsSameName(CONFIG_SERVER_SECTION)))
            {
                var name = snode.AttrByName(CONFIG_NAME_ATTR).ValueAsString();
                run(() => FactoryUtils.MakeAndConfigure <ServerEndPoint>(snode,
                                                                         defaultType: typeof(ServerEndPoint), args: new object[] { this, name }), CONFIG, "server", name);
            }

            run(() => MsgInspectorConfigurator.ConfigureClientInspectors(m_ClientMsgInspectors, node), CONFIG, "ClientInspectors");
            run(() => MsgInspectorConfigurator.ConfigureServerInspectors(m_ServerMsgInspectors, node), CONFIG, "ServerInspectors");
        }
Beispiel #2
0
        /// <summary>
        /// Override to setup the instance of client after it has been allocated.
        /// The default implementation injects headers, timeoutes, and inspectors for Glue.ClientEndPoints
        /// </summary>
        protected virtual void DoSetupClientInstance(ContractMapping mapping, bool isGlobal, IAgniServiceClient instance, string toHost, string fromHost)
        {
            var mappingData = isGlobal ? mapping.Global : mapping.Local;

            var tms = mappingData.CallTimeoutMs;

            if (tms > 0)
            {
                instance.TimeoutMs = tms;
            }
            instance.ReserveTransport = mappingData.ReserveTransport;


            var gep = instance as ClientEndPoint;

            if (gep != null)
            {
                var icfg = mappingData.Options;
                if (icfg != null)
                {
                    MsgInspectorConfigurator.ConfigureClientInspectors(gep.MsgInspectors, icfg);
                    HeaderConfigurator.ConfigureHeaders(gep.Headers, icfg);
                }
            }
        }