MessageSender Class

Definition

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

public abstract class MessageSender : Microsoft.ServiceBus.Messaging.ClientEntity
Inheritance
MessageSender

Remarks

Please note 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<object> Issues = new List<object>();
         foreach (var issue in Issues)
         {
         myMessageSender.Send(new BrokeredMessage(issue));
         }
         </code></pre></example><example><pre><code>
         //********************************************************************************
         //                           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();
         }
         </code></pre></example>

Properties

BatchFlushInterval

Gets the batch flush interval.

BatchingEnabled

Gets a value indicating whether the batching is enabled.

Path

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

SupportsGetRuntimeEntityDescription

Methods

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

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

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)

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)

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.

OnEndCancelScheduledMessage(IAsyncResult)

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

OnEndScheduleMessage(IAsyncResult)

Raises an event when ending the message schedule.

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)

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.

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)

Sends the specified brokered message.

SendAsync(BrokeredMessage)

Asynchronously sends the specified brokered message.

SendBatch(IEnumerable<BrokeredMessage>)

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

SendBatchAsync(IEnumerable<BrokeredMessage>)

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

Abort() Inherited from ClientEntity
Close() Inherited from ClientEntity
CloseAsync() Inherited from ClientEntity
Fault() Inherited from ClientEntity
IsClosed Inherited from ClientEntity
OnAbort() Inherited from ClientEntity
OnBeginClose(TimeSpan, AsyncCallback, Object) Inherited from ClientEntity
OnBeginOpen(TimeSpan, AsyncCallback, Object) Inherited from ClientEntity
OnClose(TimeSpan) Inherited from ClientEntity
OnClosed() Inherited from ClientEntity
OnEndClose(IAsyncResult) Inherited from ClientEntity
OnEndOpen(IAsyncResult) Inherited from ClientEntity
OnFaulted() Inherited from ClientEntity
OnOpen(TimeSpan) Inherited from ClientEntity
OnOpened() Inherited from ClientEntity
RetryPolicy Inherited from ClientEntity
ThisLock Inherited from ClientEntity
ThrowIfClosed() Inherited from ClientEntity
ThrowIfDisposed() Inherited from ClientEntity
ThrowIfDisposedOrImmutable() Inherited from ClientEntity
ThrowIfDisposedOrNotOpen() Inherited from ClientEntity
ThrowIfFaulted() Inherited from ClientEntity

Extension Methods

IsDefined(Object)

Determines if a certain property is defined or not.

IsNull(Object)

Determines if a certain property is null or not.

IsPrimitive(Object)

Determines if a certain property is of premitive JSON type.

Applies to