public override ResponseHeader Publish(
RequestHeader requestHeader,
SubscriptionAcknowledgementCollection subscriptionAcknowledgements,
out uint subscriptionId,
out UInt32Collection availableSequenceNumbers,
out bool moreNotifications,
out NotificationMessage notificationMessage,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
OperationContext context = ValidateRequest(requestHeader, RequestType.Publish);
try
{
/*
// check if there is an odd delay.
if (DateTime.UtcNow > requestHeader.Timestamp.AddMilliseconds(100))
{
Utils.Trace(
"WARNING. Unexpected delay receiving Publish request. Time={0:hh:mm:ss.fff}, ReceiveTime={1:hh:mm:ss.fff}",
DateTime.UtcNow,
requestHeader.Timestamp);
}
*/
// Utils.Trace("PUBLISH #{0} RECIEVED. TIME={1:hh:hh:ss.fff}", requestHeader.RequestHandle, requestHeader.Timestamp);
notificationMessage = ServerInternal.SubscriptionManager.Publish(
context,
subscriptionAcknowledgements,
null,
out subscriptionId,
out availableSequenceNumbers,
out moreNotifications,
out results,
out diagnosticInfos);
/*
if (notificationMessage != null)
{
Utils.Trace(
"PublishResponse: SubId={0} SeqNo={1}, PublishTime={2:mm:ss.fff}, Time={3:mm:ss.fff}",
subscriptionId,
notificationMessage.SequenceNumber,
notificationMessage.PublishTime,
DateTime.UtcNow);
}
*/
return CreateResponse(requestHeader, context.StringTable);
}
catch (ServiceResultException e)
{
lock (ServerInternal.DiagnosticsLock)
{
ServerInternal.ServerDiagnostics.RejectedRequestsCount++;
if (IsSecurityError(e.StatusCode))
{
ServerInternal.ServerDiagnostics.SecurityRejectedRequestsCount++;
}
}
throw TranslateException(context, e);
}
finally
{
OnRequestComplete(context);
}
}