SObjectizer-5 Extra
Public Member Functions | Private Attributes | List of all members
so_5::extra::enveloped_msg::time_limited_delivery_t Class Referencefinal

A special envelope to perform time-limited delivery. More...

#include <time_limited_delivery.hpp>

Inheritance diagram for so_5::extra::enveloped_msg::time_limited_delivery_t:
so_5::extra::enveloped_msg::just_envelope_t

Public Member Functions

 time_limited_delivery_t (message_ref_t message, std::chrono::steady_clock::time_point deadline)
 Initializing constructor. More...
 
 time_limited_delivery_t (message_ref_t message, std::chrono::steady_clock::duration deadline)
 Initializing constructor. More...
 
void access_hook (access_context_t, handler_invoker_t &invoker) noexcept override
 
- Public Member Functions inherited from so_5::extra::enveloped_msg::just_envelope_t
 just_envelope_t (so_5::message_ref_t payload)
 Initializing constructor. More...
 
 ~just_envelope_t () noexcept override=default
 
 just_envelope_t (const just_envelope_t &)=delete
 
 just_envelope_t (just_envelope_t &&)=delete
 
void access_hook (access_context_t, handler_invoker_t &invoker) noexcept override
 

Private Attributes

const std::chrono::steady_clock::time_point m_deadline
 Delivery deadline. More...
 

Additional Inherited Members

- Protected Member Functions inherited from so_5::extra::enveloped_msg::just_envelope_t
SO_5_NODISCARD payload_info_t whole_payload () const noexcept
 Get access to content of envelope. More...
 
SO_5_NODISCARD message_ref_t & payload () const noexcept
 Get access to payload only. More...
 
message_mutability_t so5_message_mutability () const override
 
void so5_change_mutability (message_mutability_t new_value) override
 

Detailed Description

A special envelope to perform time-limited delivery.

This envelope checks the current time before processing/transformation of the enveloped message. If the current time is equal or greater than the specified deadline then message won't be processed/transformed.

Usage example:

namespace msg_ns = so_5::extra::enveloped_msg;
// Use time_limited_delivery_t with wallclock deadline.
msg_ns::make<my_message>(...)
.envelope<msg_ns::time_limited_delivery_t>(
// Limit lifetime of the message by 5 seconds from now.
std::chrono::steady_clock::now() + 5s)
.send_to(destination);
// The same thing but less verbose:
msg_ns::make<my_message>(...)
.envelope<msg_ns::time_limited_delivery_t>(
// Limit lifetime of the message by 5 seconds from now.
5s)
.send_to(destination);
Since
v.1.2.0

Definition at line 53 of file time_limited_delivery.hpp.

Constructor & Destructor Documentation

◆ time_limited_delivery_t() [1/2]

so_5::extra::enveloped_msg::time_limited_delivery_t::time_limited_delivery_t ( message_ref_t  message,
std::chrono::steady_clock::time_point  deadline 
)
inline

Initializing constructor.

Receives wallclock time as deadline.

Parameters
messageMessage to be delivered.
deadlineDelivery deadline.

Definition at line 63 of file time_limited_delivery.hpp.

◆ time_limited_delivery_t() [2/2]

so_5::extra::enveloped_msg::time_limited_delivery_t::time_limited_delivery_t ( message_ref_t  message,
std::chrono::steady_clock::duration  deadline 
)
inline

Initializing constructor.

Receives time interval. Deadline will be calculated automatically from the current time.

Parameters
messageMessage to be delivered.
deadlineTime interval for calculation of deadline value.

Definition at line 77 of file time_limited_delivery.hpp.

Member Function Documentation

◆ access_hook()

void so_5::extra::enveloped_msg::time_limited_delivery_t::access_hook ( access_context_t  ,
handler_invoker_t &  invoker 
)
inlineoverridenoexcept

Definition at line 89 of file time_limited_delivery.hpp.

Member Data Documentation

◆ m_deadline

const std::chrono::steady_clock::time_point so_5::extra::enveloped_msg::time_limited_delivery_t::m_deadline
private

Delivery deadline.

Definition at line 56 of file time_limited_delivery.hpp.


The documentation for this class was generated from the following file: