Package deltix.qsrv.hf.tickdb.pub
Class InstrumentMessageSourceAdapter
- java.lang.Object
-
- deltix.qsrv.hf.tickdb.pub.MessageSourceAdapter<deltix.qsrv.hf.pub.InstrumentMessage>
-
- deltix.qsrv.hf.tickdb.pub.InstrumentMessageSourceAdapter
-
- All Implemented Interfaces:
deltix.data.stream.MessageSource<deltix.qsrv.hf.pub.InstrumentMessage>,RealTimeMessageSource<deltix.qsrv.hf.pub.InstrumentMessage>,EntityAndTypeSubscriptionController,EntitySubscriptionController,InstrumentMessageSource,MessageInfo,StreamSubscriptionController,SubscriptionController,SymbolAndTypeSubscriptionController,SymbolSubscriptionController,TimeController,TypedMessageSource,TypeSubscriptionController,deltix.util.concurrent.AbstractCursor,deltix.util.concurrent.IntermittentlyAvailableResource,deltix.util.lang.Disposable,java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
LimitedInstrumentMessageSource,SubscriptionManagerWrapper
public class InstrumentMessageSourceAdapter extends MessageSourceAdapter<deltix.qsrv.hf.pub.InstrumentMessage> implements InstrumentMessageSource
Utility classes that delegates InstrumentMessageSource interface
-
-
Constructor Summary
Constructors Constructor Description InstrumentMessageSourceAdapter(InstrumentMessageSource delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, java.lang.String[] types)Add the specified entities and types to subscription.voidadd(java.lang.CharSequence[] symbols, java.lang.String[] types)Add symbols of certain types to the subscription.voidaddEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)Bulk add the specified entities to subscription.voidaddEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)Add the specified entity to subscription.voidaddStream(TickStream... tickStreams)Add streams to subscription.voidaddSymbol(java.lang.CharSequence symbol)Add symbol to the subscription.voidaddSymbols(java.lang.CharSequence[] symbols)Add array of symbols to the subscription.voidaddSymbols(java.lang.CharSequence[] symbols, int offset, int length)Add array of symbols to the subscription from indexoffsetto indexoffset + length.voidaddTypes(java.lang.String... names)Add the specified type names to subscription.voidclearAllEntities()Switch to selective subscription mode (if necessary) and clear the list.voidclearAllSymbols()Unsubscribe all symbols.voidclose()intgetCurrentEntityIndex()Return a small number identifying the returned entity.TickStreamgetCurrentStream()Return the current stream instance, unless it has been removed, in which case null is returned.intgetCurrentStreamIndex()Return the index of the stream that is the source of the current message.java.lang.StringgetCurrentStreamKey()Return the key of the stream that is the source of the current message.RecordClassDescriptorgetCurrentType()Returns the type of the current message.intgetCurrentTypeIndex()Returns the type index of the current message.protected InstrumentMessageSourcegetDelegate()deltix.qsrv.hf.pub.InstrumentMessagegetMessage()Returns the current message.booleanisAtEnd()booleanisClosed()booleanisRealTime()booleannext()booleanrealTimeAvailable()voidremove(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, java.lang.String[] types)Remove the specified entities and types from subscription.voidremove(java.lang.CharSequence[] symbols, java.lang.String[] types)Remove symbols of certain types from the subscription.voidremoveAllStreams()Remove all streams from subscription.voidremoveEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)Remove the specified entities from subscription.voidremoveEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)Remove the specified entity from subscription.voidremoveStream(TickStream... tickStreams)Remove streams from subscription.voidremoveSymbol(java.lang.CharSequence symbol)Remove symbol from the subscription.voidremoveSymbols(java.lang.CharSequence[] symbols)Remove array of symbols from the subscription.voidremoveSymbols(java.lang.CharSequence[] symbols, int offset, int length)Remove array of symbols from the subscription from indexoffsetto indexoffset + length.voidremoveTypes(java.lang.String... names)Remove the specified types from subscription.voidreset(long time)Reposition the message source to a new point in time, while preserving current subscription.voidsetAvailabilityListener(java.lang.Runnable maybeAvailable)voidsetTimeForNewSubscriptions(long time)This method affects subsequent "add subscription" methods, such as, for instance, addEntity ().voidsetTypes(java.lang.String... names)Subscribe to specified types.voidsubscribeToAllEntities()Subscribe to all available entities.voidsubscribeToAllSymbols()Subscribe to all present symbols.voidsubscribeToAllTypes()Subscribe to all available types (no filtering).-
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
-
-
-
-
Constructor Detail
-
InstrumentMessageSourceAdapter
public InstrumentMessageSourceAdapter(InstrumentMessageSource delegate)
-
-
Method Detail
-
getDelegate
protected InstrumentMessageSource getDelegate()
- Overrides:
getDelegatein classMessageSourceAdapter<deltix.qsrv.hf.pub.InstrumentMessage>
-
getMessage
public deltix.qsrv.hf.pub.InstrumentMessage getMessage()
Description copied from interface:MessageInfoReturns the current message.- Specified by:
getMessagein interfaceInstrumentMessageSource- Specified by:
getMessagein interfaceMessageInfo- Specified by:
getMessagein interfacedeltix.data.stream.MessageSource<deltix.qsrv.hf.pub.InstrumentMessage>- Overrides:
getMessagein classMessageSourceAdapter<deltix.qsrv.hf.pub.InstrumentMessage>
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceInstrumentMessageSource
-
next
public boolean next()
- Specified by:
nextin interfacedeltix.util.concurrent.AbstractCursor- Overrides:
nextin classMessageSourceAdapter<deltix.qsrv.hf.pub.InstrumentMessage>
-
isAtEnd
public boolean isAtEnd()
- Specified by:
isAtEndin interfacedeltix.util.concurrent.AbstractCursor- Overrides:
isAtEndin classMessageSourceAdapter<deltix.qsrv.hf.pub.InstrumentMessage>
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacedeltix.util.lang.Disposable- Overrides:
closein classMessageSourceAdapter<deltix.qsrv.hf.pub.InstrumentMessage>
-
subscribeToAllEntities
public void subscribeToAllEntities()
Description copied from interface:EntitySubscriptionControllerSubscribe to all available entities.- Specified by:
subscribeToAllEntitiesin interfaceEntitySubscriptionController
-
clearAllEntities
public void clearAllEntities()
Description copied from interface:EntitySubscriptionControllerSwitch to selective subscription mode (if necessary) and clear the list.- Specified by:
clearAllEntitiesin interfaceEntitySubscriptionController
-
addEntity
public void addEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Description copied from interface:EntitySubscriptionControllerAdd 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:
addEntityin interfaceEntitySubscriptionController
-
addEntities
public void addEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)Description copied from interface:EntitySubscriptionControllerBulk 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:
addEntitiesin interfaceEntitySubscriptionController
-
removeEntity
public void removeEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Description copied from interface:EntitySubscriptionControllerRemove 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:
removeEntityin interfaceEntitySubscriptionController
-
removeEntities
public void removeEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)Description copied from interface:EntitySubscriptionControllerRemove 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:
removeEntitiesin interfaceEntitySubscriptionController
-
addStream
public void addStream(TickStream... tickStreams)
Description copied from interface:StreamSubscriptionControllerAdd streams to subscription. Current time and filter is used to query data from new sources.- Specified by:
addStreamin interfaceStreamSubscriptionController- Parameters:
tickStreams- Streams to add.
-
removeAllStreams
public void removeAllStreams()
Description copied from interface:StreamSubscriptionControllerRemove all streams from subscription.- Specified by:
removeAllStreamsin interfaceStreamSubscriptionController
-
removeStream
public void removeStream(TickStream... tickStreams)
Description copied from interface:StreamSubscriptionControllerRemove streams from subscription.- Specified by:
removeStreamin interfaceStreamSubscriptionController- Parameters:
tickStreams- Streams to remove.
-
subscribeToAllTypes
public void subscribeToAllTypes()
Description copied from interface:TypeSubscriptionControllerSubscribe to all available types (no filtering).- Specified by:
subscribeToAllTypesin interfaceTypeSubscriptionController
-
setTypes
public void setTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionControllerSubscribe to specified types.- Specified by:
setTypesin interfaceTypeSubscriptionController
-
addTypes
public void addTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionControllerAdd the specified type names to subscription.- Specified by:
addTypesin interfaceTypeSubscriptionController
-
removeTypes
public void removeTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionControllerRemove the specified types from subscription.- Specified by:
removeTypesin interfaceTypeSubscriptionController
-
add
public void add(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, java.lang.String[] types)Description copied from interface:EntityAndTypeSubscriptionControllerAdd 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:
addin 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:EntityAndTypeSubscriptionControllerRemove 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:
removein interfaceEntityAndTypeSubscriptionController- Parameters:
ids- not-null array of instruments to subscribe.types- not-null array of type names to subscribe.
-
add
public void add(java.lang.CharSequence[] symbols, java.lang.String[] types)Description copied from interface:SymbolAndTypeSubscriptionControllerAdd symbols of certain types to the subscription.- Specified by:
addin interfaceSymbolAndTypeSubscriptionController- Parameters:
symbols- symbols notationstypes- types (full names)
-
remove
public void remove(java.lang.CharSequence[] symbols, java.lang.String[] types)Description copied from interface:SymbolAndTypeSubscriptionControllerRemove symbols of certain types from the subscription.- Specified by:
removein interfaceSymbolAndTypeSubscriptionController- Parameters:
symbols- symbols notationstypes- types (full names)
-
subscribeToAllSymbols
public void subscribeToAllSymbols()
Description copied from interface:SymbolSubscriptionControllerSubscribe to all present symbols.- Specified by:
subscribeToAllSymbolsin interfaceSymbolSubscriptionController
-
clearAllSymbols
public void clearAllSymbols()
Description copied from interface:SymbolSubscriptionControllerUnsubscribe all symbols.- Specified by:
clearAllSymbolsin interfaceSymbolSubscriptionController
-
addSymbol
public void addSymbol(java.lang.CharSequence symbol)
Description copied from interface:SymbolSubscriptionControllerAdd symbol to the subscription.- Specified by:
addSymbolin interfaceSymbolSubscriptionController- Parameters:
symbol- symbol to be added
-
addSymbols
public void addSymbols(java.lang.CharSequence[] symbols, int offset, int length)Description copied from interface:SymbolSubscriptionControllerAdd array of symbols to the subscription from indexoffsetto indexoffset + length.- Specified by:
addSymbolsin interfaceSymbolSubscriptionController- Parameters:
symbols- array of symbols to be added to subscriptionoffset- start indexlength- length of symbols to be added
-
removeSymbol
public void removeSymbol(java.lang.CharSequence symbol)
Description copied from interface:SymbolSubscriptionControllerRemove symbol from the subscription.- Specified by:
removeSymbolin interfaceSymbolSubscriptionController- Parameters:
symbol- symbol to be removed
-
removeSymbols
public void removeSymbols(java.lang.CharSequence[] symbols, int offset, int length)Description copied from interface:SymbolSubscriptionControllerRemove array of symbols from the subscription from indexoffsetto indexoffset + length.- Specified by:
removeSymbolsin interfaceSymbolSubscriptionController- Parameters:
symbols- array of symbols to be removedoffset- start indexlength- length of symbols to be removed
-
addSymbols
public void addSymbols(java.lang.CharSequence[] symbols)
Description copied from interface:SymbolSubscriptionControllerAdd array of symbols to the subscription.- Specified by:
addSymbolsin interfaceSymbolSubscriptionController- Parameters:
symbols- symbols to be added
-
removeSymbols
public void removeSymbols(java.lang.CharSequence[] symbols)
Description copied from interface:SymbolSubscriptionControllerRemove array of symbols from the subscription.- Specified by:
removeSymbolsin interfaceSymbolSubscriptionController- Parameters:
symbols- symbols to be removed
-
setTimeForNewSubscriptions
public void setTimeForNewSubscriptions(long time)
Description copied from interface:TimeControllerThis method affects subsequent "add subscription" methods, such as, for instance, addEntity (). New subscriptions start at the specified time.- Specified by:
setTimeForNewSubscriptionsin interfaceTimeController- Parameters:
time- The time to use, orTimeConstants.USE_CURRENT_TIMEto use server's system time, orTimeConstants.USE_CURSOR_TIMEto use cursor's last read time.
-
reset
public void reset(long time)
Description copied from interface:TimeControllerReposition the message source to a new point in time, while preserving current subscription.- Specified by:
resetin interfaceTimeController- Parameters:
time- The new position in time.
-
getCurrentStreamIndex
public int getCurrentStreamIndex()
Description copied from interface:MessageInfoReturn the index of the stream that is the source of the current message.- Specified by:
getCurrentStreamIndexin interfaceMessageInfo- Returns:
- The current message source stream's index.
-
getCurrentStreamKey
public java.lang.String getCurrentStreamKey()
Description copied from interface:MessageInfoReturn the key of the stream that is the source of the current message.- Specified by:
getCurrentStreamKeyin interfaceMessageInfo- Returns:
- The source stream key.
-
getCurrentStream
public TickStream getCurrentStream()
Description copied from interface:MessageInfoReturn the current stream instance, unless it has been removed, in which case null is returned.- Specified by:
getCurrentStreamin interfaceMessageInfo
-
getCurrentEntityIndex
public int getCurrentEntityIndex()
Description copied from interface:MessageInfoReturn 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:
getCurrentEntityIndexin interfaceMessageInfo- See Also:
EntitySubscriptionController
-
getCurrentTypeIndex
public int getCurrentTypeIndex()
Description copied from interface:TypedMessageSourceReturns the type index of the current message.- Specified by:
getCurrentTypeIndexin interfaceTypedMessageSource- Returns:
- The current message type index.
-
getCurrentType
public RecordClassDescriptor getCurrentType()
Description copied from interface:TypedMessageSourceReturns the type of the current message.- Specified by:
getCurrentTypein interfaceTypedMessageSource- Returns:
- The current message type.
-
setAvailabilityListener
public void setAvailabilityListener(java.lang.Runnable maybeAvailable)
- Specified by:
setAvailabilityListenerin interfacedeltix.util.concurrent.IntermittentlyAvailableResource
-
isRealTime
public boolean isRealTime()
- Specified by:
isRealTimein 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:
realTimeAvailablein 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.
-
-