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, that using wildcard subscription can create extremely high network and CPU load for certain kinds of high-frequency events like quotes. Make sure you have adequate resource and understand the impact before using it.
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
WildcardSymbol
Copyright © 2014 Devexperts. All Rights Reserved.