activemq-cpp-3.9.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;
92 
93  public:
94 
95  const static unsigned char ID_MESSAGE = 0;
96 
97  private:
98 
99  // Used to allow a client to call Message::acknowledge when in the Client
100  // Ack mode.
102 
103  // Message properties, these are Marshaled and Unmarshaled from the Message
104  // Command's marshaledProperties vector.
105  activemq::util::PrimitiveMap properties;
106 
107  // Indicates if the Message Properties are Read Only
108  bool readOnlyProperties;
109 
110  // Indicates if the Message Body are Read Only
111  bool readOnlyBody;
112 
113  protected:
114 
116 
117  static const unsigned int DEFAULT_MESSAGE_SIZE = 1024;
118 
119  private:
120 
121  Message(const Message&);
122  Message& operator= (const Message&);
123 
124  public:
125 
126  Message();
127 
128  virtual ~Message();
129 
130  virtual unsigned char getDataStructureType() const;
131 
132  virtual Message* cloneDataStructure() const;
133 
134  virtual void copyDataStructure(const DataStructure* src);
135 
136  virtual std::string toString() const;
137 
138  virtual bool equals(const DataStructure* value) const;
139 
149  return Pointer<Message>(this->cloneDataStructure());
150  }
151 
158  virtual void beforeMarshal(wireformat::WireFormat* wireFormat AMQCPP_UNUSED);
159 
165  virtual void afterUnmarshal(wireformat::WireFormat* wireFormat AMQCPP_UNUSED);
166 
172  virtual bool isMarshalAware() const {
173  return true;
174  }
175 
181  virtual void setAckHandler(const Pointer<core::ActiveMQAckHandler>& handler) {
182  this->ackHandler = handler;
183  }
184 
191  return this->ackHandler;
192  }
193 
200  this->connection = connection;
201  }
202 
209  return this->connection;
210  }
211 
216  virtual unsigned int getSize() const;
217 
223  virtual bool isExpired() const;
224 
228  virtual void onSend() {}
229 
237  return this->properties;
238  }
240  return this->properties;
241  }
242 
247  bool isReadOnlyProperties() const {
248  return this->readOnlyProperties;
249  }
250 
255  void setReadOnlyProperties(bool value) {
256  this->readOnlyProperties = value;
257  }
258 
263  bool isReadOnlyBody() const {
264  return this->readOnlyBody;
265  }
266 
271  void setReadOnlyBody(bool value) {
272  this->readOnlyBody = value;
273  }
274 
275  virtual const Pointer<ProducerId>& getProducerId() const;
276  virtual Pointer<ProducerId>& getProducerId();
277  virtual void setProducerId(const Pointer<ProducerId>& producerId);
278 
279  virtual const Pointer<ActiveMQDestination>& getDestination() const;
280  virtual Pointer<ActiveMQDestination>& getDestination();
281  virtual void setDestination(const Pointer<ActiveMQDestination>& destination);
282 
283  virtual const Pointer<TransactionId>& getTransactionId() const;
284  virtual Pointer<TransactionId>& getTransactionId();
285  virtual void setTransactionId(const Pointer<TransactionId>& transactionId);
286 
287  virtual const Pointer<ActiveMQDestination>& getOriginalDestination() const;
288  virtual Pointer<ActiveMQDestination>& getOriginalDestination();
289  virtual void setOriginalDestination(const Pointer<ActiveMQDestination>& originalDestination);
290 
291  virtual const Pointer<MessageId>& getMessageId() const;
292  virtual Pointer<MessageId>& getMessageId();
293  virtual void setMessageId(const Pointer<MessageId>& messageId);
294 
295  virtual const Pointer<TransactionId>& getOriginalTransactionId() const;
296  virtual Pointer<TransactionId>& getOriginalTransactionId();
297  virtual void setOriginalTransactionId(const Pointer<TransactionId>& originalTransactionId);
298 
299  virtual const std::string& getGroupID() const;
300  virtual std::string& getGroupID();
301  virtual void setGroupID(const std::string& groupID);
302 
303  virtual int getGroupSequence() const;
304  virtual void setGroupSequence(int groupSequence);
305 
306  virtual const std::string& getCorrelationId() const;
307  virtual std::string& getCorrelationId();
308  virtual void setCorrelationId(const std::string& correlationId);
309 
310  virtual bool isPersistent() const;
311  virtual void setPersistent(bool persistent);
312 
313  virtual long long getExpiration() const;
314  virtual void setExpiration(long long expiration);
315 
316  virtual unsigned char getPriority() const;
317  virtual void setPriority(unsigned char priority);
318 
319  virtual const Pointer<ActiveMQDestination>& getReplyTo() const;
320  virtual Pointer<ActiveMQDestination>& getReplyTo();
321  virtual void setReplyTo(const Pointer<ActiveMQDestination>& replyTo);
322 
323  virtual long long getTimestamp() const;
324  virtual void setTimestamp(long long timestamp);
325 
326  virtual const std::string& getType() const;
327  virtual std::string& getType();
328  virtual void setType(const std::string& type);
329 
330  virtual const std::vector<unsigned char>& getContent() const;
331  virtual std::vector<unsigned char>& getContent();
332  virtual void setContent(const std::vector<unsigned char>& content);
333 
334  virtual const std::vector<unsigned char>& getMarshalledProperties() const;
335  virtual std::vector<unsigned char>& getMarshalledProperties();
336  virtual void setMarshalledProperties(const std::vector<unsigned char>& marshalledProperties);
337 
338  virtual const Pointer<DataStructure>& getDataStructure() const;
339  virtual Pointer<DataStructure>& getDataStructure();
340  virtual void setDataStructure(const Pointer<DataStructure>& dataStructure);
341 
342  virtual const Pointer<ConsumerId>& getTargetConsumerId() const;
343  virtual Pointer<ConsumerId>& getTargetConsumerId();
344  virtual void setTargetConsumerId(const Pointer<ConsumerId>& targetConsumerId);
345 
346  virtual bool isCompressed() const;
347  virtual void setCompressed(bool compressed);
348 
349  virtual int getRedeliveryCounter() const;
350  virtual void setRedeliveryCounter(int redeliveryCounter);
351 
352  virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath() const;
353  virtual std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath();
354  virtual void setBrokerPath(const std::vector< decaf::lang::Pointer<BrokerId> >& brokerPath);
355 
356  virtual long long getArrival() const;
357  virtual void setArrival(long long arrival);
358 
359  virtual const std::string& getUserID() const;
360  virtual std::string& getUserID();
361  virtual void setUserID(const std::string& userID);
362 
363  virtual bool isRecievedByDFBridge() const;
364  virtual void setRecievedByDFBridge(bool recievedByDFBridge);
365 
366  virtual bool isDroppable() const;
367  virtual void setDroppable(bool droppable);
368 
369  virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getCluster() const;
370  virtual std::vector< decaf::lang::Pointer<BrokerId> >& getCluster();
371  virtual void setCluster(const std::vector< decaf::lang::Pointer<BrokerId> >& cluster);
372 
373  virtual long long getBrokerInTime() const;
374  virtual void setBrokerInTime(long long brokerInTime);
375 
376  virtual long long getBrokerOutTime() const;
377  virtual void setBrokerOutTime(long long brokerOutTime);
378 
379  virtual bool isJMSXGroupFirstForConsumer() const;
380  virtual void setJMSXGroupFirstForConsumer(bool jMSXGroupFirstForConsumer);
381 
385  virtual bool isMessage() const {
386  return true;
387  }
388 
389  virtual Pointer<Command> visit(activemq::state::CommandVisitor* visitor);
390 
391  };
392 
393 }}
394 
395 #endif /*_ACTIVEMQ_COMMANDS_MESSAGE_H_*/
const util::PrimitiveMap & getMessageProperties() const
Definition: Message.h:239
virtual bool isMarshalAware() const
Indicates that this command is aware of Marshaling, and needs to have its Marshaling methods invoked...
Definition: Message.h:172
virtual void onSend()
Allows derived Message classes to perform tasks before a message is sent.
Definition: Message.h:228
std::vector< unsigned char > content
Definition: Message.h:77
virtual Pointer< core::ActiveMQAckHandler > getAckHandler() const
Gets the Acknowledgment Handler that this Message will use when the Acknowledge method is called...
Definition: Message.h:190
Pointer< ConsumerId > targetConsumerId
Definition: Message.h:80
std::string userID
Definition: Message.h:85
#define AMQCPP_API
Definition: Config.h:30
Pointer< TransactionId > originalTransactionId
Definition: Message.h:67
int redeliveryCounter
Definition: Message.h:82
Pointer< ProducerId > producerId
Definition: Message.h:62
long long expiration
Definition: Message.h:72
Pointer< ActiveMQDestination > destination
Definition: Message.h:63
bool compressed
Definition: Message.h:81
bool jMSXGroupFirstForConsumer
Definition: Message.h:91
Pointer< MessageId > messageId
Definition: Message.h:66
core::ActiveMQConnection * getConnection() const
Gets the ActiveMQConnection instance that this Command was created from when the session create metho...
Definition: Message.h:208
Pointer< Message > copy() const
Create a Pointer based copy of this message.
Definition: Message.h:148
void setConnection(core::ActiveMQConnection *connection)
Sets the ActiveMQConnection instance that this Command was created from when the session create metho...
Definition: Message.h:199
bool persistent
Definition: Message.h:71
Definition: DataStructure.h:27
virtual bool isMessage() const
Definition: Message.h:385
Interface for an Object that can visit the various Command Objects that are sent from and to this cli...
Definition: CommandVisitor.h:69
std::vector< decaf::lang::Pointer< BrokerId > > brokerPath
Definition: Message.h:83
Pointer< ActiveMQDestination > originalDestination
Definition: Message.h:65
std::string type
Definition: Message.h:76
Definition: BaseCommand.h:27
bool isReadOnlyBody() const
Returns if the Message Body is Read Only.
Definition: Message.h:263
core::ActiveMQConnection * connection
Definition: Message.h:115
Pointer< ActiveMQDestination > replyTo
Definition: Message.h:74
Map of named primitives.
Definition: PrimitiveMap.h:36
long long brokerOutTime
Definition: Message.h:90
Definition: Message.h:59
std::string correlationId
Definition: Message.h:70
unsigned char priority
Definition: Message.h:73
Pointer< DataStructure > dataStructure
Definition: Message.h:79
long long timestamp
Definition: Message.h:75
bool recievedByDFBridge
Definition: Message.h:86
void setReadOnlyBody(bool value)
Set the Read Only State of the Message Content.
Definition: Message.h:271
long long brokerInTime
Definition: Message.h:89
long long arrival
Definition: Message.h:84
std::string groupID
Definition: Message.h:68
Provides a mechanism to marshal commands into and out of packets or into and out of streams...
Definition: WireFormat.h:43
Pointer< TransactionId > transactionId
Definition: Message.h:64
int groupSequence
Definition: Message.h:69
std::vector< decaf::lang::Pointer< BrokerId > > cluster
Definition: Message.h:88
bool isReadOnlyProperties() const
Returns if the Message Properties Are Read Only.
Definition: Message.h:247
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
std::vector< unsigned char > marshalledProperties
Definition: Message.h:78
Concrete connection used for all connectors to the ActiveMQ broker.
Definition: ActiveMQConnection.h:61
virtual void setAckHandler(const Pointer< core::ActiveMQAckHandler > &handler)
Sets the Acknowledgment Handler that this Message will use when the Acknowledge method is called...
Definition: Message.h:181
util::PrimitiveMap & getMessageProperties()
Gets a reference to the Message's Properties object, allows the derived classes to get and set their ...
Definition: Message.h:236
bool droppable
Definition: Message.h:87
void setReadOnlyProperties(bool value)
Set the Read Only State of the Message Properties.
Definition: Message.h:255