Exemplo n.º 1
0
        internal static void ChannelCreated(object sender, LightSingleArgEventArgs <ITransportChannel> e)
        {
            IHostTransportChannel hostChannel = (IHostTransportChannel)sender;
            KAENetworkResource    tag         = (KAENetworkResource)hostChannel.Tag;

            if (tag.Protocol == ProtocolTypes.Metadata)
            {
                IMessageTransportChannel <MetadataContainer> msgChannel = new MessageTransportChannel <MetadataContainer>((IRawTransportChannel)e.Target, (IProtocolStack)NetworkHelper.GetProtocolStack(tag.Protocol));
                MetadataConnectionAgent agent = new MetadataConnectionAgent(msgChannel, (MetadataTransactionManager)NetworkHelper.GetTransactionManager(tag.Protocol));
                agent.Disconnected   += AgentDisconnected;
                agent.NewTransaction += MetadataNewTransactionHandler;
                agent.Tag             = tag;
            }
            else if (tag.Protocol == ProtocolTypes.Intellegence)
            {
                IMessageTransportChannel <BaseMessage> msgChannel = new MessageTransportChannel <BaseMessage>((IRawTransportChannel)e.Target, (IProtocolStack)NetworkHelper.GetProtocolStack(tag.Protocol));
                IntellectObjectConnectionAgent         agent      = new IntellectObjectConnectionAgent(msgChannel, (MessageTransactionManager)NetworkHelper.GetTransactionManager(tag.Protocol));
                agent.Disconnected   += AgentDisconnected;
                agent.NewTransaction += IntellegenceNewTransactionHandler;
                agent.Tag             = tag;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///    创建一个新的服务器端连接代理器,并将其注册到当前的连接池中
 /// </summary>
 /// <param name="iep">要创建连接的远程终结点地址</param>
 /// <param name="protocolStack">协议栈</param>
 /// <param name="transactionManager">网络事务管理器</param>
 /// <returns>返回已经创建好的服务器端连接代理器</returns>
 protected override IServerConnectionAgent <BaseMessage> CreateAgent(IPEndPoint iep, IProtocolStack protocolStack, object transactionManager)
 {
     return(IntellectObjectConnectionAgent.Create(iep, protocolStack, (MessageTransactionManager)transactionManager));
 }