activemq-cpp-3.6.0
Message.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_COMMANDS_MESSAGE_H_
19 #define _ACTIVEMQ_COMMANDS_MESSAGE_H_
20 
21 // Turn off warning message for ignored exception specification
22 #ifdef _MSC_VER
23 #pragma warning( disable : 4290 )
24 #endif
25 
35 #include <activemq/util/Config.h>
37 #include <decaf/lang/Pointer.h>
38 #include <string>
39 #include <vector>
40 
41 namespace activemq{
42 namespace core{
43  class ActiveMQAckHandler;
44  class ActiveMQConnection;
45 }
46 namespace commands{
47 
49 
50  /*
51  *
52  * Command code for OpenWire format for Message
53  *
54  * NOTE!: This file is auto generated - do not modify!
55  * if you need to make a change, please see the Java Classes
56  * in the activemq-cpp-openwire-generator module
57  *
58  */
59  class AMQCPP_API Message : public BaseCommand {
60  protected:
61 
68  std::string groupID;
70  std::string correlationId;
71  bool persistent;
72  long long expiration;
73  unsigned char priority;
75  long long timestamp;
76  std::string type;
77  std::vector<unsigned char> content;
78  std::vector<unsigned char> marshalledProperties;
81  bool compressed;
83  std::vector< decaf::lang::Pointer<BrokerId> > brokerPath;
84  long long arrival;
85  std::string userID;
87  bool droppable;
88  std::vector< decaf::lang::Pointer<BrokerId> > cluster;
89  long long brokerInTime;
90  long long brokerOutTime;
91 
92  public:
93 
94  const static unsigned char ID_MESSAGE = 0;
95 
96  private:
97 
98  // Used to allow a client to call Message::acknowledge when in the Client
99  // Ack mode.
101 
102  // Message properties, these are Marshaled and Unmarshaled from the Message
103  // Command's marshaledProperties vector.
104  activemq::util::PrimitiveMap properties;
105 
106  // Indicates if the Message Properties are Read Only
107  bool readOnlyProperties;
108 
109  // Indicates if the Message Body are Read Only
110  bool readOnlyBody;
111 
112  protected:
113 
115 
116  static const unsigned int DEFAULT_MESSAGE_SIZE = 1024;
117 
118  private:
119 
120  Message( const Message& );
121  Message& operator= ( const Message& );
122 
123  public:
124 
125  Message();
126 
127  virtual ~Message();
128 
129  virtual unsigned char getDataStructureType() const;
130 
131  virtual Message* cloneDataStructure() const;
132 
133  virtual void copyDataStructure( const DataStructure* src );
134 
135  virtual std::string toString() const;
136 
137  virtual bool equals( const DataStructure* value ) const;
138 
148  return Pointer<Message>(this->cloneDataStructure());
149  }
150 
157  virtual void beforeMarshal( wireformat::WireFormat* wireFormat AMQCPP_UNUSED );
158 
164  virtual void afterUnmarshal( wireformat::WireFormat* wireFormat AMQCPP_UNUSED );
165 
171  virtual bool isMarshalAware() const {
172  return true;
173  }
174 
180  virtual void setAckHandler( const Pointer<core::ActiveMQAckHandler>& handler ) {
181  this->ackHandler = handler;
182  }
183 
190  return this->ackHandler;
191  }
192 
199  this->connection = connection;
200  }
201 
208  return this->connection;
209  }
210 
215  virtual unsigned int getSize() const;
216 
222  virtual bool isExpired() const;
223 
227  virtual void onSend() {}
228 
236  return this->properties;
237  }
239  return this->properties;
240  }
241 
246  bool isReadOnlyProperties() const {
247  return this->readOnlyProperties;
248  }
249 
254  void setReadOnlyProperties( bool value ) {
255  this->readOnlyProperties = value;
256  }
257 
262  bool isReadOnlyBody() const {
263  return this->readOnlyBody;
264  }
265 
270  void setReadOnlyBody( bool value ) {
271  this->readOnlyBody = value;
272  }
273 
274  virtual const Pointer<ProducerId>& getProducerId() const;
275  virtual Pointer<ProducerId>& getProducerId();
276  virtual void setProducerId( const Pointer<ProducerId>& producerId );
277 
278  virtual const Pointer<ActiveMQDestination>& getDestination() const;
279  virtual Pointer<ActiveMQDestination>& getDestination();
280  virtual void setDestination( const Pointer<ActiveMQDestination>& destination );
281 
282  virtual const Pointer<TransactionId>& getTransactionId() const;
283  virtual Pointer<TransactionId>& getTransactionId();
284  virtual void setTransactionId( const Pointer<TransactionId>& transactionId );
285 
286  virtual const Pointer<ActiveMQDestination>& getOriginalDestination() const;
287  virtual Pointer<ActiveMQDestination>& getOriginalDestination();
288  virtual void setOriginalDestination( const Pointer<ActiveMQDestination>& originalDestination );
289 
290  virtual const Pointer<MessageId>& getMessageId() const;
291  virtual Pointer<MessageId>& getMessageId();
292  virtual void setMessageId( const Pointer<MessageId>& messageId );
293 
294  virtual const Pointer<TransactionId>& getOriginalTransactionId() const;
295  virtual Pointer<TransactionId>& getOriginalTransactionId();
296  virtual void setOriginalTransactionId( const Pointer<TransactionId>& originalTransactionId );
297 
298  virtual const std::string& getGroupID() const;
299  virtual std::string& getGroupID();
300  virtual void setGroupID( const std::string& groupID );
301 
302  virtual int getGroupSequence() const;
303  virtual void setGroupSequence( int groupSequence );
304 
305  virtual const std::string& getCorrelationId() const;
306  virtual std::string& getCorrelationId();
307  virtual void setCorrelationId( const std::string& correlationId );
308 
309  virtual bool isPersistent() const;
310  virtual void setPersistent( bool persistent );
311 
312  virtual long long getExpiration() const;
313  virtual void setExpiration( long long expiration );
314 
315  virtual unsigned char getPriority() const;
316  virtual void setPriority( unsigned char priority );
317 
318  virtual const Pointer<ActiveMQDestination>& getReplyTo() const;
319  virtual Pointer<ActiveMQDestination>& getReplyTo();
320  virtual void setReplyTo( const Pointer<ActiveMQDestination>& replyTo );
321 
322  virtual long long getTimestamp() const;
323  virtual void setTimestamp( long long timestamp );
324 
325  virtual const std::string& getType() const;
326  virtual std::string& getType();
327  virtual void setType( const std::string& type );
328 
329  virtual const std::vector<unsigned char>& getContent() const;
330  virtual std::vector<unsigned char>& getContent();
331  virtual void setContent( const std::vector<unsigned char>& content );
332 
333  virtual const std::vector<unsigned char>& getMarshalledProperties() const;
334  virtual std::vector<unsigned char>& getMarshalledProperties();
335  virtual void setMarshalledProperties( const std::vector<unsigned char>& marshalledProperties );
336 
337  virtual const Pointer<DataStructure>& getDataStructure() const;
338  virtual Pointer<DataStructure>& getDataStructure();
339  virtual void setDataStructure( const Pointer<DataStructure>& dataStructure );
340 
341  virtual const Pointer<ConsumerId>& getTargetConsumerId() const;
342  virtual Pointer<ConsumerId>& getTargetConsumerId();
343  virtual void setTargetConsumerId( const Pointer<ConsumerId>& targetConsumerId );
344 
345  virtual bool isCompressed() const;
346  virtual void setCompressed( bool compressed );
347 
348  virtual int getRedeliveryCounter() const;
349  virtual void setRedeliveryCounter( int redeliveryCounter );
350 
351  virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath() const;
352  virtual std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath();
353  virtual void setBrokerPath( const std::vector< decaf::lang::Pointer<BrokerId> >& brokerPath );
354 
355  virtual long long getArrival() const;
356  virtual void setArrival( long long arrival );
357 
358  virtual const std::string& getUserID() const;
359  virtual std::string& getUserID();
360  virtual void setUserID( const std::string& userID );
361 
362  virtual bool isRecievedByDFBridge() const;
363  virtual void setRecievedByDFBridge( bool recievedByDFBridge );
364 
365  virtual bool isDroppable() const;
366  virtual void setDroppable( bool droppable );
367 
368  virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getCluster() const;
369  virtual std::vector< decaf::lang::Pointer<BrokerId> >& getCluster();
370  virtual void setCluster( const std::vector< decaf::lang::Pointer<BrokerId> >& cluster );
371 
372  virtual long long getBrokerInTime() const;
373  virtual void setBrokerInTime( long long brokerInTime );
374 
375  virtual long long getBrokerOutTime() const;
376  virtual void setBrokerOutTime( long long brokerOutTime );
377 
381  virtual bool isMessage() const {
382  return true;
383  }
384 
385  virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor );
386 
387  };
388 
389 }}
390 
391 #endif /*_ACTIVEMQ_COMMANDS_MESSAGE_H_*/