public AzureServiceBusReceiver( string azureServiceBusConnectionString, string serviceBusTopic, string serviceBusSubscription, ISqlTransactionalOutboxItemFactory <TUniqueIdentifier, TPayload> outboxItemFactory, AzureServiceBusReceivingOptions options = null ) : this(InitAzureServiceBusConnection(azureServiceBusConnectionString, options), serviceBusTopic, serviceBusSubscription, outboxItemFactory, options) { DisposingEnabled = true; }
/// <summary> /// Initialize a received item with all Sql Transactional Outbox data. The resulting item will /// allow for specific handling of the Message Acknowledgement/Rejection/Dead-lettering just as. /// the ProcessMessageEventArgs allow... /// </summary> /// <param name="messageEventArgs"></param> /// <param name="outboxItemFactory"></param> public AzureServiceBusReceivedItem( ProcessMessageEventArgs messageEventArgs, ISqlTransactionalOutboxItemFactory <TUniqueIdentifier, TPayloadBody> outboxItemFactory ) { this.MessageEventArgs = messageEventArgs.AssertNotNull(nameof(messageEventArgs)); this.AzureServiceBusMessage = messageEventArgs.Message; this.OutboxItemFactory = outboxItemFactory.AssertNotNull(nameof(outboxItemFactory)); this.InitAzureServiceBusOutboxReceivedItem(isFifoProcessingEnabled: false); }
public DefaultAzureServiceBusReceivedItem( ServiceBusReceivedMessage azureServiceBusMessage, ISqlTransactionalOutboxItemFactory <Guid, TPayloadBody> outboxItemFactory = null, //Client is OPTIONAL; necessary when processing will be handled by AzureFunctions framework bindings, etc. ServiceBusReceiver azureServiceBusReceiverClient = null ) : base( azureServiceBusMessage: azureServiceBusMessage, outboxItemFactory: outboxItemFactory ?? new DefaultOutboxItemFactory <TPayloadBody>(), azureServiceBusReceiverClient: azureServiceBusReceiverClient ) { }
public AzureServiceBusReceiver( ServiceBusClient azureServiceBusClient, string serviceBusTopic, string serviceBusSubscription, ISqlTransactionalOutboxItemFactory <TUniqueIdentifier, TPayload> outboxItemFactory, AzureServiceBusReceivingOptions options = null ) { this.Options = options ?? new AzureServiceBusReceivingOptions(); this.AzureServiceBusClient = azureServiceBusClient.AssertNotNull(nameof(azureServiceBusClient)); this.OutboxItemFactory = outboxItemFactory.AssertNotNull(nameof(outboxItemFactory)); this.ServiceBusTopic = serviceBusTopic.AssertNotNullOrWhiteSpace(nameof(serviceBusTopic)); this.ServiceBusSubscription = serviceBusSubscription.AssertNotNullOrWhiteSpace(nameof(serviceBusSubscription)); }
public DefaultSqlServerOutboxRepository( SqlTransaction sqlTransaction, ISqlTransactionalOutboxTableConfig outboxTableConfig = null, ISqlTransactionalOutboxItemFactory <Guid, TPayload> outboxItemFactory = null, int distributedMutexAcquisitionTimeoutSeconds = Defaults.DistributedMutexAcquisitionTimeoutSeconds ) : base( sqlTransaction: sqlTransaction, outboxTableConfig: outboxTableConfig ?? new OutboxTableConfig(), outboxItemFactory: outboxItemFactory ?? new DefaultOutboxItemFactory <TPayload>(), distributedMutexAcquisitionTimeoutSeconds ) { //Preconfigured defaults are used in base constructor above... }
protected void Init( ISqlTransactionalOutboxTableConfig outboxTableConfig, ISqlTransactionalOutboxItemFactory <TUniqueIdentifier, TPayload> outboxItemFactory, int distributedMutexAcquisitionTimeoutSeconds = Defaults.DistributedMutexAcquisitionTimeoutSeconds ) { //Possible Dependencies OutboxTableConfig = outboxTableConfig.AssertNotNull(nameof(outboxTableConfig)); OutboxItemFactory = outboxItemFactory.AssertNotNull(nameof(outboxItemFactory)); //Default Known setup for Sql Server... QueryBuilder = new SqlServerTransactionalOutboxQueryBuilder <TUniqueIdentifier>(outboxTableConfig); DistributedMutexLockName = $"SqlServerTransactionalOutboxProcessor::{QueryBuilder.BuildTableName()}"; DistributedMutexAcquisitionTimeoutSeconds = distributedMutexAcquisitionTimeoutSeconds; }
/// <summary> /// Initialize a received item with all Sql Transactional Outbox data. The resulting item will /// allow for specific handling of the Message Acknowledgement/Rejection/Dead-lettering if the correct Reciever is provided. /// NOTE: With Azure Functions there is no client when used with Function Bindings because this is handled /// by the Azure Functions framework when the Message is returned, so this should be a No-op if null/not-specified! /// </summary> /// <param name="azureServiceBusMessage"></param> /// <param name="outboxItemFactory"></param> /// <param name="azureServiceBusReceiverClient"></param> public AzureServiceBusReceivedItem( ServiceBusReceivedMessage azureServiceBusMessage, ISqlTransactionalOutboxItemFactory <TUniqueIdentifier, TPayloadBody> outboxItemFactory, //Client is OPTIONAL; necessary when processing will be handled by AzureFunctions framework bindings, etc. ServiceBusReceiver azureServiceBusReceiverClient = null ) { //Provide access to the original Azure Service Bus Message for customized Advanced functionality. this.AzureServiceBusMessage = azureServiceBusMessage.AssertNotNull(nameof(azureServiceBusMessage)); this.ServiceBusReceiver = azureServiceBusReceiverClient; this.OutboxItemFactory = outboxItemFactory.AssertNotNull(nameof(outboxItemFactory)); bool isFifoProcessingEnabled = azureServiceBusReceiverClient is ServiceBusSessionReceiver; this.InitAzureServiceBusOutboxReceivedItem(isFifoProcessingEnabled); }
public DefaultAzureServiceBusReceiver( string azureServiceBusConnectionString, string serviceBusTopic, string serviceBusSubscription, ISqlTransactionalOutboxItemFactory <Guid, TPayload> outboxItemFactory = null, AzureServiceBusReceivingOptions options = null ) : base( azureServiceBusConnectionString, serviceBusTopic, serviceBusSubscription, outboxItemFactory ?? new DefaultOutboxItemFactory <TPayload>(), options ) { }
public SqlServerOutboxRepository( SqlTransaction sqlTransaction, ISqlTransactionalOutboxTableConfig outboxTableConfig = null, ISqlTransactionalOutboxItemFactory <TUniqueIdentifier, TPayload> outboxItemFactory = null, int distributedMutexAcquisitionTimeoutSeconds = Defaults.DistributedMutexAcquisitionTimeoutSeconds ) { SqlTransaction = sqlTransaction ?? throw new ArgumentNullException(nameof(sqlTransaction), "A valid SqlTransaction must be provided for Sql Transactional Outbox processing."); SqlConnection = sqlTransaction.Connection ?? throw new ArgumentNullException(nameof(SqlConnection), "The SqlTransaction specified must have a valid SqlConnection."); base.Init( outboxTableConfig: outboxTableConfig.AssertNotNull(nameof(outboxTableConfig)), outboxItemFactory: outboxItemFactory.AssertNotNull(nameof(outboxItemFactory)), distributedMutexAcquisitionTimeoutSeconds ); }