• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IEndpoint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IEndpoint的典型用法代码示例。如果您正苦于以下问题:C# IEndpoint类的具体用法?C# IEndpoint怎么用?C# IEndpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IEndpoint类属于命名空间,在下文中一共展示了IEndpoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SendMessage

        public void SendMessage(WireSendingMessage message, IEndpoint endpoint)
        {
            TransportPipe pipe;
            var customEndpoint = (CustomTcpEndpoint) endpoint;
            if (!_endpointToPipe.TryGetValue(customEndpoint, out pipe))
            {
                pipe = new TcpTransportPipeMultiThread(3000000,
                                                           HighWaterMarkBehavior.Block,
                                                           customEndpoint.EndPoint,
                                                           _transport);
                _endpointToPipe.Add(customEndpoint, pipe);
            }
            var wait = default(SpinWait);
            var sent = false;
            bool first = true;
            var buffer = _serializer.Serialize(message.MessageData);
            do
            {
                sent = pipe.Send(new ArraySegment<byte>(buffer, 0, buffer.Length), true);
                if (!first)
                    wait.SpinOnce();
                else
                    first = false;
            } while (!sent && wait.Count < 1000);

            if (!sent) //peer is disconnected (or underwater from too many message), raise some event?
            {
                Console.WriteLine("AAAAG");
                _logger.Info(string.Format("disconnect of endpoint {0}", customEndpoint.EndPoint));
                EndpointDisconnected(endpoint);
                pipe.Dispose();
                _endpointToPipe.Remove(customEndpoint);
            }
        }
开发者ID:jbouzaglou,项目名称:PetPigeonsESB,代码行数:34,代码来源:ZmqPushWireSendingTransport.cs


示例2: ProcessMessage

		public override void ProcessMessage(IEndpoint endpoint, byte[] data)
		{
			List<byte> package = new List<byte>();
			if (_client == null)
			{
				_client = new TcpClient();
				_client.Connect(_options.Endpoint);

				if (_options.SohDelimiters.Length > 0)
				{
					package.AddRange(_options.SohDelimiters);
				}
			}

			//TODO: If options mandate delimters, write STX and ETX here
			if (_options.StxDelimiters.Length > 0)
			{
				package.AddRange(_options.StxDelimiters);
			}

			package.AddRange(data);

			if (_options.EtxDelimiters.Length > 0)
			{
				package.AddRange(_options.EtxDelimiters);
			}

			Write(package.ToArray());

			if (!_options.KeepConnectionOpen)
			{
				CloseConnection();
			}
		}
开发者ID:NiclasOlofsson,项目名称:HIE,代码行数:34,代码来源:TcpSendEndpoint.cs


示例3: SetUp

 public void SetUp()
 {
     endpoint = A.Fake<IEndpoint>();
     applicationEndpoints = new List<IEndpoint> { endpoint };
     findNextRequestChainPart = A.Fake<IFindNextRequestChainPart>();
     requestGraph = new RequestGraph(applicationEndpoints, findNextRequestChainPart);
 }
开发者ID:UStack,项目名称:UWeb,代码行数:7,代码来源:RequestGraphTests.cs


示例4: Create

        public IClient Create(IEndpoint endpoint, IClientPool ownerPool)
        {
            TSocket socket = null;
            TTransport transport = null;
            if (endpoint.Timeout == 0)
            {
                socket = new TSocket(endpoint.Address, endpoint.Port);
            }
            else
            {
                socket = new TSocket(endpoint.Address, endpoint.Port, endpoint.Timeout);
            }
            TcpClient tcpClient = socket.TcpClient;

            if (this.isBufferSizeSet)
            {
                transport = new TBufferedTransport(socket, this.bufferSize);
            }
            else
            {
                transport = new TBufferedTransport(socket);
            }

            TProtocol protocol = new TBinaryProtocol(transport);
            CassandraClient cassandraClient = new CassandraClient(protocol);
            IClient client = new DefaultClient() {
                CassandraClient = cassandraClient,
                Endpoint = endpoint,
                OwnerPool = ownerPool,
                TcpClient = tcpClient,
                Created = DateTime.Now
            };

            return client;
        }
