/// <summary> /// Gets the <see cref="ICommunicationBridge"/> with the specified mode. /// </summary> /// <value> /// The <see cref="ICommunicationBridge"/>. /// </value> /// <param name="mode">The mode.</param> /// <returns></returns> /// <exception cref="NotSupportedException">Only queue is supported. Broadcast is not available on Azure Storage.</exception> public override ICommunicationBridge this[FabricMode mode] { get { throw new NotSupportedException(); } }
/// <summary> /// Gets the <see cref="ICommunicationBridge"/> with the specified mode. /// </summary> /// <value> /// The <see cref="ICommunicationBridge"/>. /// </value> /// <param name="mode">The mode.</param> /// <returns></returns> /// <exception cref="NotSupportedException">The communication bridge mode is not supported</exception> public override ICommunicationBridge this[FabricMode mode] { get { if (mode == FabricMode.NotSet) { throw new NotSupportedException("The communication bridge mode is not supported"); } return(mAgents.GetOrAdd(mode, (m) => new ManualCommunicationBridgeAgent(this, m, PayloadHistoryEnabled, RetryAttempts))); } }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="fabric">This is the connection fabric. If null, then a new fabric will be created.</param> /// <param name="mode">The desired communication mode.</param> /// <param name="payloadHistoryEnabled">This property specifies whether the message history should be maintained.</param> /// <param name="retryAttempts">This is the number of retry delivery attempts that should be attempted. Leave this null if not required.</param> protected internal ManualCommunicationBridgeAgent(ManualFabricBridge fabric, FabricMode mode , bool payloadHistoryEnabled = false , int?retryAttempts = null ) : base(mode) { Fabric = fabric ?? throw new ArgumentNullException("fabric"); mRetryAttempts = retryAttempts; PayloadHistoryEnabled = payloadHistoryEnabled; if (payloadHistoryEnabled) { mPayloadsHistory = new ConcurrentDictionary <Guid, TransmissionPayload>(); } }
/// <summary> /// Gets the <see cref="ICommunicationBridge"/> with the specified mode. /// </summary> /// <value> /// The <see cref="ICommunicationBridge"/>. /// </value> /// <param name="mode">The mode.</param> /// <returns></returns> /// <exception cref="BridgeAgentModeNotSetException"></exception> /// <exception cref="NotSupportedException"></exception> public override ICommunicationBridge this[FabricMode mode] { get { switch (mode) { case FabricMode.Broadcast: case FabricMode.Queue: return(new AzureEventHubsBridgeAgent()); case FabricMode.NotSet: throw new BridgeAgentModeNotSetException(); default: throw new NotSupportedException($"{mode.ToString()} is not supported."); } } }
/// <summary> /// Returns a communication bridge of the required type. /// </summary> /// <param name="mode">The communication mode.</param> /// <returns>The topic or queue bridge.</returns> public override IAzureServiceBusFabricBridge this[FabricMode mode] { get { switch (mode) { case FabricMode.Queue: return(new AzureServiceBusQueueBridgeAgent(Connection, DefaultReceiveMode, DefaultRetryPolicy)); case FabricMode.Broadcast: return(new AzureServiceBusTopicBridgeAgent(Connection, DefaultReceiveMode, DefaultRetryPolicy)); case FabricMode.NotSet: throw new BridgeAgentModeNotSetException(); default: throw new NotSupportedException($"{mode.ToString()} is not supported."); } } }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="mode">The desired communication mode.</param> /// <param name="payloadHistoryEnabled">This property specifies whether the message history should be maintained.</param> /// <param name="retryAttempts">This is the number of retry delivery attempts that should be attempted. Leave this null if not required.</param> protected internal ManualCommunicationBridgeAgent(FabricMode mode , bool payloadHistoryEnabled = false , int?retryAttempts = null ) : this(new ManualFabricBridge(), mode, payloadHistoryEnabled, retryAttempts) { }
/// <summary> /// This is the default constructor. /// </summary> /// <param name="mode">The operational mode.</param> protected CommunicationBridgeAgent(FabricMode mode = FabricMode.NotSet) { Mode = mode; }
/// <summary> /// Gets the <see cref="ICommunicationBridge"/> for the specified mode. /// </summary> /// <value> /// The <see cref="ICommunicationBridge"/>. /// </value> /// <param name="mode">The communication mode.</param> /// <returns>A bridge for the specific communication mode.</returns> public abstract B this[FabricMode mode] { get; }