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


C# IClientMessage.GetCorrelationId方法代码示例

本文整理汇总了C#中IClientMessage.GetCorrelationId方法的典型用法代码示例。如果您正苦于以下问题:C# IClientMessage.GetCorrelationId方法的具体用法?C# IClientMessage.GetCorrelationId怎么用?C# IClientMessage.GetCorrelationId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IClientMessage的用法示例。


在下文中一共展示了IClientMessage.GetCorrelationId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartListening

 public string StartListening(IClientMessage request, DistributedEventHandler handler,
     DecodeStartListenerResponse responseDecoder, object key = null)
 {
     try
     {
         IFuture<IClientMessage> task;
         if (key == null)
         {
             task = _client.GetInvocationService()
                 .InvokeListenerOnRandomTarget(request, handler, responseDecoder);
         }
         else
         {
             task = _client.GetInvocationService()
                 .InvokeListenerOnKeyOwner(request, key, handler, responseDecoder);
         }
         var clientMessage = ThreadUtil.GetResult(task);
         var registrationId = responseDecoder(clientMessage);
         RegisterListener(registrationId, request.GetCorrelationId());
         return registrationId;
     }
     catch (Exception e)
     {
         throw ExceptionUtil.Rethrow(e);
     }
 }
开发者ID:ihsandemir,项目名称:hazelcast-csharp-client,代码行数:26,代码来源:ClientListenerService.cs

示例2: HandleResponseMessage

        private void HandleResponseMessage(IClientMessage response)
        {
            var correlationId = response.GetCorrelationId();
            ClientInvocation invocation;
            if (_invocations.TryRemove(correlationId, out invocation))
            {
                if (response.GetMessageType() == Error.Type)
                {
                    var error = Error.Decode(response);
                    var exception = ExceptionUtil.ToException(error);

                    // retry only specific exceptions
                    HandleException(invocation, exception);
                }
                // if this was a re-registration operation, then we will throw away the response and just store the alias
                else if (invocation is ClientListenerInvocation && invocation.Future.IsComplete &&
                         invocation.Future.Result != null)
                {
                    var listenerInvocation = (ClientListenerInvocation) invocation;
                    var originalRegistrationId = GetRegistrationIdFromResponse(listenerInvocation);
                    var newRegistrationId = listenerInvocation.ResponseDecoder(response);
                    _client.GetListenerService()
                        .ReregisterListener(originalRegistrationId, newRegistrationId,
                            invocation.Message.GetCorrelationId());
                    if (Logger.IsFinestEnabled())
                    {
                        Logger.Finest(string.Format("Re-registered listener for {0} of type {1:X}",
                            originalRegistrationId,
                            listenerInvocation.Message.GetMessageType()));
                    }
                }
                else
                {
                    invocation.Future.Result = response;
                }
            }
            else
            {
                Logger.Warning("No call for correlationId: " + correlationId + ", response: " + response);
            }
        }
开发者ID:ihsandemir,项目名称:hazelcast-csharp-client,代码行数:41,代码来源:ClientInvocationService.cs

示例3: HandleEventMessage

 private void HandleEventMessage(IClientMessage eventMessage)
 {
     var correlationId = eventMessage.GetCorrelationId();
     ClientListenerInvocation invocationWithHandler;
     if (!_listenerInvocations.TryGetValue(correlationId, out invocationWithHandler))
     {
         // no event handler found, could be that the event is already unregistered
         Logger.Warning("No eventHandler for correlationId: " + correlationId + ", event: " + eventMessage);
         return;
     }
     invocationWithHandler.Handler(eventMessage);
 }
开发者ID:ihsandemir,项目名称:hazelcast-csharp-client,代码行数:12,代码来源:ClientInvocationService.cs


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