Skip to content

PollEndpointLocator Class

Where this transmitter serves a stream's poll queue - the "endpoint_url value is supplied by the Transmitter" of SSF 1.0 Section 8.1.1.1, and therefore the one thing a stream cannot be created with poll delivery without.

C#
public sealed class PollEndpointLocator

Inheritance System.Object → PollEndpointLocator

Remarks

The address has two possible sources and they answer different questions.

  • ServedAt(Func<string,Uri>) is the address the endpoint was mapped on, declared by whatever mapped it. That is the only code that knows: the route and its prefix belong to the web framework adapter, and a host may move either. A proxy that rewrites paths is covered here too, because what the mapping declares is the ADVERTISED prefix rather than the internal one.
  • PollEndpointFactory is the address a host names itself, for a deployment the mapped one cannot describe - a separate delivery host, or a host that maps no routes through this framework at all. It wins.

Neither could be a default computed here. A guess assembled from the issuer alone would be right only while the prefix is the untouched default and silently wrong afterwards - a transmitter minting and STORING an address that answers 404, which a receiver meets long after the create it belongs to succeeded.

A transmitter with neither source offers no poll delivery: the configuration document omits the method and a create asking for it is refused, which is the honest answer when there is no address to hand out.

Constructors

PollEndpointLocator(SharedSignalsTransmitterOptions) Constructor

Where this transmitter serves a stream's poll queue - the "endpoint_url value is supplied by the Transmitter" of SSF 1.0 Section 8.1.1.1, and therefore the one thing a stream cannot be created with poll delivery without.

C#
public PollEndpointLocator(Abblix.SharedSignals.Transmitter.SharedSignalsTransmitterOptions options);

Parameters

options SharedSignalsTransmitterOptions

The deployment's one-time decisions, holding the host's own address if it named one.

Remarks

The address has two possible sources and they answer different questions.

  • ServedAt(Func<string,Uri>) is the address the endpoint was mapped on, declared by whatever mapped it. That is the only code that knows: the route and its prefix belong to the web framework adapter, and a host may move either. A proxy that rewrites paths is covered here too, because what the mapping declares is the ADVERTISED prefix rather than the internal one.
  • PollEndpointFactory is the address a host names itself, for a deployment the mapped one cannot describe - a separate delivery host, or a host that maps no routes through this framework at all. It wins.

Neither could be a default computed here. A guess assembled from the issuer alone would be right only while the prefix is the untouched default and silently wrong afterwards - a transmitter minting and STORING an address that answers 404, which a receiver meets long after the create it belongs to succeeded.

A transmitter with neither source offers no poll delivery: the configuration document omits the method and a create asking for it is refused, which is the honest answer when there is no address to hand out.

Properties

PollEndpointLocator.IsOffered Property

Whether this transmitter offers poll delivery at all - what "delivery_methods_supported" advertises (SSF 1.0 Section 7.1) and what a create naming poll is judged against.

C#
public bool IsOffered { get; }

Property Value

System.Boolean

Methods

PollEndpointLocator.Of(string) Method

The poll endpoint of a stream, or null when there is none for it.

C#
public System.Uri? Of(string streamId);

Parameters

streamId System.String

The stream whose queue is served there.

Returns

System.Uri

Remarks

Null has TWO causes and a caller that can act on them differently should ask IsOffered which it is: this transmitter serves no poll delivery at all, or it does and this stream still has no address - an identifier the route cannot carry, for one. Reading null as the first cause alone makes the branch written for the second look unreachable, which is why the summary above names neither.

PollEndpointLocator.ServedAt(Func<string,Uri>) Method

Declares where the poll endpoint is mapped, so a stream created without the host naming an address gets one that leads back to the route serving it.

C#
public void ServedAt(System.Func<string,System.Uri?> pollEndpointOf);

Parameters

pollEndpointOf System.Func<System.String,System.Uri>

Derives the mapped address of a stream's poll endpoint, or answers null when this stream has none - an identifier the route cannot carry, for one. A null is a refusal a caller can act on: a create or update asking for poll delivery is answered with an error, and a declared stream is refused at startup by ConfigurationStreamStore.

Exceptions

System.InvalidOperationException
The endpoint was already mapped. A stream's poll address is stored in its configuration, so a second mapping would leave every stream created before it pointing at the first - and which streams those are depends on when each call ran.

Remarks

Called by the code that maps the route, which happens once at startup and before any stream can be created. It is not the host's call to make: a host naming its own address uses PollEndpointFactory, which this never overrides.