1 /*------------------------------------------------------------------------------
2 Name: PublishQueueEntry.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 ------------------------------------------------------------------------------*/
6 #ifndef _UTIL_QUEUE_PUBLISHQUEUEENRY_H
7 #define _UTIL_QUEUE_PUBLISHQUEUEENRY_H
8
9 #include <util/MethodName.h>
10 #include <util/queue/MsgQueueEntry.h>
11
12 /**
13 * Class embedding messages or information to be stored on the client queues
14 * Note that all content is copied when passed to the constructors.
15 * This way this queue entry is the owner of the content (and therefore will
16 * delete it when its destructor is called).
17 *
18 * @author <a href='mailto:laghi@swissinfo.org'>Michele Laghi</a>
19 * @author <a href='mailto:xmlblast@marcelruff.info'>Marcel Ruff</a>
20 */
21 namespace org { namespace xmlBlaster { namespace util { namespace queue {
22
23 class Dll_Export PublishQueueEntry : public org::xmlBlaster::util::queue::MsgQueueEntry
24 {
25 public:
26
27 /**
28 * Constructor. You can provide a name different from 'publish'.
29 * Normally the entry has the priority specified in the org::xmlBlaster::client::qos::PublishQos of the message unit. However, if you
30 * pass a non-negative priority, it will be taken as the priority of this entry, in other words, the
31 * priority of the message unit will be ignored.
32 * @param type Only "MSG_RAW|publish" is supported
33 */
34 PublishQueueEntry(org::xmlBlaster::util::Global& global,
35 const org::xmlBlaster::util::MessageUnit& msgUnit,
36 int priority=NORM_PRIORITY,
37 org::xmlBlaster::util::Timestamp uniqueId = TimestampFactory::getInstance().getTimestamp());
38
39 ~PublishQueueEntry();
40
41 /**
42 * copy constructor
43 */
44 PublishQueueEntry(const PublishQueueEntry& entry);
45
46 /**
47 * assignment constructor
48 */
49 PublishQueueEntry& operator =(const PublishQueueEntry& entry);
50
51 MsgQueueEntry *getClone() const;
52
53 virtual bool isPublish() const;
54
55 /**
56 * @param type "MSG_RAW|publish"
57 std::string getEmbeddedType() const { return org::xmlBlaster::util::Constants::ENTRY_TYPE_MSG_RAW + "|" + org::xmlBlaster::util::MethodName::PUBLISH }
58 */
59
60 // this should actually be in another interface but since it is an only method we put it here.
61 const org::xmlBlaster::util::queue::MsgQueueEntry& send(org::xmlBlaster::util::dispatch::I_ConnectionsHandler& connectionsHandler) const;
62
63 size_t getSizeInBytes() const;
64
65 const org::xmlBlaster::client::qos::PublishReturnQos* getPublishReturnQos() const;
66
67 std::string toXml(const std::string& indent="") const;
68
69 };
70
71 }}}} // namespace
72
73 #endif
syntax highlighted by Code2HTML, v. 0.9.1