Package deltix.qsrv.hf.tickdb.pub.topic
Interface TopicDB
-
- All Known Implementing Classes:
SecuredDbClient
,TickDBClient
@ParametersAreNonnullByDefault public interface TopicDB
TimeBase topics API. Topics are lightweight "Streams". Topics have much less functionality but may provide better latency for some applications. Please note, that most of patterns of interaction with topics assume that you can afford a dedicated CPU core for a thread that publishes data to a topic or reads it from a topic.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description deltix.data.stream.MessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
createConsumer(java.lang.String topicKey, ConsumerPreferences preferences, IdleStrategy idleStrategy)
CreatesMessageSource
-style message consumer (blocking).deltix.util.lang.Disposable
createConsumerWorker(java.lang.String topicKey, ConsumerPreferences preferences, IdleStrategy idleStrategy, java.util.concurrent.ThreadFactory threadFactory, MessageProcessor processor)
Creates worker-style message consumer.MessagePoller
createPollingConsumer(java.lang.String topicKey, ConsumerPreferences preferences)
Creates a non-blocking poll-style message consumer.deltix.data.stream.MessageChannel<deltix.qsrv.hf.pub.InstrumentMessage>
createPublisher(java.lang.String topicKey, PublisherPreferences preferences, IdleStrategy idleStrategy)
Creates channel for message publishing.DirectChannel
createTopic(java.lang.String topicKey, RecordClassDescriptor[] types, TopicSettings settings)
Creates pub/sub style topic (IPC).void
deleteTopic(java.lang.String topicKey)
Deletes topic data from registry.DirectChannel
getTopic(java.lang.String topicKey)
RecordClassDescriptor[]
getTypes(java.lang.String topicKey)
Returns list of types that can be written to and read from the specified topic.java.util.List<java.lang.String>
listTopics()
-
-
-
Method Detail
-
createTopic
DirectChannel createTopic(java.lang.String topicKey, RecordClassDescriptor[] types, @Nullable TopicSettings settings) throws DuplicateTopicException
Creates pub/sub style topic (IPC). You can use this type of topics only when client is local (on same machine with TimeBase).- Parameters:
topicKey
- topic identifiertypes
- list of message typessettings
- custom topic settings- Throws:
DuplicateTopicException
-
getTopic
@Nullable DirectChannel getTopic(java.lang.String topicKey)
-
deleteTopic
void deleteTopic(java.lang.String topicKey) throws TopicNotFoundException
Deletes topic data from registry. Does not check for existing publishers/consumers.- Throws:
TopicNotFoundException
-
listTopics
@CheckReturnValue java.util.List<java.lang.String> listTopics()
- Returns:
- list of all topic keys
-
getTypes
@CheckReturnValue RecordClassDescriptor[] getTypes(java.lang.String topicKey) throws TopicNotFoundException
Returns list of types that can be written to and read from the specified topic.- Parameters:
topicKey
- topic key- Returns:
- types for topic
- Throws:
TopicNotFoundException
-
createPublisher
@CheckReturnValue deltix.data.stream.MessageChannel<deltix.qsrv.hf.pub.InstrumentMessage> createPublisher(java.lang.String topicKey, @Nullable PublisherPreferences preferences, @Nullable IdleStrategy idleStrategy) throws TopicNotFoundException
Creates channel for message publishing.- Parameters:
topicKey
- topic identifierpreferences
- configuration for this publisheridleStrategy
- strategy to be used when publishing is not possible due to back pressure. Ifnull
then determined bypreferences
.- Throws:
TopicNotFoundException
-
createConsumerWorker
deltix.util.lang.Disposable createConsumerWorker(java.lang.String topicKey, @Nullable ConsumerPreferences preferences, @Nullable IdleStrategy idleStrategy, @Nullable java.util.concurrent.ThreadFactory threadFactory, MessageProcessor processor) throws TopicNotFoundException
Creates worker-style message consumer.- Parameters:
topicKey
- topic identifierpreferences
- configuration for this consumeridleStrategy
- strategy to be used when there are no messages to consume. Ifnull
then determined bypreferences
.threadFactory
- thread factory that will be used to run theprocessor
. Ifnull
then default thread factory will be used.processor
- instance to process arrived messages- Returns:
- returns a
Disposable
that can be used to stop message processing - Throws:
TopicNotFoundException
-
createPollingConsumer
@CheckReturnValue MessagePoller createPollingConsumer(java.lang.String topicKey, @Nullable ConsumerPreferences preferences) throws TopicNotFoundException
Creates a non-blocking poll-style message consumer.- Parameters:
topicKey
- topic identifierpreferences
- configuration for this consumer- Returns:
- returns
MessagePoller
that can be used to poll messages from subscription. - Throws:
TopicNotFoundException
-
createConsumer
@CheckReturnValue deltix.data.stream.MessageSource<deltix.qsrv.hf.pub.InstrumentMessage> createConsumer(java.lang.String topicKey, @Nullable ConsumerPreferences preferences, @Nullable IdleStrategy idleStrategy) throws TopicNotFoundException
CreatesMessageSource
-style message consumer (blocking).- Parameters:
topicKey
- topic identifierpreferences
- configuration for this consumeridleStrategy
- strategy to be used when there are no messages to consume. Ifnull
then determined bypreferences
.- Returns:
MessageSource
for topic. CallingAbstractCursor.next()
will block.- Throws:
TopicNotFoundException
-
-