Class AbstractMessageChannel
- Namespace
- Steeltoe.Integration.Channel
- Assembly
- Steeltoe.Integration.IntegrationBase.dll
public abstract class AbstractMessageChannel : Channel<IMessage>, IMessageChannel, IServiceNameAware, IChannelInterceptorAware
- Inheritance
-
AbstractMessageChannel
- Implements
- Derived
- Inherited Members
Constructors
AbstractMessageChannel(IApplicationContext, ILogger)
protected AbstractMessageChannel(IApplicationContext context, ILogger logger = null)
Parameters
context
IApplicationContextlogger
ILogger
AbstractMessageChannel(IApplicationContext, string, ILogger)
protected AbstractMessageChannel(IApplicationContext context, string name, ILogger logger = null)
Parameters
context
IApplicationContextname
stringlogger
ILogger
Fields
INDEFINITE_TIMEOUT
protected const int INDEFINITE_TIMEOUT = -1
Field Value
logger
protected ILogger logger
Field Value
Properties
ApplicationContext
public IApplicationContext ApplicationContext { get; }
Property Value
ChannelInterceptors
Gets or sets the channel interceptors
public virtual List<IChannelInterceptor> ChannelInterceptors { get; set; }
Property Value
ComponentName
public virtual string ComponentName { get; set; }
Property Value
ComponentType
public virtual string ComponentType { get; }
Property Value
DataTypes
public virtual List<Type> DataTypes { get; set; }
Property Value
IntegrationServices
public IIntegrationServices IntegrationServices { get; }
Property Value
MessageConverter
public virtual IMessageConverter MessageConverter { get; set; }
Property Value
ServiceName
public virtual string ServiceName { get; set; }
Property Value
Methods
AddInterceptor(IChannelInterceptor)
Add a interceptor to the channel
public virtual void AddInterceptor(IChannelInterceptor interceptor)
Parameters
interceptor
IChannelInterceptorthe interceptor
AddInterceptor(int, IChannelInterceptor)
Add an interceptor to the channel at the specified index
public virtual void AddInterceptor(int index, IChannelInterceptor interceptor)
Parameters
index
intthe index to add the interceptor at
interceptor
IChannelInterceptorthe interceptor
DoSend(IMessage, int)
protected virtual bool DoSend(IMessage message, int timeout)
Parameters
Returns
DoSend(IMessage, CancellationToken)
protected bool DoSend(IMessage message, CancellationToken cancellationToken)
Parameters
message
IMessagecancellationToken
CancellationToken
Returns
DoSendInternal(IMessage, CancellationToken)
protected abstract bool DoSendInternal(IMessage message, CancellationToken cancellationToken)
Parameters
message
IMessagecancellationToken
CancellationToken
Returns
RemoveInterceptor(IChannelInterceptor)
Remove an intercetptor from the channel
public virtual bool RemoveInterceptor(IChannelInterceptor interceptor)
Parameters
interceptor
IChannelInterceptorthe interceptor
Returns
- bool
succss or failure
RemoveInterceptor(int)
Remove an interceptor at the specified index
public virtual IChannelInterceptor RemoveInterceptor(int index)
Parameters
index
intthe index
Returns
- IChannelInterceptor
removed interceptor
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
IMessagethe 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
Returns
- bool
true if the message is sent
SendAsync(IMessage, CancellationToken)
Send a message to this channel.
public ValueTask<bool> SendAsync(IMessage message, CancellationToken cancellationToken = default)
Parameters
message
IMessagethe message to send
cancellationToken
CancellationTokentoken used to signal cancellation