activemq-cpp-3.9.5
StompWireFormat.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_WIREFORMAT_STOMP_STOMPWIREFORMAT_H_
19#define _ACTIVEMQ_WIREFORMAT_STOMP_STOMPWIREFORMAT_H_
20
26#include <decaf/lang/Pointer.h>
27
28namespace activemq {
29namespace wireformat {
30namespace stomp {
31
32 using decaf::lang::Pointer;
33 using activemq::commands::Command;
34
35 class StompHelper;
36 class StompWireformatProperties;
37
38 class AMQCPP_API StompWireFormat : public WireFormat {
39 private:
40
44 StompHelper* helper;
45
46 // Stored after we connect to use when validating that a durable subscribe
47 // and unsubscribe are set to use the client Id.
48 std::string clientId;
49
50 // Indicates when we are in the doUnmarshal call
52
53 // Internal structure for holding class internal data that can change without
54 // affecting binary compatibility.
55 StompWireformatProperties* properties;
56
57 private:
58
59 StompWireFormat(const StompWireFormat&);
60 StompWireFormat& operator=(const StompWireFormat&);
61
62 public:
63
65
67
68 public:
69
83 virtual void marshal(const Pointer<commands::Command> command,
86
99
104 virtual void setVersion(int version AMQCPP_UNUSED) {}
105
110 virtual int getVersion() const {
111 return 1;
112 }
113
119 std::string getTopicPrefix() const;
120
127 void setTopicPrefix(const std::string& prefix);
128
134 std::string getQueuePrefix() const;
135
142 void setQueuePrefix(const std::string& prefix);
143
149 std::string getTempTopicPrefix() const;
150
157 void setTempTopicPrefix(const std::string& prefix);
158
164 std::string getTempQueuePrefix() const;
165
172 void setTempQueuePrefix(const std::string& prefix);
173
179 virtual bool inReceive() const {
180 return this->receiving.get();
181 }
182
188 virtual bool hasNegotiator() const {
189 return false;
190 }
191
200
201 private:
202
203 Pointer<Command> unmarshalMessage(const Pointer<StompFrame> frame);
204 Pointer<Command> unmarshalReceipt(const Pointer<StompFrame> frame);
205 Pointer<Command> unmarshalConnected(const Pointer<StompFrame> frame);
206 Pointer<Command> unmarshalError(const Pointer<StompFrame> frame);
207
208 Pointer<StompFrame> marshalMessage(const Pointer<Command> command);
209 Pointer<StompFrame> marshalAck(const Pointer<Command> command);
210 Pointer<StompFrame> marshalConnectionInfo(const Pointer<Command> command);
211 Pointer<StompFrame> marshalTransactionInfo(const Pointer<Command> command);
212 Pointer<StompFrame> marshalShutdownInfo(const Pointer<Command> command);
213 Pointer<StompFrame> marshalRemoveInfo(const Pointer<Command> command);
214 Pointer<StompFrame> marshalConsumerInfo(const Pointer<Command> command);
215 Pointer<StompFrame> marshalRemoveSubscriptionInfo(const Pointer<Command> command);
216
217 };
218
219}}}
220
221#endif /* _ACTIVEMQ_WIREFORMAT_STOMP_STOMPWIREFORMAT_H_ */
#define AMQCPP_API
Definition Config.h:30
Interface for a transport layer for command objects.
Definition Transport.h:60
Provides a mechanism to marshal commands into and out of packets or into and out of streams,...
Definition WireFormat.h:43
Utility Methods used when marshaling to and from StompFrame's.
Definition StompHelper.h:51
std::string getTempTopicPrefix() const
Gets the prefix used to address Temporary Topics.
virtual int getVersion() const
Get the Version.
Definition StompWireFormat.h:110
void setQueuePrefix(const std::string &prefix)
Sets the prefix used to address Queues.
void setTempQueuePrefix(const std::string &prefix)
Sets the prefix used to address Temporary Queues.
virtual void marshal(const Pointer< commands::Command > command, const activemq::transport::Transport *transport, decaf::io::DataOutputStream *out)
Stream based marshaling of a Command, this method blocks until the entire Command has been written ou...
void setTopicPrefix(const std::string &prefix)
Sets the prefix used to address Topics.
virtual Pointer< commands::Command > unmarshal(const activemq::transport::Transport *transport, decaf::io::DataInputStream *in)
Stream based un-marshaling, blocks on reads on the input stream until a complete command has been rea...
std::string getTempQueuePrefix() const
Gets the prefix used to address Temporary Queues.
std::string getTopicPrefix() const
Gets the prefix used to address Topics.
virtual bool hasNegotiator() const
Returns true if this WireFormat has a Negotiator that needs to wrap the Transport that uses it.
Definition StompWireFormat.h:188
std::string getQueuePrefix() const
Gets the prefix used to address Queues.
void setTempTopicPrefix(const std::string &prefix)
Sets the prefix used to address Temporary Topics.
virtual Pointer< transport::Transport > createNegotiator(const Pointer< transport::Transport > transport)
If the Transport Provides a Negotiator this method will create and return a news instance of the Nego...
virtual bool inReceive() const
Is there a Message being unmarshaled?
Definition StompWireFormat.h:179
virtual void setVersion(int version AMQCPP_UNUSED)
Set the Version.
Definition StompWireFormat.h:104
A data input stream lets an application read primitive Java data types from an underlying input strea...
Definition DataInputStream.h:46
A data output stream lets an application write primitive Java data types to an output stream in a por...
Definition DataOutputStream.h:34
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
A boolean value that may be updated atomically.
Definition AtomicBoolean.h:34
bool get() const
Gets the current value of this AtomicBoolean.
Definition AtomicBoolean.h:63
Definition AbstractTransportFactory.h:30
Definition StompCommandConstants.h:29
Definition BaseDataStructure.h:28
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24