The
LIVELINESS
policy controls when and how the service determines whether participants
are alive, meaning they are still reachable and active. The kind member setting indicates
whether liveliness is asserted automatically by the service or manually by the specified
entity. A setting of
AUTOMATIC_LIVELINESS_QOS
means that the service will send a liveliness
indication if the participant has not sent any network traffic for the lease_duration. The
MANUAL_BY_PARTICIPANT_LIVELINESS_QOS
or
MANUAL_BY_TOPIC_LIVELINESS_QOS
setting
means the specified entity (data writer for the “by topic” setting or domain participant for
the “by participant” setting) must either write a sample or manually assert its liveliness
within a specified heartbeat interval. The desired heartbeat interval is specified by the
lease_duration member. The default lease duration is a pre-defined infinite value, which
disables any liveliness testing.
LIVELINESS策略控制服务何时以及如何确定参与者是否还活着,这意味着他们仍然可以访问并且处于活动状态。 kind成员设置指示是由服务自动断言还是由指定实体手动断言活泼性。 设置为AUTOMATIC_LIVELINESS_QOS意味着,如果参与者没有为lease_duration发送任何网络流量,则该服务将发送活动指示。 MANUAL_BY_PARTICIPANT_LIVELINESS_QOS或MANUAL_BY_TOPIC_LIVELINESS_QOS设置意味着指定的实体(“按主题”设置的数据编写者或“按参与者”设置的域参与者)必须编写样本或在指定的心跳间隔内手动声明其活动性。 所需的心跳间隔由lease_duration成员指定。 默认的租约期限是一个预定义的无限值,它会禁用任何生动性测试。
To manually assert liveliness without publishing a sample, the application must call the
assert_liveliness()
operation on the data writer (for the “by topic” setting) or on the
domain participant (for the “by participant” setting) within the specified heartbeat interval.
若要在不发布示例的情况下手动声明活动级别,则应用程序必须在指定的心跳间隔内对数据编写器(针对“按主题”设置)或域参与者(针对“按参与者”设置)调用assert_liveliness()操作 。
Data writers specify (
offer
) their own liveliness criteria and data readers specify (
request
)
the desired liveliness of their writers. Writers that are not heard from within the lease
duration (either by writing a sample or by asserting liveliness) cause a change in the
LIVELINESS_CHANGED_STATUS
communication status and notification to the application (e.g.,
by calling the data reader listener’s
on_liveliness_changed()
callback operation or by
signaling any related wait sets).
数据编写者指定(提供)自己的活动性标准,数据编写者指定(请求)其编写者所需的活动性。 在租用期限内未听到的写入者(通过编写示例或通过声明生动性)导致LIVELINESS_CHANGED_STATUS通信状态发生变化并通知应用程序(例如,通过调用数据读取器侦听器的on_liveliness_changed()回调操作或通过 用信号通知任何相关的等待集)。
This policy is considered during the establishment of associations between data writers and
data readers. The value of both sides of the association must be compatible in order for an
association to be established. Compatibility is determined by comparing the data reader’s requested liveliness with the data writer’s offered liveliness. Both the kind of liveliness
(automatic, manual by topic, manual by participant) and the value of the lease duration are
considered in determining compatibility. The writer’s offered kind of liveliness must be
greater than or equal to the reader’s requested kind of liveliness. The liveliness kind values
are ordered as follows:
在数据写入者和数据读取者之间建立关联时会考虑此策略。 关联双方的值必须兼容才能建立关联。 兼容性是通过将数据读取器要求的实时性与数据写入器提供的实时性进行比较来确定的。 确定兼容性时,要考虑活泼的类型(自动,按主题手动,按参与者手动)和租用期限的值。 作者提供的生动性必须大于或等于读者要求的生动性。 活度种类值的排序如下:
MANUAL_BY_TOPIC_LIVELINESS_QOS >
MANUAL_BY_PARTICIPANT_LIVELINESS_QOS >
AUTOMATIC_LIVELINESS_QOS
In addition, the writer’s offered lease duration must be less than or equal to the reader’s
requested lease duration. Both of these conditions must be met for the offered and
requested liveliness policy settings to be considered compatible and the association
established.
此外,作者提供的租约期限必须小于或等于读者请求的租约期限。 必须同时满足这两个条件,才能将所提供和请求的活动策略设置视为兼容并建立关联。
Data Distribution Service Version 1.4( formal/2015-04-10)
This policy controls the mechanism and parameters used by the Service to ensure that particular entities on the network are
still “alive.” The liveliness can also affect the ownership of a particular instance, as determined by the OWNERSHIP QoS
policy.
此策略控制服务使用的机制和参数,以确保网络上的特定实体仍然“处于活动状态”。 活泼性还可能影响特定实例的所有权,如OWNERSHIP QoS策略所确定。
This policy has several settings to support both data-objects that are updated periodically as well as those that are changed
sporadically. It also allows customizing for different application requirements in terms of the kinds of failures that will be
detected by the liveliness mechanism.
此策略具有多种设置,以支持定期更新的数据对象和偶尔更改的数据对象。 它还可以根据活动机制检测到的故障种类,针对不同的应用程序需求进行定制。
The AUTOMATIC liveliness setting is most appropriate for applications that only need to detect failures at the process-
level
, but not application-logic failures within a process. The Service takes responsibility for renewing the leases at the
required rates and thus, as long as the local process where a
DomainParticipant
is running and the link connecting it to remote
participants remains connected, the entities within the
DomainParticipant
will be considered alive. This requires the lowest
overhead.
AUTOMATIC liveliness设置最适合只需要在流程级别检测故障,而无需检测流程中的应用程序逻辑故障的应用程序。 该服务负责按要求的费率续订租约,因此,只要运行DomainParticipant的本地进程以及将其连接到远程参与者的链接保持连接状态,DomainParticipant中的实体都将处于活动状态。 这需要最低的开销。
The MANUAL settings (MANUAL_BY_PARTICIPANT, MANUAL_BY_TOPIC), require the application on the publishing
side to periodically assert the liveliness before the lease expires to indicate the corresponding
Entity
is still alive. The action
can be explicit by calling the
assert_liveliness
operations, or implicit by writing some data.
MANUAL设置(MANUAL_BY_PARTICIPANT,MANUAL_BY_TOPIC)要求发布方的应用程序在租约到期之前定期断言活动性,以指示相应的实体仍然有效。 该操作可以通过调用assert_liveliness操作来显式,也可以通过写入一些数据来隐式。
The two possible manual settings control the granularity at which the application must assert liveliness.
两种可能的手动设置控制应用程序必须断言生动性的粒度。
•
The setting MANUAL_BY_PARTICIPANT requires only that one
Entity
within the publisher is asserted to be alive to
deduce all other
Entity
objects within the same
DomainParticipant
are also alive.
•设置MANUAL_BY_PARTICIPANT仅要求声明发布者中的一个实体是活动的,才能推断出同一DomainParticipant中的所有其他实体对象也是活动的。
•
The setting MANUAL_BY_TOPIC requires that at least one instance within the
DataWriter
is asserted.
•设置MANUAL_BY_TOPIC要求在DataWriter中至少声明一个实例。
The value offered is considered compatible with the value requested if and only if the following conditions are met:
当且仅当满足以下条件时,才认为提供的值与请求的值兼容:
1) the inequality “offered
kind
>= requested
kind
” evaluates to ‘TRUE’. For the purposes of this inequality, the values
of LIVELINESS
kind
are considered ordered such that:
1)不等式“提供的种类> =请求的种类”计算为“ TRUE”。 出于这种不平等的目的,LIVELINESS类型的值被认为是有序的:
AUTOMATIC < MANUAL_BY_PARTICIPANT < MANUAL_BY_TOPIC.
2) the inequality “offered
lease_duration
<= requested
lease_duration
” evaluates to TRUE.
2)不等式“提供的lease_duration <=请求的lease_duration”的值为TRUE。
Changes in LIVELINESS must be detected by the Service with a time-granularity greater or equal to the
lease_duration
. This
ensures that the value of the
LivelinessChangedStatus
is updated at least once during each
lease_duration
and the related
Listeners and
WaitSets
are notified within a
lease_duration
from the time the LIVELINESS changed.
服务必须以大于或等于lease_duration的时间粒度来检测LIVELINESS的更改。 这样可以确保在每个lease_duration期间至少将LivelinessChangedStatus的值更新一次,并在LIVELINESS更改之时在lease_duration内通知相关的侦听器和WaitSet。