Table of Contents

Class AbstractMessageChannel

Namespace
Steeltoe.Messaging.Support
Assembly
Steeltoe.Messaging.MessagingBase.dll
public abstract class AbstractMessageChannel : Channel<IMessage>, IMessageChannel, IServiceNameAware, IInterceptableChannel
Inheritance
AbstractMessageChannel
Implements
Derived
Inherited Members

Constructors

AbstractMessageChannel(ILogger)

public AbstractMessageChannel(ILogger logger = null)

Parameters

logger ILogger

Fields

INDEFINITE_TIMEOUT

public const int INDEFINITE_TIMEOUT = -1

Field Value

int

Properties

Logger

public ILogger Logger { get; set; }

Property Value

ILogger

ServiceName

public virtual string ServiceName { get; set; }

Property Value

string

Methods

AddInterceptor(IChannelInterceptor)

Add an interceptor to the list

public virtual void AddInterceptor(IChannelInterceptor interceptor)

Parameters

interceptor IChannelInterceptor

the interceptor to add

AddInterceptor(int, IChannelInterceptor)

Add an interceptor at the location specified by the index

public virtual void AddInterceptor(int index, IChannelInterceptor interceptor)

Parameters

index int

the index to add the interceptor at

interceptor IChannelInterceptor

the interceptor to add

DoSend(IMessage, int)

protected virtual bool DoSend(IMessage message, int timeout)

Parameters

message IMessage
timeout int

Returns

bool

DoSend(IMessage, CancellationToken)

protected virtual bool DoSend(IMessage message, CancellationToken cancellationToken)

Parameters

message IMessage
cancellationToken CancellationToken

Returns

bool

DoSendInternal(IMessage, CancellationToken)

protected abstract bool DoSendInternal(IMessage message, CancellationToken cancellationToken)

Parameters

message IMessage
cancellationToken CancellationToken

Returns

bool

GetInterceptors()

Get the interceptors for the channel

public virtual List<IChannelInterceptor> GetInterceptors()

Returns

List<IChannelInterceptor>

the list of interceptors

RemoveInterceptor(IChannelInterceptor)

Remove the specified interceptor

public virtual bool RemoveInterceptor(IChannelInterceptor interceptor)

Parameters

interceptor IChannelInterceptor

the interceptor to remove

Returns

bool

true if successful

RemoveInterceptor(int)

Remove the interceptor at the given index.

public virtual IChannelInterceptor RemoveInterceptor(int index)

Parameters

index int

the index to use

Returns

IChannelInterceptor

the interceptor removed

Send(IMessage)

Send a message to this channel. If the message is sent successfuly, the method returns true. If the message cannot be sent due to a non-fatal reason, the method returns false. The method may also throw a Exception in case of non-recoverable errors. This method may block indefinitely, depending on the implementation.

public virtual bool Send(IMessage message)

Parameters

message IMessage

the message to send

Returns

bool

true if the message is sent

Send(IMessage, int)

Send a message, blocking until either the message is accepted or the specified timeout period elapses.

public virtual bool Send(IMessage message, int timeout)

Parameters

message IMessage

the message to send

timeout int

the timeout in milliseconds; -1 for no timeout

Returns

bool

true if the message is sent

SendAsync(IMessage, CancellationToken)

Send a message to this channel.

public virtual ValueTask<bool> SendAsync(IMessage message, CancellationToken cancellationToken = default)

Parameters

message IMessage

the message to send

cancellationToken CancellationToken

token used to signal cancellation

Returns

ValueTask<bool>

a task to signal completion

SetInterceptors(List<IChannelInterceptor>)

Set the list of channel interceptors

public virtual void SetInterceptors(List<IChannelInterceptor> interceptors)

Parameters

interceptors List<IChannelInterceptor>

the interceptors to use

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.