activemq-cpp-3.3.0

src/main/activemq/commands/Message.h

Go to the documentation of this file.
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 
00145         virtual void beforeMarshal( wireformat::WireFormat* wireFormat AMQCPP_UNUSED );
00146 
00152         virtual void afterUnmarshal( wireformat::WireFormat* wireFormat AMQCPP_UNUSED );
00153 
00159         virtual bool isMarshalAware() const {
00160             return true;
00161         }
00162 
00168         virtual void setAckHandler( const Pointer<core::ActiveMQAckHandler>& handler ) {
00169             this->ackHandler = handler;
00170         }
00171 
00177         virtual Pointer<core::ActiveMQAckHandler> getAckHandler() const {
00178             return this->ackHandler;
00179         }
00180 
00186         void setConnection( core::ActiveMQConnection* connection ) {
00187             this->connection = connection;
00188         }
00189 
00195         core::ActiveMQConnection* getConnection() const {
00196             return this->connection;
00197         }
00198 
00203         virtual unsigned int getSize() const;
00204 
00210         virtual bool isExpired() const;
00211 
00215         virtual void onSend() {}
00216 
00223         util::PrimitiveMap& getMessageProperties() {
00224             return this->properties;
00225         }
00226         const util::PrimitiveMap& getMessageProperties() const {
00227             return this->properties;
00228         }
00229 
00234         bool isReadOnlyProperties() const {
00235             return this->readOnlyProperties;
00236         }
00237 
00242         void setReadOnlyProperties( bool value ) {
00243             this->readOnlyProperties = value;
00244         }
00245 
00250         bool isReadOnlyBody() const {
00251             return this->readOnlyBody;
00252         }
00253 
00258         void setReadOnlyBody( bool value ) {
00259             this->readOnlyBody = value;
00260         }
00261 
00262         virtual const Pointer<ProducerId>& getProducerId() const;
00263         virtual Pointer<ProducerId>& getProducerId();
00264         virtual void setProducerId( const Pointer<ProducerId>& producerId );
00265 
00266         virtual const Pointer<ActiveMQDestination>& getDestination() const;
00267         virtual Pointer<ActiveMQDestination>& getDestination();
00268         virtual void setDestination( const Pointer<ActiveMQDestination>& destination );
00269 
00270         virtual const Pointer<TransactionId>& getTransactionId() const;
00271         virtual Pointer<TransactionId>& getTransactionId();
00272         virtual void setTransactionId( const Pointer<TransactionId>& transactionId );
00273 
00274         virtual const Pointer<ActiveMQDestination>& getOriginalDestination() const;
00275         virtual Pointer<ActiveMQDestination>& getOriginalDestination();
00276         virtual void setOriginalDestination( const Pointer<ActiveMQDestination>& originalDestination );
00277 
00278         virtual const Pointer<MessageId>& getMessageId() const;
00279         virtual Pointer<MessageId>& getMessageId();
00280         virtual void setMessageId( const Pointer<MessageId>& messageId );
00281 
00282         virtual const Pointer<TransactionId>& getOriginalTransactionId() const;
00283         virtual Pointer<TransactionId>& getOriginalTransactionId();
00284         virtual void setOriginalTransactionId( const Pointer<TransactionId>& originalTransactionId );
00285 
00286         virtual const std::string& getGroupID() const;
00287         virtual std::string& getGroupID();
00288         virtual void setGroupID( const std::string& groupID );
00289 
00290         virtual int getGroupSequence() const;
00291         virtual void setGroupSequence( int groupSequence );
00292 
00293         virtual const std::string& getCorrelationId() const;
00294         virtual std::string& getCorrelationId();
00295         virtual void setCorrelationId( const std::string& correlationId );
00296 
00297         virtual bool isPersistent() const;
00298         virtual void setPersistent( bool persistent );
00299 
00300         virtual long long getExpiration() const;
00301         virtual void setExpiration( long long expiration );
00302 
00303         virtual unsigned char getPriority() const;
00304         virtual void setPriority( unsigned char priority );
00305 
00306         virtual const Pointer<ActiveMQDestination>& getReplyTo() const;
00307         virtual Pointer<ActiveMQDestination>& getReplyTo();
00308         virtual void setReplyTo( const Pointer<ActiveMQDestination>& replyTo );
00309 
00310         virtual long long getTimestamp() const;
00311         virtual void setTimestamp( long long timestamp );
00312 
00313         virtual const std::string& getType() const;
00314         virtual std::string& getType();
00315         virtual void setType( const std::string& type );
00316 
00317         virtual const std::vector<unsigned char>& getContent() const;
00318         virtual std::vector<unsigned char>& getContent();
00319         virtual void setContent( const std::vector<unsigned char>& content );
00320 
00321         virtual const std::vector<unsigned char>& getMarshalledProperties() const;
00322         virtual std::vector<unsigned char>& getMarshalledProperties();
00323         virtual void setMarshalledProperties( const std::vector<unsigned char>& marshalledProperties );
00324 
00325         virtual const Pointer<DataStructure>& getDataStructure() const;
00326         virtual Pointer<DataStructure>& getDataStructure();
00327         virtual void setDataStructure( const Pointer<DataStructure>& dataStructure );
00328 
00329         virtual const Pointer<ConsumerId>& getTargetConsumerId() const;
00330         virtual Pointer<ConsumerId>& getTargetConsumerId();
00331         virtual void setTargetConsumerId( const Pointer<ConsumerId>& targetConsumerId );
00332 
00333         virtual bool isCompressed() const;
00334         virtual void setCompressed( bool compressed );
00335 
00336         virtual int getRedeliveryCounter() const;
00337         virtual void setRedeliveryCounter( int redeliveryCounter );
00338 
00339         virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath() const;
00340         virtual std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath();
00341         virtual void setBrokerPath( const std::vector< decaf::lang::Pointer<BrokerId> >& brokerPath );
00342 
00343         virtual long long getArrival() const;
00344         virtual void setArrival( long long arrival );
00345 
00346         virtual const std::string& getUserID() const;
00347         virtual std::string& getUserID();
00348         virtual void setUserID( const std::string& userID );
00349 
00350         virtual bool isRecievedByDFBridge() const;
00351         virtual void setRecievedByDFBridge( bool recievedByDFBridge );
00352 
00353         virtual bool isDroppable() const;
00354         virtual void setDroppable( bool droppable );
00355 
00356         virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getCluster() const;
00357         virtual std::vector< decaf::lang::Pointer<BrokerId> >& getCluster();
00358         virtual void setCluster( const std::vector< decaf::lang::Pointer<BrokerId> >& cluster );
00359 
00360         virtual long long getBrokerInTime() const;
00361         virtual void setBrokerInTime( long long brokerInTime );
00362 
00363         virtual long long getBrokerOutTime() const;
00364         virtual void setBrokerOutTime( long long brokerOutTime );
00365 
00369         virtual bool isMessage() const {
00370             return true;
00371         }
00372 
00373         virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor );
00374 
00375     };
00376 
00377 }}
00378 
00379 #endif /*_ACTIVEMQ_COMMANDS_MESSAGE_H_*/