Skip to content

TPortFactoryPublisher<TPayload, TUserHeader>

Factory to create a new Publisher port/endpoint for TMessagingPattern.PublishSubscribe based communication.

Definition

Unit: Neslib.Iceoryx2.PublishSubscribe

type TPortFactoryPublisher<TPayload, TUserHeader> = record ... end;

Type Parameters

TPayload:

TUserHeader:

Methods

Name Description
AllocationStrategy Defines the allocation strategy that is used when the provided TPortFactoryPublisher.InitialMaxSliceLen is exhausted. This happens when the user acquires a more than max slice len in TPublisher.LoanSlice or TPublisher.LoanSliceUninit.
BackpressureStrategy Sets the BackpressureStrategy.
Create Creates a new TPublisher or returns a TPublisherCreateError`on failure.
InitialMaxSliceLen Sets the maximum slice length that a user can allocate with TPublisher.LoanSlice or TPublisher.LoanSliceUninit.
MaxLoanedSamples Defines how many SampleMut's the publisher can loan with TPublisher.Loan or TPublisher.LoanUninit in parallel.
Name The TPortName that shall be assigned to the publisher. It does not have to be unique. If no PortName is defined then the publisher does not have a name.
OverrideSamplePreallocation Defines a callback to reduce the number of preallocated TSampleMut's. The input argument is the worst case number of preallocated TSampleMut's required to guarantee that the TPublisher never runs out of TSampleMut's to loan and send. The return value is clamped between 1 and the worst case number of preallocated TSampleMut's.
SetBackpressureHandler Sets the TBackpressureHandler of the publisher. Whenever a TSampleMut cannot be sent to a subscriber, this handler is called and depending on the returned TBackpressureAction, measures will be taken.
SetDegradationHandler Sets the TDegradationHandler of the TPublisher. Whenever a connection to a TSubscriber is corrupted, this handler is called and depending on the returned TDegradationAction measures will be taken.

Method Descriptions

AllocationStrategy(TAllocationStrategy)

Defines the allocation strategy that is used when the provided TPortFactoryPublisher.InitialMaxSliceLen is exhausted. This happens when the user acquires a more than max slice len in TPublisher.LoanSlice or TPublisher.LoanSliceUninit.

function AllocationStrategy(const AValue: TAllocationStrategy): TPortFactoryPublisher<TPayload, TUserHeader>; inline

Parameters

AValue: TAllocationStrategy

Returns

TPortFactoryPublisher<TPayload, TUserHeader>

Remarks

Can only be used when TPayload is a slice (TSlice). This is checked with an assertion.


BackpressureStrategy(TBackpressureStrategy)

Sets the BackpressureStrategy.

function BackpressureStrategy(const AValue: TBackpressureStrategy): TPortFactoryPublisher<TPayload, TUserHeader>; inline

Parameters

AValue: TBackpressureStrategy

Returns

TPortFactoryPublisher<TPayload, TUserHeader>


Create

Creates a new TPublisher or returns a TPublisherCreateError`on failure.

function Create: TResult<TPublisher<TPayload>, TPublisherCreateError>

Returns

TResult<TPublisher<TPayload>, TPublisherCreateError>


InitialMaxSliceLen(UInt64)

Sets the maximum slice length that a user can allocate with TPublisher.LoanSlice or TPublisher.LoanSliceUninit.

function InitialMaxSliceLen(const AValue: UInt64): TPortFactoryPublisher<TPayload, TUserHeader>; inline

Parameters

AValue: UInt64

Returns

TPortFactoryPublisher<TPayload, TUserHeader>

Remarks

Can only be used when TPayload is a slice (TSlice). This is checked with an assertion.


MaxLoanedSamples(UInt64)

Defines how many SampleMut's the publisher can loan with TPublisher.Loan or TPublisher.LoanUninit in parallel.

function MaxLoanedSamples(const AValue: UInt64): TPortFactoryPublisher<TPayload, TUserHeader>; inline

Parameters

AValue: UInt64

Returns

TPortFactoryPublisher<TPayload, TUserHeader>


Name(TPortName)

The TPortName that shall be assigned to the publisher. It does not have to be unique. If no PortName is defined then the publisher does not have a name.

function Name(const AValue: TPortName): TPortFactoryPublisher<TPayload, TUserHeader>; inline

Parameters

AValue: TPortName

Returns

TPortFactoryPublisher<TPayload, TUserHeader>


OverrideSamplePreallocation(TOverridePreallocationCallback)

Defines a callback to reduce the number of preallocated TSampleMut's. The input argument is the worst case number of preallocated TSampleMut's required to guarantee that the TPublisher never runs out of TSampleMut's to loan and send. The return value is clamped between 1 and the worst case number of preallocated TSampleMut's.

function OverrideSamplePreallocation(const AValue: TOverridePreallocationCallback): TPortFactoryPublisher<TPayload, TUserHeader>; inline

Parameters

AValue: TOverridePreallocationCallback

Returns

TPortFactoryPublisher<TPayload, TUserHeader>

Remarks

IMPORTANT: If the user reduces the number of preallocated TSampleMut's, iceoryx2 can no longer guarantee, that the TPublisher can always loan a TSampleMut to send.


SetBackpressureHandler(TBackpressureHandler)

Sets the TBackpressureHandler of the publisher. Whenever a TSampleMut cannot be sent to a subscriber, this handler is called and depending on the returned TBackpressureAction, measures will be taken.

If no handler is set, the measures will be determined by the value set in TBackpressureStrategy.

function SetBackpressureHandler(const AHandler: TBackpressureHandler): TPortFactoryPublisher<TPayload, TUserHeader>; inline

Parameters

AHandler: TBackpressureHandler

Returns

TPortFactoryPublisher<TPayload, TUserHeader>

Remarks

The handler function needs to live as long as the generated publisher. If the pPublisher, including the send function, is accessed from multiple threads, the handler must be thread-safe if it captures data


SetDegradationHandler(TDegradationHandler)

Sets the TDegradationHandler of the TPublisher. Whenever a connection to a TSubscriber is corrupted, this handler is called and depending on the returned TDegradationAction measures will be taken.

function SetDegradationHandler(const AValue: TDegradationHandler): TPortFactoryPublisher<TPayload, TUserHeader>; inline

Parameters

AValue: TDegradationHandler

Returns

TPortFactoryPublisher<TPayload, TUserHeader>

Remarks

The handler function needs to live as long as the generated publisher. If the TPublisher, including the send function, is accessed from multiple threads, the handler must be thread-safe if it captures data