00001 #ifndef _broker_BrokerMessageMessage_h
00002 #define _broker_BrokerMessageMessage_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "BrokerMessageBase.h"
00025 #include "qpid/framing/MessageTransferBody.h"
00026 #include "qpid/framing/amqp_types.h"
00027 #include <boost/weak_ptr.hpp>
00028 #include <vector>
00029
00030 namespace qpid {
00031
00032 namespace framing {
00033 class MessageTransferBody;
00034 }
00035
00036 namespace broker {
00037 class ConnectionToken;
00038 class Reference;
00039
00040 class MessageMessage: public Message{
00041 public:
00042 typedef boost::shared_ptr<MessageMessage> shared_ptr;
00043 typedef boost::shared_ptr<framing::MessageTransferBody> TransferPtr;
00044 typedef boost::shared_ptr<Reference> ReferencePtr;
00045
00046 MessageMessage(ConnectionToken* publisher, framing::RequestId, TransferPtr transfer);
00047 MessageMessage(ConnectionToken* publisher, framing::RequestId, TransferPtr transfer, ReferencePtr reference);
00048 MessageMessage();
00049
00050
00051
00052 framing::RequestId getRequestId() const {return requestId; }
00053 TransferPtr getTransfer() const { return transfer; }
00054 ReferencePtr getReference() const ;
00055
00056 void deliver(framing::ChannelAdapter& channel,
00057 const std::string& consumerTag,
00058 uint64_t deliveryTag,
00059 uint32_t framesize);
00060
00061 void sendGetOk(const framing::MethodContext& context,
00062 const std::string& destination,
00063 uint32_t messageCount,
00064 uint64_t deliveryTag,
00065 uint32_t framesize);
00066
00067 bool isComplete();
00068
00069 uint64_t contentSize() const;
00070 framing::BasicHeaderProperties* getHeaderProperties();
00071 const framing::FieldTable& getApplicationHeaders();
00072 bool isPersistent();
00073
00074 void encode(framing::Buffer& buffer) const;
00075 void encodeHeader(framing::Buffer& buffer) const;
00076 uint32_t encodedSize() const;
00077 uint32_t encodedHeaderSize() const;
00078 uint32_t encodedContentSize() const;
00079 uint64_t expectedContentSize();
00080 void decodeHeader(framing::Buffer& buffer);
00081 void decodeContent(framing::Buffer& buffer, uint32_t contentChunkSize = 0);
00082
00083 private:
00084 void transferMessage(
00085 framing::ChannelAdapter& channel,
00086 const std::string& consumerTag,
00087 uint32_t framesize);
00088
00089 framing::MessageTransferBody* copyTransfer(
00090 const framing::ProtocolVersion& version,
00091 const std::string& destination,
00092 const framing::Content& body) const;
00093
00094 framing::RequestId requestId;
00095 const TransferPtr transfer;
00096 const boost::shared_ptr<Reference> reference;
00097 };
00098
00099 }}
00100
00101
00102 #endif