开发者ID:HappiestTeam,项目名称:Spikes,代码行数:35,代码来源:BufferedTransportConnectionFactory.cs


示例5: Bind

 public override void Bind(IEndpoint endpoint)
 {
     // TODO: ClearOldHeaders
     Open();
     safeChannel.Channel.QueueBind(endpoint.Name, name, endpoint.RoutingKey, endpoint.RoutingHeaders);
     Close();
 }
开发者ID:Elders,项目名称:Cronus.Transport.RabbitMQ,代码行数:7,代码来源:RabbitMqPipeline.cs


示例6: Create

        public IClient Create(IEndpoint endpoint, IClientPool ownerPool)
        {
            TSocket socket = null;
            if (endpoint.Timeout == 0)
            {
                socket = new TSocket(endpoint.Address, endpoint.Port);
            }
            else
            {
                socket = new TSocket(endpoint.Address, endpoint.Port, endpoint.Timeout);
            }
            TcpClient tcpClient = socket.TcpClient;
            TProtocol protocol = new TBinaryProtocol(socket);
            CassandraClient cassandraClient = new CassandraClient(protocol);
            IClient client = new DefaultClient()
            {
                CassandraClient = cassandraClient,
                Endpoint = endpoint,
                OwnerPool = ownerPool,
                TcpClient = tcpClient,
                Created = DateTime.Now
            };

            return client;
        }
开发者ID:HappiestTeam,项目名称:Spikes,代码行数:25,代码来源:DefaultTransportConnectionFactory.cs


示例7: DispatchAction

 public string DispatchAction(IEndpoint endpoint)
 {
     switch (endpoint.ActionName)
     {
         case "RegisterUser":
             return this.ProcessRegisterUserCommand(endpoint.Parameters);
         case "LoginUser":
             return this.ProcessLoginUserCommand(endpoint.Parameters);
         case "LogoutUser":
             return this.ProcessLogoutUserCommand();
         case "CreateIssue":
             return this.ProcessCreateIssueCommand(endpoint.Parameters);
         case "RemoveIssue":
             return this.ProcessRemoveIssueCommand(endpoint.Parameters);
         case "AddComment":
             return this.ProcessAddCommentCommand(endpoint.Parameters);
         case "MyIssues":
             return this.ProcessMyIssuesCommand();
         case "MyComments":
             return this.ProcessMyCommentsCommand();
         case "Search":
             return this.ProcessSearchCommand(endpoint.Parameters);
         default:
             return string.Format(Messages.IvalidActionWithName, endpoint.ActionName);
     }
 }
开发者ID:EBojilova,项目名称:CSharpHQC,代码行数:26,代码来源:Dispatcher.cs


示例8: FindView

        public ViewEngineResult FindView(IEndpoint endpoint)
        {
            var templates = filterViewsCollection.FindTemplates(endpoint, FindAllTemplates()).ToList();

            if (templates.Count < 1) return null;

            if (templates.Count > 1)
                throw new UWebSparkException(
                    string.Format(
                        "More then one template was found for endpoint '{0}.{1}'.\nThe following templates were found: {2}",
                        endpoint.HandlerType.Name, endpoint.Method.Name,
                        string.Join(", ", templates.Select(x => x.Name))));

            var template = templates.Single();

            var descriptor = descriptorBuilder.BuildDescriptor(template, true, null, null);

            var sparkViewEntry = engine.CreateEntry(descriptor);

            var view = sparkViewEntry.CreateInstance() as UWebSparkView;

            if (view != null) view.ResolveDependencies = resolveDependencies;

            return new ViewEngineResult(view);
        }
开发者ID:UStack,项目名称:UWeb,代码行数:25,代码来源:SparkViewEngine.cs


