MessageSender MessageSender Class

The MessageSender class is used to send messages from the Service Bus. Although you can use the QueueClient class to send and receive messages without creating a MessageSender object, you can also use MessageSender and MessageReceiver to create a sender and receiver on an entity without knowing whether it is a topic or a queue.

Syntax

Declaration

public abstract class MessageSender : ClientEntity, IMessageClientEntity, ICloseable, IMessageSenderPublic MustInherit Class MessageSender
    Inherits ClientEntity
    Implements IMessageClientEntity, ICloseable, IMessageSender

Inheritance Hierarchy

Inherited Members

, , , , , ,
Abort()
Abort()
,
Abort()
Abort()
,
Close()
Close()
,
Close()
Close()
, , ,
Fault()
Fault()
,
Fault()
Fault()
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Properties summary

Gets the batch flush interval.

Gets a value indicating whether the batching is enabled.

Gets the path of the queue or topic relative to the MessagingFactory base address.

Methods summary

This allows concrete implementations to override (if needed) what should be done to cancel scheduled sends

This allows concrete implementations to override (if needed) what should be done to schedule sends

Executes the begin send action. This method is intended for internal consumption and cannot be implemented in a concrete class by the user.

Executes the begin send event data action. This method is intended for internal consumption and cannot be implemented in a concrete class by the user.

Raises an event when ending the cancellation of the scheduled message.

Raises an event when ending the message schedule.

Executes the end send action. This method is intended for internal consumption and cannot be implemented in a concrete class by the user.

Executes the end send event data action. This method is intended for internal consumption and cannot be implemented in a concrete class by the user.

This allows concrete implementations to override (if needed) what should be done when sending messages in a synchronous manner.

Sends the specified brokered message.

Asynchronously sends the specified brokered message.

Sends a set of brokered messages (for batch processing).

Asynchronously sends a set of brokered messages (for batch processing).

Properties

  • BatchFlushInterval
    BatchFlushInterval

    Gets the batch flush interval.

    public virtual TimeSpan BatchFlushInterval { get; }Public Overridable ReadOnly Property BatchFlushInterval As TimeSpan

    Property Value

    Exceptions

  • BatchingEnabled
    BatchingEnabled

    Gets a value indicating whether the batching is enabled.

    protected bool BatchingEnabled { get; }Protected ReadOnly Property BatchingEnabled As Boolean

    Property Value

  • Path
    Path

    Gets the path of the queue or topic relative to the MessagingFactory base address.

    public abstract string Path { get; }Public MustOverride ReadOnly Property Path As String

    Property Value

  • SupportsGetRuntimeEntityDescription
    SupportsGetRuntimeEntityDescription
    protected abstract bool SupportsGetRuntimeEntityDescription { get; }Protected MustOverride ReadOnly Property SupportsGetRuntimeEntityDescription As Boolean

    Property Value

