/// <summary> /// Sends a NotificationRequest message to a store. /// </summary> /// <param name="request">The request.</param> /// <returns>The message identifier.</returns> public long NotificationRequest(NotificationRequestRecord request) { var header = CreateMessageHeader(Protocols.StoreNotification, MessageTypes.StoreNotification.NotificationRequest); var notificationRequest = new NotificationRequest() { Request = request }; return(Session.SendMessage(header, notificationRequest)); }
/// <summary> /// Sends a RequestPartNotification message to a store. /// </summary> /// <param name="request">The request.</param> /// <returns>The message identifier.</returns> public long RequestPartNotification(NotificationRequestRecord request) { var header = CreateMessageHeader(Protocols.GrowingObjectNotification, MessageTypes.GrowingObjectNotification.RequestPartNotification); var notificationRequest = new RequestPartNotification { Request = request }; return(Session.SendMessage(header, notificationRequest)); }
/// <summary> /// Creates a new notification request record. /// </summary> /// <returns>A new <see cref="NotificationRequestRecord"/> instance.</returns> private NotificationRequestRecord CreateNotificationRequest() { var request = new NotificationRequestRecord { Uri = Model.StoreNotification.Uri, Uuid = Model.StoreNotification.Uuid, StartTime = Model.StoreNotification.StartTime.ToUnixTimeMicroseconds(), IncludeObjectData = Model.StoreNotification.IncludeObjectData, ObjectTypes = Model.StoreNotification.ObjectTypes.ToArray() }; _requests.Add(request); return(request); }
/// <summary> /// Sends a NotificationRequest message to a store. /// </summary> /// <param name="request">The request.</param> /// <returns>The sent message on success; <c>null</c> otherwise.</returns> public virtual EtpMessage <NotificationRequest> NotificationRequest(NotificationRequestRecord request) { var body = new NotificationRequest() { Request = request, }; var message = SendRequest(body, onBeforeSend: (m) => TryRegisterSubscription(request, nameof(request.Uuid), m, request)); if (message == null) { TryUnregisterSubscription(request); } return(message); }
/// <summary> /// Sends the NotificationRequest message with the specified attributes. /// </summary> /// <param name="uri">The URI.</param> /// <param name="uuid">The UUID.</param> /// <param name="startTime">The start time, in microseconds.</param> /// <param name="includeObjectData"><c>true</c> if the data object should be included in the notification; otherwise, <c>false</c>.</param> /// <param name="objectTypes">The object types.</param> public void NotificationRequest(string uri, string uuid, long startTime, bool includeObjectData, IList <string> objectTypes) { if (!Session.IsRegistered <IStoreNotificationCustomer>()) { return; } var request = new NotificationRequestRecord { Uri = uri, Uuid = uuid, StartTime = startTime, IncludeObjectData = includeObjectData, ObjectTypes = objectTypes.ToArray() }; _notificationRequests.Add(request); Session.Handler <IStoreNotificationCustomer>() .NotificationRequest(request); }