当前位置: 首页>>代码示例>>C#>>正文


C# IEndpoint类代码示例

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


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


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