Methods

  • OnBeginCancelScheduledMessage(TrackingContext, IEnumerable<Int64>, TimeSpan, AsyncCallback, Object)
    OnBeginCancelScheduledMessage(TrackingContext, IEnumerable(Of Int64), TimeSpan, AsyncCallback, Object)

    This allows concrete implementations to override (if needed) what should be done to cancel scheduled sends

    protected abstract IAsyncResult OnBeginCancelScheduledMessage(TrackingContext trackingContext, IEnumerable<long> sequenceNumbers, TimeSpan timeout, AsyncCallback callback, object state)Protected MustOverride Function OnBeginCancelScheduledMessage(trackingContext As TrackingContext, sequenceNumbers As IEnumerable(Of Long), timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

    Parameters

    Returns

  • OnBeginScheduleMessage(TrackingContext, IEnumerable<BrokeredMessage>, TimeSpan, AsyncCallback, Object)
    OnBeginScheduleMessage(TrackingContext, IEnumerable(Of BrokeredMessage), TimeSpan, AsyncCallback, Object)

    This allows concrete implementations to override (if needed) what should be done to schedule sends

    protected abstract IAsyncResult OnBeginScheduleMessage(TrackingContext trackingContext, IEnumerable<BrokeredMessage> messages, TimeSpan timeout, AsyncCallback callback, object state)Protected MustOverride Function OnBeginScheduleMessage(trackingContext As TrackingContext, messages As IEnumerable(Of BrokeredMessage), timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

    Parameters

    Returns

  • OnBeginSend(TrackingContext, IEnumerable<BrokeredMessage>, Boolean, TimeSpan, AsyncCallback, Object)
    OnBeginSend(TrackingContext, IEnumerable(Of BrokeredMessage), Boolean, TimeSpan, AsyncCallback, Object)

    Executes the begin send action. This method is intended for internal consumption and cannot be implemented in a concrete class by the user.

    protected abstract IAsyncResult OnBeginSend(TrackingContext trackingContext, IEnumerable<BrokeredMessage> messages, bool fromSync, TimeSpan timeout, AsyncCallback callback, object state)Protected MustOverride Function OnBeginSend(trackingContext As TrackingContext, messages As IEnumerable(Of BrokeredMessage), fromSync As Boolean, timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

    Parameters

    Returns

  • OnBeginSendEventData(TrackingContext, IEnumerable<EventData>, TimeSpan, AsyncCallback, Object)
    OnBeginSendEventData(TrackingContext, IEnumerable(Of EventData), TimeSpan, AsyncCallback, Object)

    Executes the begin send event data action. This method is intended for internal consumption and cannot be implemented in a concrete class by the user.

    protected abstract IAsyncResult OnBeginSendEventData(TrackingContext trackingContext, IEnumerable<EventData> eventDatas, TimeSpan timeout, AsyncCallback callback, object state)Protected MustOverride Function OnBeginSendEventData(trackingContext As TrackingContext, eventDatas As IEnumerable(Of EventData), timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

    Parameters

    Returns

  • OnEndCancelScheduledMessage(IAsyncResult)
    OnEndCancelScheduledMessage(IAsyncResult)

    Raises an event when ending the cancellation of the scheduled message.

    protected abstract void OnEndCancelScheduledMessage(IAsyncResult result)Protected MustOverride Sub OnEndCancelScheduledMessage(result As IAsyncResult)

    Parameters

  • OnEndScheduleMessage(IAsyncResult)
    OnEndScheduleMessage(IAsyncResult)

    Raises an event when ending the message schedule.

    protected abstract IEnumerable<long> OnEndScheduleMessage(IAsyncResult result)Protected MustOverride Function OnEndScheduleMessage(result As IAsyncResult) As IEnumerable(Of Long)

    Parameters

    Returns

  • OnEndSend(IAsyncResult)
    OnEndSend(IAsyncResult)

    Executes the end send action. This method is intended for internal consumption and cannot be implemented in a concrete class by the user.

    protected abstract void OnEndSend(IAsyncResult result)Protected MustOverride Sub OnEndSend(result As IAsyncResult)

    Parameters

  • OnEndSendEventData(IAsyncResult)
    OnEndSendEventData(IAsyncResult)

    Executes the end send event data action. This method is intended for internal consumption and cannot be implemented in a concrete class by the user.

    protected abstract void OnEndSendEventData(IAsyncResult result)Protected MustOverride Sub OnEndSendEventData(result As IAsyncResult)

    Parameters

  • OnSend(TrackingContext, IEnumerable<BrokeredMessage>, TimeSpan)
    OnSend(TrackingContext, IEnumerable(Of BrokeredMessage), TimeSpan)

    This allows concrete implementations to override (if needed) what should be done when sending messages in a synchronous manner.

    protected virtual void OnSend(TrackingContext trackingContext, IEnumerable<BrokeredMessage> messages, TimeSpan timeout)Protected Overridable Sub OnSend(trackingContext As TrackingContext, messages As IEnumerable(Of BrokeredMessage), timeout As TimeSpan)

    Parameters

    Remarks

    Typically the timeout comes from OperationTimeout.

    OnSend is equal to this.OnEndSend(this.OnBeginSend(messages, timeout, null, null));.

  • Send(BrokeredMessage)
    Send(BrokeredMessage)

    Sends the specified brokered message.

    public void Send(BrokeredMessage message)Public Sub Send(message As BrokeredMessage)

    Parameters

    Exceptions

  • SendAsync(BrokeredMessage)
    SendAsync(BrokeredMessage)

    Asynchronously sends the specified brokered message.

    public Task SendAsync(BrokeredMessage message)Public Function SendAsync(message As BrokeredMessage) As Task

    Parameters

    Returns

    • The asynchronous result of the operation.

  • SendBatch(IEnumerable<BrokeredMessage>)
    SendBatch(IEnumerable(Of BrokeredMessage))

    Sends a set of brokered messages (for batch processing).

    public void SendBatch(IEnumerable<BrokeredMessage> messages)Public Sub SendBatch(messages As IEnumerable(Of BrokeredMessage))

    Parameters

  • SendBatchAsync(IEnumerable<BrokeredMessage>)
    SendBatchAsync(IEnumerable(Of BrokeredMessage))

    Asynchronously sends a set of brokered messages (for batch processing).

    public Task SendBatchAsync(IEnumerable<BrokeredMessage> messages)Public Function SendBatchAsync(messages As IEnumerable(Of BrokeredMessage)) As Task

    Parameters

    Returns

    • The asynchronous result of the operation.

Details

Assembly

Microsoft.ServiceBus.dll