示例9: MapParameters

        private static object[] MapParameters(IEndpoint executionEndpoint, MethodInfo action)
        {
            var methodParams = action.GetParameters();

            var result = new object[methodParams.Length];

            int pos = 0;
            foreach (var param in methodParams)
            {
                object value = null;
                if (param.ParameterType == typeof(DateTime))
                {
                    value = DateTime.ParseExact(
                        executionEndpoint.Parameters[param.Name],
                        Constants.DateFormat,
                        CultureInfo.InvariantCulture);
                }
                else
                {
                    value = Convert.ChangeType(
                        executionEndpoint.Parameters[param.Name],
                        param.ParameterType);
                }

                result[pos++] = value;
            }

            return result;
        }
开发者ID:Nezhdetov,项目名称:Software-University,代码行数:29,代码来源:Engine.cs


示例10: ServiceHeartbeatMonitor

 public ServiceHeartbeatMonitor(IEndpoint publisherEndpoint, IEndpoint subscriberEndpoint, MessageFormatType expectedMessageFormat)
     : this(publisherEndpoint, 
             subscriberEndpoint, 
             new SubscriptionsMsmqChannel(subscriberEndpoint, expectedMessageFormat), 
             new ServiceHeartbeatMsmqChannel(subscriberEndpoint, expectedMessageFormat))
 {
 }
开发者ID:Technicali,项目名称:Broadcaster,代码行数:7,代码来源:ServiceHeartbeatMonitor.cs


示例11: DispatchAction

 public string DispatchAction(IEndpoint endpoint)
 {
     switch (endpoint.ActionName)
     {
         case "RegisterUser":
             return this.tracker.RegisterUser(
                 endpoint.Parameters["username"],
                 endpoint.Parameters["password"],
                 endpoint.Parameters["confirmPassword"]);
         case "LoginUser":
             return this.tracker.LoginUser(endpoint.Parameters["username"], endpoint.Parameters["password"]);
         case "CreateIssue":
             return this.tracker.CreateIssue(
                 endpoint.Parameters["title"],
                 endpoint.Parameters["description"],
                 (IssuePriority)Enum.Parse(typeof(IssuePriority), endpoint.Parameters["priority"], true),
                 endpoint.Parameters["tags"].Split('|'));
         case "RemoveIssue":
             return this.tracker.RemoveIssue(int.Parse(endpoint.Parameters["id"]));
         case "LogoutUser":
             return this.tracker.LogoutUser();
         case "AddComment":
             return this.tracker.AddComment(int.Parse(endpoint.Parameters["id"]), endpoint.Parameters["text"]);
         case "MyIssues":
             return this.tracker.GetMyIssues();
         case "MyComments":
             return this.tracker.GetMyComments();
         case "Search":
             return this.tracker.SearchForIssues(endpoint.Parameters["tags"].Split('|'));
         default:
             return string.Format("Invalid action: {0}", endpoint.ActionName);
     }
 }
开发者ID:ikolev94,项目名称:Exercises,代码行数:33,代码来源:Dispatcher.cs


示例12: Add

 /// <summary>
 /// Adds a named endpoint to the collection
 /// </summary>
 /// <param name="endpointName">The name of the endpoint</param>
 /// <param name="endpoint">The endpoint</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="endpointName"/>
 /// or <paramref name="endpoint"/> are <c>null</c></exception>
 /// <exception cref="EndpointAlreadyExistsException">Thrown if there is already an
 /// endpoint with the specified <paramref name="endpointName"/></exception>
 public void Add(EndpointName endpointName, IEndpoint endpoint)
 {
     if (endpointName == null) throw new ArgumentNullException("endpointName");
     if (endpoint == null) throw new ArgumentNullException("endpoint");
     if (_endpoints.ContainsKey(endpointName)) throw new EndpointAlreadyExistsException(endpointName);
     _endpoints[endpointName] = endpoint;
 }
开发者ID:tdbrian,项目名称:Platibus,代码行数:16,代码来源:EndpointCollection.cs


示例13: GetUrlToRedirectTo

        public RedirectResult GetUrlToRedirectTo(object result, IEndpoint endpoint)
        {
            var redirectable = (IRedirectable) result;
            var redirectResult = redirectable.RedirectTo();

            return new RedirectResult(redirectResult.GetUrl(urlBuilder), redirectable.Permanent);
        }
