activemq-cpp-3.9.5
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
37#include <decaf/lang/Pointer.h>
38#include <string>
39#include <vector>
40
41namespace activemq{
42namespace core{
45}
46namespace commands{
47
48 using decaf::lang::Pointer;
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;
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;
83 std::vector< decaf::lang::Pointer<BrokerId> > brokerPath;
84 long long arrival;
85 std::string userID;
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.
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
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
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;
278
282
286
290
291 virtual const Pointer<MessageId>& getMessageId() const;
294
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;
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
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
341
345
346 virtual bool isCompressed() const;
347 virtual void setCompressed(bool compressed);
348
349 virtual int getRedeliveryCounter() const;
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;
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;
381
385 virtual bool isMessage() const {
386 return true;
387 }
388
390
391 };
392
393}}
394
395#endif /*_ACTIVEMQ_COMMANDS_MESSAGE_H_*/
#define AMQCPP_API
Definition Config.h:30
BaseCommand()
Definition BaseCommand.h:35
Definition DataStructure.h:27
virtual void setArrival(long long arrival)
virtual Pointer< DataStructure > & getDataStructure()
virtual std::string & getCorrelationId()
std::vector< unsigned char > marshalledProperties
Definition Message.h:78
virtual const Pointer< ActiveMQDestination > & getReplyTo() const
virtual void setUserID(const std::string &userID)
virtual void setDestination(const Pointer< ActiveMQDestination > &destination)
virtual std::vector< decaf::lang::Pointer< BrokerId > > & getCluster()
static const unsigned char ID_MESSAGE
Definition Message.h:95
virtual const std::string & getCorrelationId() const
int groupSequence
Definition Message.h:69
virtual void setBrokerInTime(long long brokerInTime)
virtual void setBrokerOutTime(long long brokerOutTime)
virtual unsigned char getDataStructureType() const
Get the DataStructure Type as defined in CommandTypes.h.
unsigned char priority
Definition Message.h:73
virtual bool isMarshalAware() const
Indicates that this command is aware of Marshaling, and needs to have its Marshaling methods invoked.
Definition Message.h:172
bool compressed
Definition Message.h:81
virtual Pointer< ActiveMQDestination > & getDestination()
virtual bool isExpired() const
Returns if this message has expired, meaning that its Expiration time has elapsed.
virtual void setRecievedByDFBridge(bool recievedByDFBridge)
virtual long long getBrokerOutTime() const
virtual const Pointer< DataStructure > & getDataStructure() const
virtual Pointer< TransactionId > & getOriginalTransactionId()
virtual Pointer< Command > visit(activemq::state::CommandVisitor *visitor)
Allows a Visitor to visit this command and return a response to the command based on the command type...
virtual const std::string & getType() const
virtual long long getExpiration() const
virtual void setTimestamp(long long timestamp)
core::ActiveMQConnection * getConnection() const
Gets the ActiveMQConnection instance that this Command was created from when the session create metho...
Definition Message.h:208
virtual Pointer< TransactionId > & getTransactionId()
long long brokerOutTime
Definition Message.h:90
virtual int getRedeliveryCounter() const
virtual void setType(const std::string &type)
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
bool isReadOnlyBody() const
Returns if the Message Body is Read Only.
Definition Message.h:263
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
virtual const std::vector< decaf::lang::Pointer< BrokerId > > & getCluster() const
virtual std::string & getGroupID()
virtual Pointer< ActiveMQDestination > & getReplyTo()
virtual const Pointer< MessageId > & getMessageId() const
virtual Pointer< ProducerId > & getProducerId()
int redeliveryCounter
Definition Message.h:82
void setReadOnlyBody(bool value)
Set the Read Only State of the Message Content.
Definition Message.h:271
bool droppable
Definition Message.h:87
virtual const Pointer< TransactionId > & getOriginalTransactionId() const
Pointer< Message > copy() const
Create a Pointer based copy of this message.
Definition Message.h:148
virtual int getGroupSequence() const
bool recievedByDFBridge
Definition Message.h:86
virtual const Pointer< ActiveMQDestination > & getOriginalDestination() const
virtual void setDroppable(bool droppable)
std::string groupID
Definition Message.h:68
virtual std::vector< decaf::lang::Pointer< BrokerId > > & getBrokerPath()
bool persistent
Definition Message.h:71
virtual bool isRecievedByDFBridge() const
virtual void setPriority(unsigned char priority)
virtual void setOriginalDestination(const Pointer< ActiveMQDestination > &originalDestination)
virtual void copyDataStructure(const DataStructure *src)
Copy the contents of the passed object into this objects members, overwriting any existing data.
core::ActiveMQConnection * connection
Definition Message.h:115
virtual bool isMessage() const
Definition Message.h:385
virtual void setProducerId(const Pointer< ProducerId > &producerId)
virtual void setOriginalTransactionId(const Pointer< TransactionId > &originalTransactionId)
virtual std::string & getUserID()
const util::PrimitiveMap & getMessageProperties() const
Definition Message.h:239
virtual void setJMSXGroupFirstForConsumer(bool jMSXGroupFirstForConsumer)
virtual void setContent(const std::vector< unsigned char > &content)
virtual void setCorrelationId(const std::string &correlationId)
virtual void setTargetConsumerId(const Pointer< ConsumerId > &targetConsumerId)
virtual long long getTimestamp() const
long long brokerInTime
Definition Message.h:89
virtual void setBrokerPath(const std::vector< decaf::lang::Pointer< BrokerId > > &brokerPath)
virtual void beforeMarshal(wireformat::WireFormat *wireFormat AMQCPP_UNUSED)
Handles the marshaling of the objects properties into the internal byte array before the object is ma...
virtual bool isCompressed() const
virtual void setExpiration(long long expiration)
long long timestamp
Definition Message.h:75
virtual unsigned int getSize() const
Returns the Size of this message in Bytes.
virtual bool isDroppable() const
Pointer< ActiveMQDestination > destination
Definition Message.h:63
virtual const Pointer< ActiveMQDestination > & getDestination() const
static const unsigned int DEFAULT_MESSAGE_SIZE
Definition Message.h:117
long long arrival
Definition Message.h:84
virtual Pointer< ConsumerId > & getTargetConsumerId()
std::string userID
Definition Message.h:85
virtual void setDataStructure(const Pointer< DataStructure > &dataStructure)
std::vector< decaf::lang::Pointer< BrokerId > > cluster
Definition Message.h:88
virtual Pointer< MessageId > & getMessageId()
long long expiration
Definition Message.h:72
virtual bool isJMSXGroupFirstForConsumer() const
virtual long long getBrokerInTime() const
virtual const Pointer< TransactionId > & getTransactionId() const
virtual void setCompressed(bool compressed)
virtual void setTransactionId(const Pointer< TransactionId > &transactionId)
virtual long long getArrival() const
virtual std::string toString() const
Returns a string containing the information for this DataStructure such as its type and value of its ...
virtual const std::vector< decaf::lang::Pointer< BrokerId > > & getBrokerPath() const
virtual void setReplyTo(const Pointer< ActiveMQDestination > &replyTo)
std::string type
Definition Message.h:76
virtual const std::vector< unsigned char > & getMarshalledProperties() const
Pointer< ActiveMQDestination > replyTo
Definition Message.h:74
void setConnection(core::ActiveMQConnection *connection)
Sets the ActiveMQConnection instance that this Command was created from when the session create metho...
Definition Message.h:199
Pointer< MessageId > messageId
Definition Message.h:66
virtual void setCluster(const std::vector< decaf::lang::Pointer< BrokerId > > &cluster)
virtual const std::vector< unsigned char > & getContent() const
virtual const std::string & getGroupID() const
Pointer< ActiveMQDestination > originalDestination
Definition Message.h:65
virtual const Pointer< ProducerId > & getProducerId() const
virtual bool isPersistent() const
std::vector< decaf::lang::Pointer< BrokerId > > brokerPath
Definition Message.h:83
virtual bool equals(const DataStructure *value) const
Compares the DataStructure passed in to this one, and returns if they are equivalent.
std::vector< unsigned char > content
Definition Message.h:77
virtual void afterUnmarshal(wireformat::WireFormat *wireFormat AMQCPP_UNUSED)
Called after unmarshaling is started to cleanup the object being unmarshaled.
virtual unsigned char getPriority() const
virtual Pointer< ActiveMQDestination > & getOriginalDestination()
Pointer< TransactionId > originalTransactionId
Definition Message.h:67
virtual void setMarshalledProperties(const std::vector< unsigned char > &marshalledProperties)
virtual void setMessageId(const Pointer< MessageId > &messageId)
std::string correlationId
Definition Message.h:70
virtual std::string & getType()
virtual std::vector< unsigned char > & getMarshalledProperties()
virtual void setRedeliveryCounter(int redeliveryCounter)
Pointer< DataStructure > dataStructure
Definition Message.h:79
virtual const std::string & getUserID() const
bool jMSXGroupFirstForConsumer
Definition Message.h:91
virtual const Pointer< ConsumerId > & getTargetConsumerId() const
Pointer< TransactionId > transactionId
Definition Message.h:64
virtual void setPersistent(bool persistent)
Pointer< ConsumerId > targetConsumerId
Definition Message.h:80
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
virtual void setGroupID(const std::string &groupID)
Pointer< ProducerId > producerId
Definition Message.h:62
virtual void onSend()
Allows derived Message classes to perform tasks before a message is sent.
Definition Message.h:228
virtual std::vector< unsigned char > & getContent()
void setReadOnlyProperties(bool value)
Set the Read Only State of the Message Properties.
Definition Message.h:255
virtual Message * cloneDataStructure() const
Clone this obbject and return a new instance that the caller now owns, this will be an exact copy of ...
bool isReadOnlyProperties() const
Returns if the Message Properties Are Read Only.
Definition Message.h:247
virtual void setGroupSequence(int groupSequence)
Interface class that is used to give CMS Messages an interface to Ack themselves with.
Definition ActiveMQAckHandler.h:34
Concrete connection used for all connectors to the ActiveMQ broker.
Definition ActiveMQConnection.h:62
Interface for an Object that can visit the various Command Objects that are sent from and to this cli...
Definition CommandVisitor.h:69
Map of named primitives.
Definition PrimitiveMap.h:36
Provides a mechanism to marshal commands into and out of packets or into and out of streams,...
Definition WireFormat.h:43
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
Definition ActiveMQBlobMessage.h:28
Definition ActiveMQTempDestination.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24