Пример #1
0
        /// <summary>
        /// Sends a GetPartsResponse message to a customer.
        /// </summary>
        /// <param name="correlatedHeader">The message header that the messages to send are correlated with.</param>
        /// <param name="parts">The parts.</param>
        /// <param name="context">The response context.</param>
        /// <param name="isFinalPart">Whether or not this is the final part of a multi-part message.</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <GetPartsResponse> GetPartsResponse(IMessageHeader correlatedHeader, IDictionary <string, ObjectPart> parts, ResponseContext context, bool isFinalPart = true, IMessageHeaderExtension extension = null)
        {
            var body = new GetPartsResponse
            {
                Uri    = context?.Uri ?? string.Empty,
                Format = context?.Format ?? Formats.Xml,
                Parts  = parts ?? new Dictionary <string, ObjectPart>(),
            };

            return(SendResponse(body, correlatedHeader, extension: extension, isMultiPart: true, isFinalPart: isFinalPart));
        }
Пример #2
0
        /// <summary>
        /// Sends a single list item as a response for GetPart and GetPartsByRange.
        /// </summary>
        /// <param name="uri">The URI of the parent object.</param>
        /// <param name="uid">The ID of the element within the list.</param>
        /// <param name="contentType">The content type string.</param>
        /// <param name="data">The data.</param>
        /// <param name="correlationId">The correlation identifier.</param>
        /// <param name="messageFlag">The message flag.</param>
        /// <returns>The message identifier.</returns>
        public long GetPartsResponse(string uri, string uid, string contentType, byte[] data, long correlationId, MessageFlags messageFlag = MessageFlags.MultiPartAndFinalPart)
        {
            var header = CreateMessageHeader(Protocols.GrowingObject, MessageTypes.GrowingObject.GetPartsResponse, correlationId, messageFlag);

            var message = new GetPartsResponse
            {
                ObjectPart = new ObjectPart
                {
                    Uri         = uri,
                    Uid         = uid,
                    ContentType = contentType,
                    Data        = data
                }
            };

            return(Session.SendMessage(header, message));
        }
 /// <summary>
 /// Handles the GetPartsResponse message from a store.
 /// </summary>
 /// <param name="header">The message header.</param>
 /// <param name="message">The GetPartsResponse message.</param>
 protected virtual void HandleGetPartsResponse(IMessageHeader header, GetPartsResponse message)
 {
     Notify(OnGetPartsResponse, header, message);
 }