开发者ID:UStack,项目名称:UWeb,代码行数:7,代码来源:RedirectableRedirectRule.cs


示例14: CompletionAcknowledgementMessage

 public CompletionAcknowledgementMessage(Guid messageId, string messageType, bool processingSuccessful, IEndpoint endpoint)
 {
     MessageId = messageId;
     ProcessingSuccessful = processingSuccessful;
     Endpoint = endpoint;
     MessageType = messageType;
 }
开发者ID:jbouzaglou,项目名称:PetPigeonsESB,代码行数:7,代码来源:CompletionAcknowledgementMessage.cs


示例15: ShadowMessageCommand

 public ShadowMessageCommand(MessageWireData message, PeerId primaryRecipient, bool primaryWasOnline, IEndpoint targetEndpoint)
 {
     Message = message;
     PrimaryRecipient = primaryRecipient;
     PrimaryWasOnline = primaryWasOnline;
     TargetEndpoint = targetEndpoint;
 }
开发者ID:jbouzaglou,项目名称:PetPigeonsESB,代码行数:7,代码来源:ShadowMessageCommand.cs


示例16: Build

        public IMessageTopology Build(IEndpoint endpoint)
        {
            var topology = new MessageTopology();
            topology.PublishExchange = topology.DefineExchange(endpoint.Name, ExchangeType.Topic);

            return topology;
        }
开发者ID:jamescrowley,项目名称:chinchilla,代码行数:7,代码来源:MessagePublisherTopology.cs


示例17: MapParameters

        private static object[] MapParameters(IEndpoint executionEndpoint, MethodInfo action)
        {
            var parameters = action
                             .GetParameters()
                             .Select<ParameterInfo, object>(p =>
            {
                if (p.ParameterType == typeof(int))
                {
                    return int.Parse(executionEndpoint.Parameters[p.Name]);
                }
                else if (p.ParameterType == typeof(DateTime))
                {
                    return DateTime.ParseExact(executionEndpoint.Parameters[p.Name], Constants.DateFormat, CultureInfo.InvariantCulture);
                } 
                else if (p.ParameterType == typeof(decimal))
                {
                    return decimal.Parse(executionEndpoint.Parameters[p.Name]);
                }
                else
                {
                    return executionEndpoint.Parameters[p.Name];
                }
            })
                             .ToArray();

            return parameters;
        }
开发者ID:LyuboslavLyubenov,项目名称:High-quality-Code,代码行数:27,代码来源:CheperaleBookingEngine.cs


示例18: AuthenticateEndpoint

 public AuthenticateEndpoint(IEndpoint endpoint, IAuthenticationRuleCollection authenticationRuleCollection, IAuthentication authentication, 
     IOutputWriter outputWriter)
 {
     this.endpoint = endpoint;
     this.authenticationRuleCollection = authenticationRuleCollection;
     this.authentication = authentication;
     this.outputWriter = outputWriter;
 }
开发者ID:UStack,项目名称:UWeb,代码行数:8,代码来源:AuthenticateEndpoint.cs


示例19: MessageSubscription

 public MessageSubscription(Type messageType, PeerId peer, IEndpoint endpoint, ISubscriptionFilter subscriptionFilter, ReliabilityLevel reliabilityLevel)
 {
     MessageType = messageType;
     Peer = peer;
     Endpoint = endpoint;
     SubscriptionFilter = (subscriptionFilter);
     ReliabilityLevel = reliabilityLevel;
 }
开发者ID:jbouzaglou,项目名称:PetPigeonsESB,代码行数:8,代码来源:MessageSubscription.cs


示例20: Save

 public void Save(IEndpoint endpoint)
 {
     var key = endpoint.Name.ToLower();
     if (Endpoints.ContainsKey(key))
         Endpoints[key] = endpoint;
     else
         Endpoints.Add(key, endpoint);
 }
开发者ID:redrockethq,项目名称:Ignitor.ServiceBus,代码行数:8,代码来源:EndpointManager.cs



注:本文中的IEndpoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IEndpointInstance类代码示例发布时间:2022-05-24
下一篇:
C# IEncryptionService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap