private ExtensibleMessageInfo[] GetMessageInfo(long internalId) { TextFilter obj = new TextFilter(MessageInfoSchema.Identity, new MessageIdentity(internalId).ToString(), MatchOptions.FullString, MatchFlags.Default); byte[] queryFilterBytes = Serialization.ObjectToBytes(obj); byte[] sortOrder = Serialization.ObjectToBytes(QueueClient.emptySortOrder); int num = 0; int num2 = 0; Exception ex = null; try { byte[] queueViewerObjectPage = base.GetQueueViewerObjectPage(QVObjectType.MessageInfo, queryFilterBytes, sortOrder, true, int.MaxValue, null, -1, false, true, true, null, ref num, ref num2); return(this.GetExtensibleMessageInfo((MessageInfo[])Serialization.BytesToObject(queueViewerObjectPage))); } catch (RpcException ex2) { ex = ex2; } catch (SerializationException ex3) { ex = ex3; } TraceWrapper.SearchLibraryTracer.TraceError <Exception>(this.GetHashCode(), "RPC or Deserialize exception: {0}", ex); TrackingTransientException.AddAndRaiseETX(this.directoryContext.Errors, ErrorCode.QueueViewerConnectionFailure, this.serverName, ex.ToString()); return(null); }
private List <MessageTrackingLogEntry> ReadLogs(RpcReason rpcReason, string logFilePrefix, ProxyAddressCollection senderProxyAddresses, string messageId, DateTime startTime, DateTime endTime, TrackingEventBudget eventBudget) { Exception ex = null; int num = 0; List <MessageTrackingLogEntry> list = null; bool flag = !string.IsNullOrEmpty(messageId); bool flag2 = senderProxyAddresses != null; if (flag && flag2) { throw new InvalidOperationException("Cannot get logs with both message id and sender address criteria"); } if (rpcReason == RpcReason.None) { InfoWorkerMessageTrackingPerformanceCounters.GetMessageTrackingReportQueries.Increment(); } else { InfoWorkerMessageTrackingPerformanceCounters.SearchMessageTrackingReportQueries.Increment(); } try { this.context.DiagnosticsContext.LogRpcStart(this.server, rpcReason); using (LogSearchCursor cursor = TrackingSearch.GetCursor(this.server, this.version, logFilePrefix, messageId, senderProxyAddresses, startTime, endTime)) { list = this.ReadLogsFromCursor(cursor, eventBudget); } } catch (LogSearchException ex2) { ex = ex2; num = ex2.ErrorCode; } catch (RpcException ex3) { ex = ex3; num = ex3.ErrorCode; } finally { this.context.DiagnosticsContext.LogRpcEnd(ex, (list == null) ? 0 : list.Count); } if (ex != null) { TraceWrapper.SearchLibraryTracer.TraceError(this.GetHashCode(), "Error reading from log-search RPC server for {0}: {1}, ErrorCode: {2}, Exception: {3}", new object[] { flag ? "message id" : "sender", flag ? messageId : senderProxyAddresses[0].ToString(), num, ex }); TrackingTransientException.AddAndRaiseETX(this.context.Errors, ErrorCode.LogSearchConnection, this.server, ex.ToString()); } return(list); }
public static bool TryRead(string server, LogSearchCursor cursor, BitArray fieldsToGet, TrackingErrorCollection errors, out MessageTrackingLogRow logEntry) { logEntry = null; MessageTrackingLogRow messageTrackingLogRow = new MessageTrackingLogRow(); messageTrackingLogRow.serverFqdn = server; for (int i = 0; i < fieldsToGet.Length; i++) { if (fieldsToGet[i]) { object obj = null; Exception ex = null; try { obj = cursor.GetField(i); } catch (LogSearchException ex2) { ex = ex2; int errorCode = ex2.ErrorCode; } catch (RpcException ex3) { ex = ex3; int errorCode2 = ex3.ErrorCode; } if (ex != null) { TrackingTransientException.AddAndRaiseETX(errors, ErrorCode.LogSearchConnection, server, ex.ToString()); } if (obj != null && obj.GetType() != MessageTrackingSchema.MessageTrackingEvent.Fields[i].Type) { throw new InvalidOperationException(string.Format("Schema for column {0} in message-tracking is of sync with tasks", i)); } if (!MessageTrackingLogRow.ValidateField(messageTrackingLogRow, i, obj, errors)) { return(false); } messageTrackingLogRow.columns[i] = cursor.GetField(i); messageTrackingLogRow.validColumns[i] = true; } } if (fieldsToGet[8] && (messageTrackingLogRow.EventId == MessageTrackingEvent.EXPAND || messageTrackingLogRow.EventId == MessageTrackingEvent.RESOLVE)) { MessageTrackingLogRow.SmtpAddressValidatorWithNull(messageTrackingLogRow.RelatedRecipientAddress); } logEntry = messageTrackingLogRow; return(true); }