Class EndpointBuilder<TEndpoint, TBuilder>
The base class for the builders of the types inheriting from Endpoint.
Inheritance
Implements
Inherited Members
Namespace: Silverback.Messaging.Configuration
Assembly: Silverback.Integration.dll
Syntax
public abstract class EndpointBuilder<TEndpoint, TBuilder> : IEndpointBuilder<TBuilder> where TEndpoint : Endpoint where TBuilder : IEndpointBuilder<TBuilder>
Type Parameters
Name | Description |
---|---|
TEndpoint | The type of the endpoint being built. |
TBuilder | The actual builder type. |
Constructors
| Improve this doc View sourceEndpointBuilder(Type?, IEndpointsConfigurationBuilder?)
Initializes a new instance of the EndpointBuilder<TEndpoint, TBuilder> class.
Declaration
protected EndpointBuilder(Type? messageType, IEndpointsConfigurationBuilder? endpointsConfigurationBuilder = null)
Parameters
Type | Name | Description |
---|---|---|
Type | messageType | The type of the message being produced or consumed. |
IEndpointsConfigurationBuilder | endpointsConfigurationBuilder | The optional reference to the IEndpointsConfigurationBuilder that instantiated the builder. |
Properties
| Improve this doc View sourceEndpointsConfigurationBuilder
Gets the IEndpointsConfigurationBuilder that instantiated the builder.
Declaration
public IEndpointsConfigurationBuilder? EndpointsConfigurationBuilder { get; }
Property Value
Type | Description |
---|---|
IEndpointsConfigurationBuilder |
MessageType
Gets the type of the message being produced or consumed.
Declaration
public Type? MessageType { get; }
Property Value
Type | Description |
---|---|
Type |
Remarks
This value might be used during the configuration to automatically determine some configurations (e.g. the correct serializer to be used) without having to specify the message type once again.
This
Gets this instance.
Declaration
protected abstract TBuilder This { get; }
Property Value
Type | Description |
---|---|
TBuilder |
Remarks
This is necessary to work around casting in the base classes.
Methods
| Improve this doc View sourceBuild()
Builds the endpoint instance.
Declaration
public virtual TEndpoint Build()
Returns
Type | Description |
---|---|
TEndpoint | The endpoint. |
CreateEndpoint()
Creates the endpoint to be configured according to the options stored in the builder.
Declaration
protected abstract TEndpoint CreateEndpoint()
Returns
Type | Description |
---|---|
TEndpoint | The endpoint. |
DisableMessageValidation()
Disables the message validation.
Declaration
public TBuilder DisableMessageValidation()
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
UseSerializer(IMessageSerializer)
Specifies the IMessageSerializer to be used serialize or deserialize the messages.
Declaration
public TBuilder UseSerializer(IMessageSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
IMessageSerializer | serializer | The IMessageSerializer. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
ValidateMessage(bool)
Enables the message validation.
Declaration
public TBuilder ValidateMessage(bool throwException)
Parameters
Type | Name | Description |
---|---|---|
bool | throwException | A value that specifies whether an exception should be thrown if the message is invalid. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
WithEncryption(EncryptionSettings?)
Enables the end-to-end message encryption.
Declaration
public TBuilder WithEncryption(EncryptionSettings? encryptionSettings)
Parameters
Type | Name | Description |
---|---|---|
EncryptionSettings | encryptionSettings | The EncryptionSettings. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
WithName(string)
Specifies an optional friendly name to be used to identify the endpoint. This name can be used to filter or retrieve the endpoints and will also be included in the DisplayName, to be shown in the human-targeted output (e.g. logs, health checks result, etc.).
Declaration
public TBuilder WithName(string friendlyName)
Parameters
Type | Name | Description |
---|---|---|
string | friendlyName | The friendly name. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |