MessageSender MessageSender MessageSender Class

Definition

The MessageSender class is used to send messages from the Service Bus.

public abstract class MessageSender : Microsoft.ServiceBus.Messaging.ClientEntity
type MessageSender = class
    inherit ClientEntity
    interface IMessageSender
Public MustInherit Class MessageSender
Inherits ClientEntity
Inheritance
MessageSenderMessageSenderMessageSender

Remarks

that message delivery mechanism does not provide by default all time reliable message receiving. Service Bus deletes the message once it goes out of the system. For a guaranteed delivery, you can use the PeekLock delivery mode.


 //********************************************************************************
 //                             Sending messages to a Queue
 //********************************************************************************

// Create a sender MessageSender myMessageSender = myQueueClient.CreateSender(SendMode.Default);

// Send messages List Issues = new List(); foreach (var issue in Issues) { myMessageSender.Send(new BrokeredMessage(issue)); }


 //********************************************************************************
 //                           Recieving messages from a Queue
 //********************************************************************************

// Create a receiver MessageReceiver myMessageReceiver = myQueueClient.CreateReceiver(ReceiveMode.PeekLock);

// Receive messages for (int count = 0; count < Issues.Count; count++) { var message = myMessageReceiver.Receive(); message.Complete(); }

Properties

BatchFlushInterval BatchFlushInterval BatchFlushInterval

Gets the batch flush interval.

BatchingEnabled BatchingEnabled BatchingEnabled

Gets a value indicating whether the batching is enabled.

IsClosed IsClosed IsClosed Inherited from ClientEntity
Path Path Path

h of the queue or topic relative to the MessagingFactory base address.

RetryPolicy RetryPolicy RetryPolicy Inherited from ClientEntity
SupportsGetRuntimeEntityDescription SupportsGetRuntimeEntityDescription SupportsGetRuntimeEntityDescription
ThisLock ThisLock ThisLock Inherited from ClientEntity

Methods

Abort() Abort() Abort() Inherited from ClientEntity
Close() Close() Close() Inherited from ClientEntity
CloseAsync() CloseAsync() CloseAsync() Inherited from ClientEntity
Fault() Fault() Fault() Inherited from ClientEntity
OnAbort() OnAbort() OnAbort() Inherited from ClientEntity
OnBeginCancelScheduledMessage(TrackingContext, IEnumerable<Int64>, TimeSpan, AsyncCallback, Object) OnBeginCancelScheduledMessage(TrackingContext, IEnumerable<Int64>, TimeSpan, AsyncCallback, Object) OnBeginCancelScheduledMessage(TrackingContext, IEnumerable<Int64>, TimeSpan, AsyncCallback, Object)

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

OnBeginClose(TimeSpan, AsyncCallback, Object) OnBeginClose(TimeSpan, AsyncCallback, Object) OnBeginClose(TimeSpan, AsyncCallback, Object) Inherited from ClientEntity
OnBeginOpen(TimeSpan, AsyncCallback, Object) OnBeginOpen(TimeSpan, AsyncCallback, Object) OnBeginOpen(TimeSpan, AsyncCallback, Object) Inherited from ClientEntity
OnBeginScheduleMessage(TrackingContext, IEnumerable<BrokeredMessage>, TimeSpan, AsyncCallback, Object) OnBeginScheduleMessage(TrackingContext, IEnumerable<BrokeredMessage>, TimeSpan, AsyncCallback, Object) OnBeginScheduleMessage(TrackingContext, IEnumerable<BrokeredMessage>, TimeSpan, AsyncCallback, Object)

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

OnBeginSend(TrackingContext, IEnumerable<BrokeredMessage>, Boolean, TimeSpan, AsyncCallback, Object) OnBeginSend(TrackingContext, IEnumerable<BrokeredMessage>, Boolean, TimeSpan, AsyncCallback, Object) OnBeginSend(TrackingContext, IEnumerable<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.

OnBeginSendEventData(TrackingContext, IEnumerable<EventData>, TimeSpan, AsyncCallback, Object) OnBeginSendEventData(TrackingContext, IEnumerable<EventData>, TimeSpan, AsyncCallback, Object) OnBeginSendEventData(TrackingContext, IEnumerable<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.

OnClose(TimeSpan) OnClose(TimeSpan) OnClose(TimeSpan) Inherited from ClientEntity
OnClosed() OnClosed() OnClosed() Inherited from ClientEntity
OnEndCancelScheduledMessage(IAsyncResult) OnEndCancelScheduledMessage(IAsyncResult) OnEndCancelScheduledMessage(IAsyncResult)

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

OnEndClose(IAsyncResult) OnEndClose(IAsyncResult) OnEndClose(IAsyncResult) Inherited from ClientEntity
OnEndOpen(IAsyncResult) OnEndOpen(IAsyncResult) OnEndOpen(IAsyncResult) Inherited from ClientEntity
OnEndScheduleMessage(IAsyncResult) OnEndScheduleMessage(IAsyncResult) OnEndScheduleMessage(IAsyncResult)

Raises an event when ending the message schedule.

OnEndSend(IAsyncResult) 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.

OnEndSendEventData(IAsyncResult) 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.

OnFaulted() OnFaulted() OnFaulted() Inherited from ClientEntity
OnOpen(TimeSpan) OnOpen(TimeSpan) OnOpen(TimeSpan) Inherited from ClientEntity
OnOpened() OnOpened() OnOpened() Inherited from ClientEntity
OnSend(TrackingContext, IEnumerable<BrokeredMessage>, TimeSpan) OnSend(TrackingContext, IEnumerable<BrokeredMessage>, TimeSpan) OnSend(TrackingContext, IEnumerable<BrokeredMessage>, TimeSpan)

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

Send(BrokeredMessage) Send(BrokeredMessage) Send(BrokeredMessage)

Sends the specified brokered message.

SendAsync(BrokeredMessage) SendAsync(BrokeredMessage) SendAsync(BrokeredMessage)

Asynchronously sends the specified brokered message.

SendBatch(IEnumerable<BrokeredMessage>) SendBatch(IEnumerable<BrokeredMessage>) SendBatch(IEnumerable<BrokeredMessage>)

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

SendBatchAsync(IEnumerable<BrokeredMessage>) SendBatchAsync(IEnumerable<BrokeredMessage>) SendBatchAsync(IEnumerable<BrokeredMessage>)

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

ThrowIfClosed() ThrowIfClosed() ThrowIfClosed() Inherited from ClientEntity
ThrowIfDisposed() ThrowIfDisposed() ThrowIfDisposed() Inherited from ClientEntity
ThrowIfDisposedOrImmutable() ThrowIfDisposedOrImmutable() ThrowIfDisposedOrImmutable() Inherited from ClientEntity
ThrowIfDisposedOrNotOpen() ThrowIfDisposedOrNotOpen() ThrowIfDisposedOrNotOpen() Inherited from ClientEntity
ThrowIfFaulted() ThrowIfFaulted() ThrowIfFaulted() Inherited from ClientEntity

Extension Methods

IsDefined(Object) IsDefined(Object) IsDefined(Object)

Determines if a certain property is defined or not.

IsNull(Object) IsNull(Object) IsNull(Object)

Determines if a certain property is null or not.

IsPrimitive(Object) IsPrimitive(Object) IsPrimitive(Object)

Determines if a certain property is of premitive JSON type.

Applies to