Пример #1
0
 /// <summary>
 ///     Returns null, if incomplete EventMessageArray.
 /// </summary>
 /// <param name="eventList"></param>
 /// <param name="eventMessages"></param>
 /// <returns></returns>
 private Server.EventMessage[]? EventMessagesCallback(ClientEventList eventList, EventMessagesCollection eventMessagesCollection)
 {
     Server.EventMessage[]? newEventMessages = eventList.EventMessagesCallback(eventMessagesCollection);
     if (newEventMessages is not null && newEventMessages.Length > 0)
     {
         eventList.RaiseEventMessagesCallbackEvent(newEventMessages);
     }
     return(newEventMessages);
 }
Пример #2
0
        public Server.EventMessage[] ReadEventMessagesJournal(ClientEventList clientEventList, DateTime firstTimestampUtc, DateTime secondTimestampUtc, CaseInsensitiveDictionary <string>?params_)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("Cannot access a disposed ClientContext.");
            }

            if (!ServerContextIsOperational)
            {
                throw new InvalidOperationException();
            }

            try
            {
                while (true)
                {
                    var request = new ReadEventMessagesJournalRequest
                    {
                        ContextId       = _serverContextId,
                        ListServerAlias = clientEventList.ListServerAlias,
                        FirstTimestamp  = DateTimeHelper.ConvertToTimestamp(firstTimestampUtc),
                        SecondTimestamp = DateTimeHelper.ConvertToTimestamp(secondTimestampUtc),
                    };
                    if (params_ is not null)
                    {
                        request.Params.Add(params_);
                    }
                    ReadEventMessagesJournalReply reply = _resourceManagementClient.ReadEventMessagesJournal(request);
                    SetResourceManagementLastCallUtc();

                    var result = clientEventList.EventMessagesCallback(reply.EventMessagesCollection);
                    if (result is not null)
                    {
                        return(result);
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessRemoteMethodCallException(ex);
                throw;
            }
        }