OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
MulticastDelivery Class Reference

#include <OnixS/CME/MDH/testing/MulticastFeed.h>

Protected Types

enum  : std::size_t

Protected Member Functions

 MulticastDelivery (NetFeedType::Enum target, const FeedSettings &feedSettings=generateFeedSettings(), Messaging::TimeSpan arbitrageDelay=Messaging::TimeSpan{}, ReplayDelayer &delayPolicy=CombinedReplayDelayer::service(), const MulticastTargetOptions &options=MulticastTargetOptions{})
 ~MulticastDelivery ()
Threading::Event send (const ByteSpan packet[], std::size_t spansCount)
void sendPrimary (const ByteSpan packet[], std::size_t spansCount)
void sendSecondary (const ByteSpan packet[], std::size_t spansCount)
NetFeedRole::Enum primaryFeed () const noexcept
NetFeedRole::Enum secondaryFeed () const noexcept
bool hasSecondary () const noexcept

Detailed Description

This class is a delivery policy and cannot be constructed or used directly. MulticastFeed exposes its operations as a packet-building feed. The policy sends to the primary endpoint synchronously and sends to the secondary endpoint synchronously or asynchronously according to its delay configuration. Targeted primary and secondary sends are synchronous and do not apply the configured arbitrage delay.

Warning
A targeted secondary send can overtake queued delayed secondary sends and deliver packets out of sequence-number order.

Definition at line 41 of file MulticastFeed.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : std::size_t
protected

Maximum number of byte spans accepted by the multicast target.

Enumerator
MaxSpansCount MulticastTarget::MaxSpansCount 

Definition at line 45 of file MulticastFeed.h.

Constructor & Destructor Documentation

◆ MulticastDelivery()

MulticastDelivery ( NetFeedType::Enum target,
const FeedSettings & feedSettings = generateFeedSettings(),
Messaging::TimeSpan arbitrageDelay = Messaging::TimeSpan{},
ReplayDelayer & delayPolicy = CombinedReplayDelayer::service(),
const MulticastTargetOptions & options = MulticastTargetOptions{} )
explicitprotected

Creates and joins the multicast target for one network feed type.

An asynchronous secondary sender is created only when the selected layout configures a secondary endpoint and the delay is at least one microsecond. Smaller delays send synchronously.

Parameters
targetFeed type whose multicast connection settings are used.
feedSettingsFeed settings containing the target's layout, endpoints, network interfaces, and packet size limit.
arbitrageDelayDelay applied before sending to the secondary feed when both feeds are configured.
delayPolicyPolicy used to implement an asynchronous secondary-feed delay. The referenced object must outlive this multicast feed.
optionsMulticast socket options applied to the target.
Exceptions
std::runtime_errorIf the requested feed is unsupported or has no configured endpoint, its layout is unsupported, or an effective endpoint does not contain a valid IPv4 multicast group, port, and explicit network interface.
std::invalid_argumentIf a positive TTL is not authorized through ONIXS_CMEMDH_ALLOW_MULTICAST_EGRESS, or an outgoing destination outside 239.0.0.0/8 is not authorized through ONIXS_CMEMDH_ALLOW_ANY_MULTICAST_DESTINATION.
Anyexception thrown while creating or joining a multicast client.

◆ ~MulticastDelivery()

~MulticastDelivery ( )
protected

Drains queued secondary sends and releases the multicast target.

Note
Destruction can block until pending delayed secondary sends finish.

Member Function Documentation

◆ hasSecondary()

bool hasSecondary ( ) const
protectednoexcept

Indicates whether the complementary endpoint is configured.

Returns
true when secondary transmissions have a destination.

◆ primaryFeed()

NetFeedRole::Enum primaryFeed ( ) const
protectednoexcept

Identifies the endpoint used for primary transmissions.

Returns
Configured primary feed role.

◆ secondaryFeed()

NetFeedRole::Enum secondaryFeed ( ) const
protectednoexcept

Identifies the role complementary to the primary feed.

Returns
Complementary feed role.

◆ send()

Threading::Event send ( const ByteSpan packet[],
std::size_t spansCount )
protected

Sends a complete packet to the configured multicast feeds.

The primary UDP send completes before this method returns. When the secondary send is queued, the returned event becomes ready after it completes and Threading::Event::get() propagates its failure. Otherwise, the event is ready on return.

Parameters
packetPacket spans, beginning with the packet header.
spansCountNumber of spans in packet.
Returns
Completion event for the asynchronous part of the send operation.
Exceptions
std::runtime_errorIf the packet exceeds the configured size limit, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails.

◆ sendPrimary()

void sendPrimary ( const ByteSpan packet[],
std::size_t spansCount )
protected

Sends a complete packet synchronously to the primary feed.

Parameters
packetPacket spans, beginning with the packet header.
spansCountNumber of spans in packet.
Exceptions
std::runtime_errorIf the packet exceeds the configured size limit or the UDP send fails.

◆ sendSecondary()

void sendSecondary ( const ByteSpan packet[],
std::size_t spansCount )
protected

Sends a complete packet synchronously to the secondary feed.

Note
The packet is validated but not transmitted when no secondary endpoint is configured.
Parameters
packetPacket spans, beginning with the packet header.
spansCountNumber of spans in packet.
Exceptions
std::runtime_errorIf the packet exceeds the configured size limit or the UDP send fails.