public class WildcardSymbol extends Object implements Serializable
WildcardSymbol.ALL
constant can be added to any
DXFeedSubscription
instance with addSymbols
method
to the effect of subscribing to all possible event symbols. The corresponding subscription will start
receiving all published events of the corresponding types.
NOTE: Wildcard subscription can create extremely high network and CPU load for certain kinds of
high-frequency events like quotes. It requires a special arrangement on the side of upstream data provider and
is disabled by default in upstream feed configuration. Make that sure you have adequate resources and understand
the impact before using it. It can be used for low-frequency events only (like Forex quotes), because each instance
of DXFeedSubscription
processes events in a single thread and there is no provision to load-balance wildcard
subscription amongst multiple threads. Contact your data provider for the corresponding configuration arrangement if needed.
You need to create DXEndpoint
with DXFEED_WILDCARD_ENABLE_PROPERTY
property in order to support subscription to this wildcard symbols via
DXFeed
and to observe wildcard subscription via DXPublisher
.
DXFeed
on how to create connection to the feed.
The following code creates listener that prints all TimeAndSale
events that are
coming from the feed using wildcard subscription symbol:
DXFeedSubscription<TimeAndSale
> sub = feed.createSubscription
(TimeAndSale.class
); sub.addEventListener
(new DXFeedEventListener<TimeAndSale>() { public void eventsReceived(List<TimeAndSale> events) { for (TimeAndSale event : events) System.out.println(event); } }); sub.addSymbols
(WildcardSymbol.ALL
);
ObservableSubscription
that is retrieved via
DXPublisher.getSubscription
method can observe
WildcardSymbol.ALL
object in its set of symbols if any feed consumer
subscribes to wildcard symbol. The recommended approach is to use instanceof WildcardSymbol
check if support
of wildcard subscription is required.
WildcardSymbol
subscription and subscription to other symbols in a single instance
of DXFeedSubscription
. Doing so may result in a duplication of events and/or other implementation-specific
adverse effects.
Subscription via wildcard symbol for LastingEvent
types does not count for the purpose of
DXFeed.getLastEvent
and
DXFeed.getLastEvents
methods. Lasting events that are received
via wildcard subscription are not conflated in the usual way. They may incur significantly higher resource
requirements to process them and may get queued when network and CPU resources are inadequate.
ALL
. Data provides that publish events via DXPublisher
, track subscription via
DXPublisher.getSubscription
method, and plan to detect wildcard
subscription in order to start publishing all possible events, should use
symbol instanceof WildcardSymbol
code
to detect wildcard symbols to be future-proof.Modifier and Type | Field and Description |
---|---|
static WildcardSymbol |
ALL
Represents [wildcard] subscription to all events of the specific event type.
|
static String |
RESERVED_PREFIX
Symbol prefix that is reserved for wildcard subscriptions.
|
public static final String RESERVED_PREFIX
WildcardSymbol
subscription.public static final WildcardSymbol ALL
NOTE: Wildcard subscription can create extremely high network and CPU load for certain kinds of
high-frequency events like quotes. It requires a special arrangement on the side of upstream data provider and
is disabled by default in upstream feed configuration. Make that sure you have adequate resources and understand
the impact before using it. It can be used for low-frequency events only (like Forex quotes), because each instance
of DXFeedSubscription
processes events in a single thread and there is no provision to load-balance wildcard
subscription amongst multiple threads.
Contact your data provider for the corresponding configuration arrangement if needed.
WildcardSymbol
Copyright © 2002–2023 Devexperts LLC. All rights reserved.