dxFeed Graal CXX API v9.0.0
Loading...
Searching...
No Matches
PromiseContext.hpp
1// Copyright (c) 2026 Devexperts LLC.
2// SPDX-License-Identifier: MPL-2.0
3
4#pragma once
5
6#include "../../include/dxfeed_graal_cpp_api/detail/Conf.hpp"
7#include "../internal/InternalExport.hpp"
8
9DXFCXX_DISABLE_MSC_WARNINGS_PUSH(4251)
10
11#include <cstdint>
12#include <memory>
13#include <optional>
14#include <string>
15
16DXFCPP_BEGIN_NAMESPACE
17
18struct DXEndpoint;
19
20/**
21 * The raw description of the request that created a promise of DXFeed. The text is built lazily, when the wait of the
22 * promise times out: see describePromiseTimeout().
23 */
25 /// The name of the DXFeed method, for example `getLastEventPromise`.
27
28 /// The name of the event type, for example `Quote`.
30
31 /// The symbol of the request.
33
34 /// The source of the request (indexed events only).
36
37 /// The beginning of the time range (time series only).
38 std::optional<std::int64_t> fromTime{};
39
40 /// The end of the time range (time series only).
41 std::optional<std::int64_t> toTime{};
42
43 /// The endpoint that created the feed of the promise. It is weak: the description does not keep the endpoint alive.
44 std::weak_ptr<const DXEndpoint> endpoint{};
45};
46
47/**
48 * Builds the text that is added to the message of the Java exception when the wait of the promise times out:
49 * `timed out after <elapsed> ms (timeout <timeout> ms) waiting for <method><<Type>>(<symbol>[, source=<source>]
50 * [, fromTime=<time>, toTime=<time>]); endpoint state: <STATE|unknown>`.
51 *
52 * Does not throw because of the formatting of the times or the state of the endpoint: a time falls back to the number
53 * of milliseconds, the state to `unknown`.
54 *
55 * @param context The description of the request.
56 * @param elapsedInMilliseconds The measured time of the wait.
57 * @param timeoutInMilliseconds The timeout of the wait.
58 * @return The text.
59 */
60DXFCPP_INTERNAL_EXPORT std::string describePromiseTimeout(const PromiseContext &context,
61 std::int64_t elapsedInMilliseconds,
62 std::int32_t timeoutInMilliseconds);
63
64DXFCPP_END_NAMESPACE
65
66DXFCXX_DISABLE_MSC_WARNINGS_POP()
Subscription for a set of symbols and event types.
Definition DXFeedSubscription.hpp:102
Extends DXFeedSubscription to conveniently subscribe to time-series of events for a set of symbols an...
Definition DXFeedSubscription.hpp:953
The enumeration type that provides additional information about the dxFeed Graal C++-API event type.
Definition EventTypeEnum.hpp:40
bool isTimeSeries() const noexcept
Definition EventTypeEnum.cpp:237
Source identifier for IndexedEvent.
Definition IndexedEventSource.hpp:31
Manages network connections to feed or publisher.
Definition DXEndpoint.hpp:189
Main entry class for dxFeed API (read it first).
Definition DXFeed.hpp:142
void detachSubscriptionAndClear(const std::shared_ptr< DXFeedSubscription > &subscription) const
Detaches the given subscription from this feed and clears data delivered to this subscription by publ...
Definition DXFeed.cpp:102
std::shared_ptr< DXFeedSubscription > createSubscription(const EventTypeEnum &eventType) const
Creates a new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:167
static std::shared_ptr< DXFeed > getInstance()
Returns a default application-wide singleton instance of feed.
Definition DXFeed.cpp:25
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeed.cpp:359
void detachSubscription(const std::shared_ptr< DXFeedSubscription > &subscription) const
Detaches the given subscription from this feed.
Definition DXFeed.cpp:76
void attachSubscription(const std::shared_ptr< DXFeedSubscription > &subscription) const
Attaches the given subscription to this feed.
Definition DXFeed.cpp:34
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(const EventTypeEnum &eventType) const
Creates a new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:195
Concrete implementation of a event for std::string.
Definition EventType.hpp:148
Marks all event types that can be received via dxFeed API.
Definition EventType.hpp:42
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Definition InvalidArgumentException.hpp:23
The raw description of the request that created a promise of DXFeed.
Definition PromiseContext.hpp:24
std::string method
The name of the DXFeed method, for example getLastEventPromise.
Definition PromiseContext.hpp:26
std::string symbol
The symbol of the request.
Definition PromiseContext.hpp:32
std::string eventType
The name of the event type, for example Quote.
Definition PromiseContext.hpp:29
std::optional< std::int64_t > toTime
The end of the time range (time series only).
Definition PromiseContext.hpp:41
std::optional< std::int64_t > fromTime
The beginning of the time range (time series only).
Definition PromiseContext.hpp:38
std::optional< std::string > source
The source of the request (indexed events only).
Definition PromiseContext.hpp:35
std::weak_ptr< const DXEndpoint > endpoint
The endpoint that created the feed of the promise. It is weak: the description does not keep the endp...
Definition PromiseContext.hpp:44