![]() |
OpenSplice Java 5 DCPS
v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
|
By using the SubscriptionKey QosPolicy, a DataReader can force its own key-list definition on data samples. More...
Public Member Functions | |
ServiceEnvironment | getEnvironment () |
Set< String > | getKey () |
SubscriptionKeys | withKey (Collection< String > keyList) |
Copy this policy and override the value of the property. More... | |
SubscriptionKeys | withKey (String keyList) |
Copy this policy and override the value of the property. More... | |
SubscriptionKeys | withKey (String... keyList) |
Copy this policy and override the value of the property. More... | |
By using the SubscriptionKey QosPolicy, a DataReader can force its own key-list definition on data samples.
The consequences are that the DataReader will internally keep track of instances based on its own key list, instead of the key list dictated by the Topic. Operations that operate on instances or instance handles, such as org.omg.dds.sub.DataReader#lookupInstance(Object) or org.omg.dds.sub.DataReader#getKeyValue(org.omg.dds.core.InstanceHandle) , respect the alternative key-list and work as expected.
However, since the mapping of writer instances to reader instances is no longer trivial (one writer instance may now map to more than one matching reader instance and vice versa), a writer instance will no longer be able to fully determine the lifecycle of its matching reader instance, nor the value its org.omg.dds.sub.ViewState and org.omg.dds.sub.InstanceState.
In fact, by diverting from the conceptual 1 - 1 mapping between writer instance and reader instance, the writer can no longer keep an (empty) reader instance ALIVE by just refusing to unregister its matching writer instance. That means that when a reader takes all samples from a particular reader instance, that reader instance will immediately be removed from the reader's administration. Any subsequent reception of a message with the same keys will re-introduce the instance into the reader administration, setting its view_state back to NEW. Compare this to the default behavior, where the reader instance will be kept alive as long as the writer does not unregister it. That causes the view_state in the reader instance to remain NOT_NEW, even if the reader has consumed all of its samples prior to receiving an update.
Another consequence of allowing an alternative keylist is that events that are communicated by invalid samples (i.e. samples that have only initialized their keyfields) may no longer be interpreted by the reader to avoid situations in which uninitialized non-keyfields are treated as keys in the alternative keylist. This effectively means that all invalid samples (e.g. unregister messages and both implicit and explicit dispose messages) will be skipped and can no longer affect the InstanceState, which will therefore remain ALIVE. The only exceptions to this are the messages that are transmitted explicitly using the org.opensplice.dds.pub.DataWriter#writeDispose(Object) call, which always includes a full and valid sample and can therefore modify the InstanceState to NOT_ALIVE_DISPOSED.
By default, the SubscriptionKey QosPolicy is not used.
This QosPolicy is applicable to a DataReader only, and cannot be changed after the DataReader is enabled.
Definition at line 75 of file SubscriptionKeys.java.
|
inherited |
Implemented in org.omg.dds.core.ServiceEnvironment, org.opensplice.dds.sub.ReflectionDataReader< TYPE, OUT_TYPE >, org.opensplice.dds.core.ModifiableTimeImpl, org.opensplice.dds.pub.ReflectionDataWriter< TYPE >, org.opensplice.dds.core.DurationImpl, org.opensplice.dds.topic.ContentFilteredTopicImpl< TYPE >, org.opensplice.dds.sub.ReadConditionImpl< TYPE >, org.opensplice.dds.core.EntityQosImpl< T extends QosPolicy >, org.opensplice.dds.type.TypeSupportImpl< TYPE >, org.opensplice.dds.topic.PublicationBuiltinTopicDataImpl, org.opensplice.dds.topic.SubscriptionBuiltinTopicDataImpl, org.opensplice.dds.topic.TopicBuiltinTopicDataImpl, org.opensplice.dds.domain.DomainParticipantFactoryImpl, org.opensplice.dds.core.QosProviderImpl, org.opensplice.dds.core.status.OfferedIncompatibleQosStatusImpl, org.opensplice.dds.core.status.RequestedIncompatibleQosStatusImpl, org.opensplice.dds.core.InstanceHandleImpl, org.opensplice.dds.core.StatusConditionImpl< T extends Entity<?, ?>, org.opensplice.dds.core.status.LivelinessChangedStatusImpl, org.opensplice.dds.core.status.PublicationMatchedStatusImpl, org.opensplice.dds.core.status.SubscriptionMatchedStatusImpl, org.opensplice.dds.sub.SampleImpl< TYPE >, org.opensplice.dds.core.policy.ShareImpl, org.opensplice.dds.core.status.OfferedDeadlineMissedStatusImpl, org.opensplice.dds.core.status.SampleRejectedStatusImpl, org.opensplice.dds.core.WaitSetImpl, org.opensplice.dds.topic.ParticipantBuiltinTopicDataImpl, org.opensplice.dds.core.status.RequestedDeadlineMissedStatusImpl, org.opensplice.dds.topic.BuiltinTopicKeyImpl, org.opensplice.dds.core.GuardConditionImpl, org.opensplice.dds.core.event.AllDataDisposedEventImpl< TYPE >, org.opensplice.dds.core.policy.QosPolicyCountImpl, org.opensplice.dds.core.status.InconsistentTopicStatusImpl, org.opensplice.dds.core.status.LivelinessLostStatusImpl, org.opensplice.dds.core.status.SampleLostStatusImpl, org.opensplice.dds.core.policy.QosPolicyImpl, org.opensplice.dds.core.status.AllDataDisposedStatusImpl, org.opensplice.dds.core.IllegalArgumentExceptionImpl, org.opensplice.dds.core.InconsistentPolicyExceptionImpl, org.opensplice.dds.core.policy.PolicyFactoryImpl, org.opensplice.dds.core.policy.TypeConsistencyEnforcementImpl, org.opensplice.dds.core.PreconditionNotMetExceptionImpl, org.opensplice.dds.core.AlreadyClosedExceptionImpl, org.opensplice.dds.core.IllegalOperationExceptionImpl, org.opensplice.dds.core.ImmutablePolicyExceptionImpl, org.opensplice.dds.core.NotEnabledExceptionImpl, org.opensplice.dds.core.OutOfResourcesExceptionImpl, org.opensplice.dds.core.DDSExceptionImpl, org.opensplice.dds.core.status.DataAvailableStatusImpl, and org.opensplice.dds.core.status.DataOnReadersStatusImpl.
Set<String> org.opensplice.dds.core.policy.SubscriptionKeys.getKey | ( | ) |
Implemented in org.opensplice.dds.core.policy.SubscriptionKeysImpl.
SubscriptionKeys org.opensplice.dds.core.policy.SubscriptionKeys.withKey | ( | Collection< String > | keyList | ) |
Copy this policy and override the value of the property.
keyList | A collection of strings with one or more names of topic fields acting as alternative keys. |
Implemented in org.opensplice.dds.core.policy.SubscriptionKeysImpl.
SubscriptionKeys org.opensplice.dds.core.policy.SubscriptionKeys.withKey | ( | String | keyList | ) |
Copy this policy and override the value of the property.
keyList | A strings with one name of topic fields acting as alternative key. |
Implemented in org.opensplice.dds.core.policy.SubscriptionKeysImpl.
SubscriptionKeys org.opensplice.dds.core.policy.SubscriptionKeys.withKey | ( | String... | keyList | ) |
Copy this policy and override the value of the property.
keyList | An arbitrary number of strings with one or more names of topic fields acting as alternative keys. |
Implemented in org.opensplice.dds.core.policy.SubscriptionKeysImpl.