00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _ACTIVEMQ_COMMANDS_MESSAGE_H_ 00019 #define _ACTIVEMQ_COMMANDS_MESSAGE_H_ 00020 00021 // Turn off warning message for ignored exception specification 00022 #ifdef _MSC_VER 00023 #pragma warning( disable : 4290 ) 00024 #endif 00025 00026 #include <activemq/commands/ActiveMQDestination.h> 00027 #include <activemq/commands/BaseCommand.h> 00028 #include <activemq/commands/BrokerId.h> 00029 #include <activemq/commands/ConsumerId.h> 00030 #include <activemq/commands/DataStructure.h> 00031 #include <activemq/commands/MessageId.h> 00032 #include <activemq/commands/ProducerId.h> 00033 #include <activemq/commands/TransactionId.h> 00034 #include <activemq/core/ActiveMQAckHandler.h> 00035 #include <activemq/util/Config.h> 00036 #include <activemq/util/PrimitiveMap.h> 00037 #include <decaf/lang/Pointer.h> 00038 #include <string> 00039 #include <vector> 00040 00041 namespace activemq{ 00042 namespace core{ 00043 class ActiveMQAckHandler; 00044 class ActiveMQConnection; 00045 } 00046 namespace commands{ 00047 00048 using decaf::lang::Pointer; 00049 00050 /* 00051 * 00052 * Command code for OpenWire format for Message 00053 * 00054 * NOTE!: This file is auto generated - do not modify! 00055 * if you need to make a change, please see the Java Classes 00056 * in the activemq-cpp-openwire-generator module 00057 * 00058 */ 00059 class AMQCPP_API Message : public BaseCommand { 00060 protected: 00061 00062 Pointer<ProducerId> producerId; 00063 Pointer<ActiveMQDestination> destination; 00064 Pointer<TransactionId> transactionId; 00065 Pointer<ActiveMQDestination> originalDestination; 00066 Pointer<MessageId> messageId; 00067 Pointer<TransactionId> originalTransactionId; 00068 std::string groupID; 00069 int groupSequence; 00070 std::string correlationId; 00071 bool persistent; 00072 long long expiration; 00073 unsigned char priority; 00074 Pointer<ActiveMQDestination> replyTo; 00075 long long timestamp; 00076 std::string type; 00077 std::vector<unsigned char> content; 00078 std::vector<unsigned char> marshalledProperties; 00079 Pointer<DataStructure> dataStructure; 00080 Pointer<ConsumerId> targetConsumerId; 00081 bool compressed; 00082 int redeliveryCounter; 00083 std::vector< decaf::lang::Pointer<BrokerId> > brokerPath; 00084 long long arrival; 00085 std::string userID; 00086 bool recievedByDFBridge; 00087 bool droppable; 00088 std::vector< decaf::lang::Pointer<BrokerId> > cluster; 00089 long long brokerInTime; 00090 long long brokerOutTime; 00091 00092 public: 00093 00094 const static unsigned char ID_MESSAGE = 0; 00095 00096 private: 00097 00098 // Used to allow a client to call Message::acknowledge when in the Client 00099 // Ack mode. 00100 Pointer<core::ActiveMQAckHandler> ackHandler; 00101 00102 // Message properties, these are Marshaled and Unmarshaled from the Message 00103 // Command's marshaledProperties vector. 00104 activemq::util::PrimitiveMap properties; 00105 00106 // Indicates if the Message Properties are Read Only 00107 bool readOnlyProperties; 00108 00109 // Indicates if the Message Body are Read Only 00110 bool readOnlyBody; 00111 00112 protected: 00113 00114 core::ActiveMQConnection* connection; 00115 00116 static const unsigned int DEFAULT_MESSAGE_SIZE = 1024; 00117 00118 private: 00119 00120 Message(const Message&); 00121 Message& operator= (const Message&); 00122 00123 public: 00124 00125 Message(); 00126 00127 virtual ~Message(); 00128 00129 virtual unsigned char getDataStructureType() const; 00130 00131 virtual Message* cloneDataStructure() const; 00132 00133 virtual void copyDataStructure(const DataStructure* src); 00134 00135 virtual std::string toString() const; 00136 00137 virtual bool equals(const DataStructure* value) const; 00138 00147 Pointer<Message> copy() const { 00148 return Pointer<Message>(this->cloneDataStructure()); 00149 } 00150 00157 virtual void beforeMarshal(wireformat::WireFormat* wireFormat AMQCPP_UNUSED); 00158 00164 virtual void afterUnmarshal(wireformat::WireFormat* wireFormat AMQCPP_UNUSED); 00165 00171 virtual bool isMarshalAware() const { 00172 return true; 00173 } 00174 00180 virtual void setAckHandler(const Pointer<core::ActiveMQAckHandler>& handler) { 00181 this->ackHandler = handler; 00182 } 00183 00189 virtual Pointer<core::ActiveMQAckHandler> getAckHandler() const { 00190 return this->ackHandler; 00191 } 00192 00198 void setConnection(core::ActiveMQConnection* connection) { 00199 this->connection = connection; 00200 } 00201 00207 core::ActiveMQConnection* getConnection() const { 00208 return this->connection; 00209 } 00210 00215 virtual unsigned int getSize() const; 00216 00222 virtual bool isExpired() const; 00223 00227 virtual void onSend() {} 00228 00235 util::PrimitiveMap& getMessageProperties() { 00236 return this->properties; 00237 } 00238 const util::PrimitiveMap& getMessageProperties() const { 00239 return this->properties; 00240 } 00241 00246 bool isReadOnlyProperties() const { 00247 return this->readOnlyProperties; 00248 } 00249 00254 void setReadOnlyProperties(bool value) { 00255 this->readOnlyProperties = value; 00256 } 00257 00262 bool isReadOnlyBody() const { 00263 return this->readOnlyBody; 00264 } 00265 00270 void setReadOnlyBody(bool value) { 00271 this->readOnlyBody = value; 00272 } 00273 00274 virtual const Pointer<ProducerId>& getProducerId() const; 00275 virtual Pointer<ProducerId>& getProducerId(); 00276 virtual void setProducerId( const Pointer<ProducerId>& producerId ); 00277 00278 virtual const Pointer<ActiveMQDestination>& getDestination() const; 00279 virtual Pointer<ActiveMQDestination>& getDestination(); 00280 virtual void setDestination( const Pointer<ActiveMQDestination>& destination ); 00281 00282 virtual const Pointer<TransactionId>& getTransactionId() const; 00283 virtual Pointer<TransactionId>& getTransactionId(); 00284 virtual void setTransactionId( const Pointer<TransactionId>& transactionId ); 00285 00286 virtual const Pointer<ActiveMQDestination>& getOriginalDestination() const; 00287 virtual Pointer<ActiveMQDestination>& getOriginalDestination(); 00288 virtual void setOriginalDestination( const Pointer<ActiveMQDestination>& originalDestination ); 00289 00290 virtual const Pointer<MessageId>& getMessageId() const; 00291 virtual Pointer<MessageId>& getMessageId(); 00292 virtual void setMessageId( const Pointer<MessageId>& messageId ); 00293 00294 virtual const Pointer<TransactionId>& getOriginalTransactionId() const; 00295 virtual Pointer<TransactionId>& getOriginalTransactionId(); 00296 virtual void setOriginalTransactionId( const Pointer<TransactionId>& originalTransactionId ); 00297 00298 virtual const std::string& getGroupID() const; 00299 virtual std::string& getGroupID(); 00300 virtual void setGroupID( const std::string& groupID ); 00301 00302 virtual int getGroupSequence() const; 00303 virtual void setGroupSequence( int groupSequence ); 00304 00305 virtual const std::string& getCorrelationId() const; 00306 virtual std::string& getCorrelationId(); 00307 virtual void setCorrelationId( const std::string& correlationId ); 00308 00309 virtual bool isPersistent() const; 00310 virtual void setPersistent( bool persistent ); 00311 00312 virtual long long getExpiration() const; 00313 virtual void setExpiration( long long expiration ); 00314 00315 virtual unsigned char getPriority() const; 00316 virtual void setPriority( unsigned char priority ); 00317 00318 virtual const Pointer<ActiveMQDestination>& getReplyTo() const; 00319 virtual Pointer<ActiveMQDestination>& getReplyTo(); 00320 virtual void setReplyTo( const Pointer<ActiveMQDestination>& replyTo ); 00321 00322 virtual long long getTimestamp() const; 00323 virtual void setTimestamp( long long timestamp ); 00324 00325 virtual const std::string& getType() const; 00326 virtual std::string& getType(); 00327 virtual void setType( const std::string& type ); 00328 00329 virtual const std::vector<unsigned char>& getContent() const; 00330 virtual std::vector<unsigned char>& getContent(); 00331 virtual void setContent( const std::vector<unsigned char>& content ); 00332 00333 virtual const std::vector<unsigned char>& getMarshalledProperties() const; 00334 virtual std::vector<unsigned char>& getMarshalledProperties(); 00335 virtual void setMarshalledProperties( const std::vector<unsigned char>& marshalledProperties ); 00336 00337 virtual const Pointer<DataStructure>& getDataStructure() const; 00338 virtual Pointer<DataStructure>& getDataStructure(); 00339 virtual void setDataStructure( const Pointer<DataStructure>& dataStructure ); 00340 00341 virtual const Pointer<ConsumerId>& getTargetConsumerId() const; 00342 virtual Pointer<ConsumerId>& getTargetConsumerId(); 00343 virtual void setTargetConsumerId( const Pointer<ConsumerId>& targetConsumerId ); 00344 00345 virtual bool isCompressed() const; 00346 virtual void setCompressed( bool compressed ); 00347 00348 virtual int getRedeliveryCounter() const; 00349 virtual void setRedeliveryCounter( int redeliveryCounter ); 00350 00351 virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath() const; 00352 virtual std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath(); 00353 virtual void setBrokerPath( const std::vector< decaf::lang::Pointer<BrokerId> >& brokerPath ); 00354 00355 virtual long long getArrival() const; 00356 virtual void setArrival( long long arrival ); 00357 00358 virtual const std::string& getUserID() const; 00359 virtual std::string& getUserID(); 00360 virtual void setUserID( const std::string& userID ); 00361 00362 virtual bool isRecievedByDFBridge() const; 00363 virtual void setRecievedByDFBridge( bool recievedByDFBridge ); 00364 00365 virtual bool isDroppable() const; 00366 virtual void setDroppable( bool droppable ); 00367 00368 virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getCluster() const; 00369 virtual std::vector< decaf::lang::Pointer<BrokerId> >& getCluster(); 00370 virtual void setCluster( const std::vector< decaf::lang::Pointer<BrokerId> >& cluster ); 00371 00372 virtual long long getBrokerInTime() const; 00373 virtual void setBrokerInTime( long long brokerInTime ); 00374 00375 virtual long long getBrokerOutTime() const; 00376 virtual void setBrokerOutTime( long long brokerOutTime ); 00377 00381 virtual bool isMessage() const { 00382 return true; 00383 } 00384 00385 virtual Pointer<Command> visit(activemq::state::CommandVisitor* visitor); 00386 00387 }; 00388 00389 }} 00390 00391 #endif /*_ACTIVEMQ_COMMANDS_MESSAGE_H_*/
1.6.1