/// <summary>
        /// Sends a GetObject message to a store.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="messageFlag">The message flag.</param>
        /// <returns>The message identifier.</returns>
        public virtual long GetObject(string uri, MessageFlags messageFlag = MessageFlags.MultiPartAndFinalPart)
        {
            var header = CreateMessageHeader(Protocols.Store, MessageTypes.Store.GetObject, messageFlags: messageFlag);

            var getObject = new GetObject()
            {
                Uri = uri
            };

            return(Session.SendMessage(header, getObject));
        }
示例#2
0
        /// <summary>
        /// Handles the GetObject message from a customer.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="getObject">The GetObject message.</param>
        protected virtual void HandleGetObject(IMessageHeader header, GetObject getObject)
        {
            var args = Notify(OnGetObject, header, getObject, new DataObject());

            HandleGetObject(args);

            if (args.Cancel)
            {
                return;
            }

            if (args.Context.Data == null || args.Context.Data.Length == 0)
            {
                Object(args.Context, header.MessageId, MessageFlags.NoData);
            }
            else
            {
                Object(args.Context, header.MessageId);
            }
        }