YAMI4 C++ Library 2.0.0
Messaging Solution for Distributed Systems
Loading...
Searching...
No Matches
incoming_message.h
1// Copyright Maciej Sobczak 2008-2022.
2// This file is part of YAMI4.
3// See the package-level LICENSE.txt file.
4
5#ifndef YAMICPP_INCOMING_MESSAGE_H_INCLUDED
6#define YAMICPP_INCOMING_MESSAGE_H_INCLUDED
7
8#include "parameters.h"
9#include <yami4-core/dll.h>
10#include <string>
11#include <vector>
12
13namespace yami
14{
15
16namespace details
17{
18class agent_impl;
19struct incoming_message_info;
20} // namespace details
21
37{
38public:
39 incoming_message(details::agent_impl & agent,
40 details::incoming_message_info & info);
41
50
52
57 const std::string & get_source() const;
58
60 const std::string & get_object_name() const;
61
63 const std::string & get_message_name() const;
64
66 const parameters & get_header() const;
67
69 const parameters & get_parameters() const;
70
79
84 const std::vector<char> & get_raw_content() const;
85
87 long long get_message_id() const;
88
96 void reply(const serializable & body = parameters(),
97 std::size_t priority = 0);
98
107 void reject(const std::string & reason = std::string(),
108 std::size_t priority = 0);
109
110private:
112 void operator=(const incoming_message &);
113
114 details::agent_impl & agent_;
115 std::string source_;
116 std::string object_name_;
117 std::string message_name_;
118 long long message_id_;
119 core::parameters * core_header_;
120 mutable parameters * header_wrapper_; // lazy initialized
121 parameters * params_;
122 std::vector<char> * raw_buffer_;
123 bool already_used_;
124};
125
126} // namespace yami
127
128#endif // YAMICPP_INCOMING_MESSAGE_H_INCLUDED
Message broker.
Definition: agent.h:45
Incoming message.
Definition: incoming_message.h:37
const std::vector< char > & get_raw_content() const
Provides access to the raw buffer of message content.
incoming_message(incoming_message &other)
Moving constructor.
void reply(const serializable &body=parameters(), std::size_t priority=0)
Sends back the reply.
void reject(const std::string &reason=std::string(), std::size_t priority=0)
Sends back the rejection (exception) notification.
parameters * extract_parameters()
Extracts the message content.
const std::string & get_message_name() const
Returns the message name.
const std::string & get_source() const
Returns the source of this incoming message.
const parameters & get_parameters() const
Provides access to the message content.
const parameters & get_header() const
Provides access to the message header.
const std::string & get_object_name() const
Returns the destination object name.
long long get_message_id() const
Extracts the server's message identifier.
Collection of message parameters.
Definition: parameters.h:62
Common interface for serializable data source.
Definition: serializable.h:21
Namespace devoted to everything related to YAMI4.
Definition: agent.h:21