Class TickCursorClientAeron
- java.lang.Object
-
- deltix.qsrv.hf.tickdb.comm.client.TickCursorClientAeron
-
- All Implemented Interfaces:
deltix.data.stream.MessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
,RealTimeMessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
,EntityAndTypeSubscriptionController
,EntitySubscriptionController
,InstrumentMessageSource
,MessageInfo
,StreamSubscriptionController
,SubscriptionController
,SubscriptionInfo
,SubscriptionManager
,SymbolAndTypeSubscriptionController
,SymbolAndTypeSubscriptionControllerClient
,SymbolSubscriptionController
,TimeController
,TypedMessageSource
,TypeSubscriptionController
,TickCursor
,deltix.util.concurrent.AbstractCursor
,deltix.util.concurrent.IntermittentlyAvailableCursor
,deltix.util.concurrent.IntermittentlyAvailableResource
,deltix.util.lang.Disposable
,io.aeron.logbuffer.ControlledFragmentHandler
,java.io.Closeable
,java.lang.AutoCloseable
public class TickCursorClientAeron extends java.lang.Object implements TickCursor, SubscriptionManager, deltix.util.concurrent.IntermittentlyAvailableCursor, io.aeron.logbuffer.ControlledFragmentHandler, SymbolAndTypeSubscriptionControllerClient
-
-
Field Summary
-
Fields inherited from interface deltix.qsrv.hf.tickdb.pub.query.SymbolAndTypeSubscriptionControllerClient
ALL_TYPES, LENGTH
-
-
Constructor Summary
Constructors Constructor Description TickCursorClientAeron(deltix.qsrv.hf.tickdb.comm.client.DXRemoteDB db, VSChannel channel, SelectionOptions options, long time, boolean allEntitiesSubscribed, boolean allTypesSubscribed, InstrumentToObjectMap<java.lang.Long> subscribedEntities, java.util.HashSet<java.lang.String> subscribedTypes, java.util.HashSet<TickStream> subscribedStreams, io.aeron.Aeron aeron, int aeronDataStreamId, int aeronCommandStreamId, DXAeronSubscriptionChecker subscriptionChecker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, java.lang.String[] types)
Add the specified entities and types to subscription.void
addEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)
Bulk add the specified entities to subscription.void
addEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Add the specified entity to subscription.void
addStream(TickStream... tickStreams)
Add streams to subscription.void
addTypes(java.lang.String... names)
Add the specified type names to subscription.void
clearAllEntities()
Switch to selective subscription mode (if necessary) and clear the list.void
close()
int
getCurrentEntityIndex()
Return a small number identifying the returned entity.TickStream
getCurrentStream()
Return the current stream instance, unless it has been removed, in which case null is returned.int
getCurrentStreamIndex()
Return the index of the stream that is the source of the current message.java.lang.String
getCurrentStreamKey()
Return the key of the stream that is the source of the current message.RecordClassDescriptor
getCurrentType()
Returns the type of the current message.int
getCurrentTypeIndex()
Returns the type index of the current message.deltix.qsrv.hf.pub.InstrumentMessage
getMessage()
Returns the current message.deltix.qsrv.hf.pub.InstrumentIdentity[]
getSubscribedEntities()
Get the specified entities of the current subscription.java.lang.String[]
getSubscribedTypes()
Get the specified type names of the current subscription.boolean
hasSubscribedTypes()
Indicates true if types subscription is not empty.boolean
isAllEntitiesSubscribed()
Indicates that all entities subscribed (no filtering).boolean
isAllTypesSubscribed()
Indicates that all types subscribed (no filtering).boolean
isAtEnd()
boolean
isClosed()
boolean
isRealTime()
boolean
next()
deltix.util.concurrent.NextResult
nextIfAvailable()
io.aeron.logbuffer.ControlledFragmentHandler.Action
onFragment(org.agrona.DirectBuffer buffer, int offset, int length, io.aeron.logbuffer.Header header)
boolean
realTimeAvailable()
void
remove(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, java.lang.String[] types)
Remove the specified entities and types from subscription.void
removeAllStreams()
Remove all streams from subscription.void
removeEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)
Remove the specified entities from subscription.void
removeEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Remove the specified entity from subscription.void
removeStream(TickStream... tickStreams)
Remove streams from subscription.void
removeTypes(java.lang.String... names)
Remove the specified types from subscription.void
reset(long time)
Reposition the message source to a new point in time, while preserving current subscription.void
setAvailabilityListener(java.lang.Runnable lnr)
void
setTimeForNewSubscriptions(long time)
This method affects subsequent "add subscription" methods, such as, for instance, addEntity ().void
setTypes(java.lang.String... names)
Subscribe to specified types.void
subscribeToAllEntities()
Subscribe to all available entities.void
subscribeToAllTypes()
Subscribe to all available types (no filtering).static void
writeStreamKeys(java.io.DataOutputStream out, TickStream[] streams)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface deltix.qsrv.hf.tickdb.pub.query.EntitySubscriptionController
addEntities, removeEntities
-
Methods inherited from interface deltix.qsrv.hf.tickdb.pub.query.SubscriptionInfo
getSubscribedSymbols, isAllSymbolsSubscribed
-
Methods inherited from interface deltix.qsrv.hf.tickdb.pub.query.SymbolAndTypeSubscriptionControllerClient
add, addSymbol, addSymbols, clearAllSymbols, remove, removeSymbol, removeSymbols, subscribeToAllSymbols
-
Methods inherited from interface deltix.qsrv.hf.tickdb.pub.query.SymbolSubscriptionController
addSymbols, removeSymbols
-
-
-
-
Constructor Detail
-
TickCursorClientAeron
public TickCursorClientAeron(deltix.qsrv.hf.tickdb.comm.client.DXRemoteDB db, VSChannel channel, SelectionOptions options, long time, boolean allEntitiesSubscribed, boolean allTypesSubscribed, InstrumentToObjectMap<java.lang.Long> subscribedEntities, java.util.HashSet<java.lang.String> subscribedTypes, java.util.HashSet<TickStream> subscribedStreams, io.aeron.Aeron aeron, int aeronDataStreamId, int aeronCommandStreamId, DXAeronSubscriptionChecker subscriptionChecker)
-
-
Method Detail
-
setTimeForNewSubscriptions
public void setTimeForNewSubscriptions(long time)
Description copied from interface:TimeController
This method affects subsequent "add subscription" methods, such as, for instance, addEntity (). New subscriptions start at the specified time.- Specified by:
setTimeForNewSubscriptions
in interfaceTimeController
- Parameters:
time
- The time to use, orTimeConstants.USE_CURRENT_TIME
to use server's system time, orTimeConstants.USE_CURSOR_TIME
to use cursor's last read time.
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceInstrumentMessageSource
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacedeltix.util.lang.Disposable
-
addStream
public void addStream(TickStream... tickStreams)
Description copied from interface:StreamSubscriptionController
Add streams to subscription. Current time and filter is used to query data from new sources.- Specified by:
addStream
in interfaceStreamSubscriptionController
- Parameters:
tickStreams
- Streams to add.
-
removeStream
public void removeStream(TickStream... tickStreams)
Description copied from interface:StreamSubscriptionController
Remove streams from subscription.- Specified by:
removeStream
in interfaceStreamSubscriptionController
- Parameters:
tickStreams
- Streams to remove.
-
writeStreamKeys
public static void writeStreamKeys(java.io.DataOutputStream out, TickStream[] streams) throws java.io.IOException
- Throws:
java.io.IOException
-
removeAllStreams
public void removeAllStreams()
Description copied from interface:StreamSubscriptionController
Remove all streams from subscription.- Specified by:
removeAllStreams
in interfaceStreamSubscriptionController
-
reset
public void reset(long time)
Description copied from interface:TimeController
Reposition the message source to a new point in time, while preserving current subscription.- Specified by:
reset
in interfaceTimeController
- Parameters:
time
- The new position in time.
-
clearAllEntities
public void clearAllEntities()
Description copied from interface:EntitySubscriptionController
Switch to selective subscription mode (if necessary) and clear the list.- Specified by:
clearAllEntities
in interfaceEntitySubscriptionController
-
subscribeToAllEntities
public void subscribeToAllEntities()
Description copied from interface:EntitySubscriptionController
Subscribe to all available entities.- Specified by:
subscribeToAllEntities
in interfaceEntitySubscriptionController
-
removeEntity
public void removeEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Description copied from interface:EntitySubscriptionController
Remove the specified entity from subscription. The type and symbol are copied from the incoming object, if necessary, so the argument can be re-used after the call.- Specified by:
removeEntity
in interfaceEntitySubscriptionController
-
removeEntities
public void removeEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)
Description copied from interface:EntitySubscriptionController
Remove the specified entities from subscription. The type and symbol are copied from the incoming objects, if necessary, so the arguments can be re-used after the call.- Specified by:
removeEntities
in interfaceEntitySubscriptionController
-
addEntity
public void addEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Description copied from interface:EntitySubscriptionController
Add the specified entity to subscription. The type and symbol are copied from the incoming object, if necessary, so the argument can be re-used after the call. Special note about options: The following fragment will subscribe to specific option contract "DAV 100417P00085000":addEntity(new InstrumentKey(InstrumentType.OPTION, "DAV 100417P00085000"));
While the following will subscribe to option root (and you will get all instruments with this root):addEntity(new InstrumentKey(InstrumentType.OPTION, "DAV "));
- Specified by:
addEntity
in interfaceEntitySubscriptionController
-
addEntities
public void addEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)
Description copied from interface:EntitySubscriptionController
Bulk add the specified entities to subscription. The type and symbol are copied from the incoming objects, if necessary, so the arguments can be re-used after the call.- Specified by:
addEntities
in interfaceEntitySubscriptionController
-
getSubscribedEntities
public deltix.qsrv.hf.pub.InstrumentIdentity[] getSubscribedEntities()
Description copied from interface:SubscriptionInfo
Get the specified entities of the current subscription.- Specified by:
getSubscribedEntities
in interfaceSubscriptionInfo
- Returns:
- not-nullable array of subscribed entities.
-
isAllEntitiesSubscribed
public boolean isAllEntitiesSubscribed()
Description copied from interface:SubscriptionInfo
Indicates that all entities subscribed (no filtering).- Specified by:
isAllEntitiesSubscribed
in interfaceSubscriptionInfo
- Returns:
- true if all entities subscribed.
-
getSubscribedTypes
public java.lang.String[] getSubscribedTypes()
Description copied from interface:SubscriptionInfo
Get the specified type names of the current subscription.- Specified by:
getSubscribedTypes
in interfaceSubscriptionInfo
- Returns:
- not-nullable array of subscribed type names.
-
isAllTypesSubscribed
public boolean isAllTypesSubscribed()
Description copied from interface:SubscriptionInfo
Indicates that all types subscribed (no filtering).- Specified by:
isAllTypesSubscribed
in interfaceSubscriptionInfo
- Returns:
- true if all types subscribed.
-
hasSubscribedTypes
public boolean hasSubscribedTypes()
Description copied from interface:SubscriptionInfo
Indicates true if types subscription is not empty.- Specified by:
hasSubscribedTypes
in interfaceSubscriptionInfo
- Returns:
- true if at least one type was subscribed.
-
subscribeToAllTypes
public void subscribeToAllTypes()
Description copied from interface:TypeSubscriptionController
Subscribe to all available types (no filtering).- Specified by:
subscribeToAllTypes
in interfaceTypeSubscriptionController
-
setTypes
public void setTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionController
Subscribe to specified types.- Specified by:
setTypes
in interfaceTypeSubscriptionController
-
addTypes
public void addTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionController
Add the specified type names to subscription.- Specified by:
addTypes
in interfaceTypeSubscriptionController
-
add
public void add(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, java.lang.String[] types)
Description copied from interface:EntityAndTypeSubscriptionController
Add the specified entities and types to subscription. The type and symbol are copied from the incoming object, if necessary, so the argument can be re-used after the call.- Specified by:
add
in interfaceEntityAndTypeSubscriptionController
- Parameters:
ids
- not-null array of instruments to subscribe.types
- not-null array of type names to subscribe.
-
remove
public void remove(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, java.lang.String[] types)
Description copied from interface:EntityAndTypeSubscriptionController
Remove the specified entities and types from subscription. The type and symbol are copied from the incoming objects, if necessary, so the arguments can be re-used after the call.- Specified by:
remove
in interfaceEntityAndTypeSubscriptionController
- Parameters:
ids
- not-null array of instruments to subscribe.types
- not-null array of type names to subscribe.
-
removeTypes
public void removeTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionController
Remove the specified types from subscription.- Specified by:
removeTypes
in interfaceTypeSubscriptionController
-
nextIfAvailable
public deltix.util.concurrent.NextResult nextIfAvailable()
- Specified by:
nextIfAvailable
in interfacedeltix.util.concurrent.IntermittentlyAvailableCursor
-
next
public boolean next()
- Specified by:
next
in interfacedeltix.util.concurrent.AbstractCursor
-
onFragment
public io.aeron.logbuffer.ControlledFragmentHandler.Action onFragment(org.agrona.DirectBuffer buffer, int offset, int length, io.aeron.logbuffer.Header header)
- Specified by:
onFragment
in interfaceio.aeron.logbuffer.ControlledFragmentHandler
-
getCurrentStreamKey
public java.lang.String getCurrentStreamKey()
Description copied from interface:MessageInfo
Return the key of the stream that is the source of the current message.- Specified by:
getCurrentStreamKey
in interfaceMessageInfo
- Returns:
- The source stream key.
-
getCurrentStream
public TickStream getCurrentStream()
Description copied from interface:MessageInfo
Return the current stream instance, unless it has been removed, in which case null is returned.- Specified by:
getCurrentStream
in interfaceMessageInfo
-
getCurrentStreamIndex
public int getCurrentStreamIndex()
Description copied from interface:MessageInfo
Return the index of the stream that is the source of the current message.- Specified by:
getCurrentStreamIndex
in interfaceMessageInfo
- Returns:
- The current message source stream's index.
-
getCurrentType
public RecordClassDescriptor getCurrentType()
Description copied from interface:TypedMessageSource
Returns the type of the current message.- Specified by:
getCurrentType
in interfaceTypedMessageSource
- Returns:
- The current message type.
-
getCurrentTypeIndex
public int getCurrentTypeIndex()
Description copied from interface:TypedMessageSource
Returns the type index of the current message.- Specified by:
getCurrentTypeIndex
in interfaceTypedMessageSource
- Returns:
- The current message type index.
-
getMessage
public deltix.qsrv.hf.pub.InstrumentMessage getMessage()
Description copied from interface:MessageInfo
Returns the current message.- Specified by:
getMessage
in interfaceInstrumentMessageSource
- Specified by:
getMessage
in interfaceMessageInfo
- Specified by:
getMessage
in interfacedeltix.data.stream.MessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
-
isAtEnd
public boolean isAtEnd()
- Specified by:
isAtEnd
in interfacedeltix.util.concurrent.AbstractCursor
-
getCurrentEntityIndex
public int getCurrentEntityIndex()
Description copied from interface:MessageInfo
Return a small number identifying the returned entity. This number is unique throughout the life of the message source. Removing entities from subscription does not create reusable holes in the "space" of entity indexes.- Specified by:
getCurrentEntityIndex
in interfaceMessageInfo
- See Also:
EntitySubscriptionController
-
setAvailabilityListener
public void setAvailabilityListener(java.lang.Runnable lnr)
- Specified by:
setAvailabilityListener
in interfacedeltix.util.concurrent.IntermittentlyAvailableResource
-
isRealTime
public boolean isRealTime()
- Specified by:
isRealTime
in interfaceRealTimeMessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
- Returns:
- true if this source already switched from historical to real-time data portion
-
realTimeAvailable
public boolean realTimeAvailable()
- Specified by:
realTimeAvailable
in interfaceRealTimeMessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
- Returns:
- true if source can be switched in real-time.
When realtime mode is available client can use method
RealTimeMessageSource.isRealTime()
()} to detect switch from historical to real-time portion of data. Also in this mode client will receive special messageRealTimeStartMessage
.
-
-