public PartitionKeyMessageSendTopologyConvention(IPartitionKeyFormatter formatter) { if (formatter != null) { SetFormatter(formatter); } }
static void ConfigureAuditStore(IBusFactoryConfigurator configurator, CloudTable table, Action <IMessageFilterConfigurator> configureFilter = default, IPartitionKeyFormatter formatter = default) { var auditStore = new AzureTableAuditStore(table, formatter ?? new DefaultPartitionKeyFormatter()); configurator.ConnectSendAuditObservers(auditStore, configureFilter); configurator.ConnectConsumeAuditObserver(auditStore, configureFilter); }
/// <summary> /// Supply your storage account, table name, partition key strategy and message filter to be applied. /// </summary> /// <param name="configurator"></param> /// <param name="storageAccount">Your cloud storage account.</param> /// <param name="auditTableName">The name of the table for which the Audit Logs will be persisted.</param> /// <param name="partitionKeyFormatter"> /// Using the message type and audit information or otherwise, specify the partition key strategy /// </param> /// <param name="configureFilter">Message Filter to exclude or include messages from audit based on requirements</param> public static void UseAzureTableAuditStore(this IBusFactoryConfigurator configurator, CloudStorageAccount storageAccount, string auditTableName, IPartitionKeyFormatter partitionKeyFormatter, Action <IMessageFilterConfigurator> configureFilter) { var tableClient = storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference(auditTableName); table.CreateIfNotExists(); ConfigureAuditStore(configurator, table, configureFilter, partitionKeyFormatter); }
public MessagePartitionKeyFormatter(IPartitionKeyFormatter formatter) { _formatter = formatter; }
/// <summary> /// Supply your table, partition key strategy and message filter to be applied. /// </summary> /// <param name="configurator"></param> /// <param name="table">Your Azure Cloud Table</param> /// <param name="partitionKeyFormatter"> /// Using the message type and audit information or otherwise, specify the partition key strategy /// </param> /// <param name="configureFilter">Message Filter to exclude or include messages from audit based on requirements</param> public static void UseAzureTableAuditStore(this IBusFactoryConfigurator configurator, CloudTable table, IPartitionKeyFormatter partitionKeyFormatter, Action <IMessageFilterConfigurator> configureFilter) { ConfigureAuditStore(configurator, table, configureFilter, partitionKeyFormatter); }
static void ConfigureAuditStore(IBusObserverConnector configurator, CloudTable table, Action <IMessageFilterConfigurator> configureFilter = default, IPartitionKeyFormatter formatter = default) { configurator.ConnectBusObserver(new AzureTableAuditBusObserver(table, configureFilter, formatter ?? new DefaultPartitionKeyFormatter())); }
/// <summary> /// Supply your table and partition key strategy. No message filter will be applied /// </summary> /// <param name="configurator"></param> /// <param name="table">Your Azure Cloud Table</param> /// <param name="partitionKeyFormatter"> /// Using the message type and audit information or otherwise, specify the partition key strategy /// </param> public static void UseAzureTableAuditStore(this IBusFactoryConfigurator configurator, CloudTable table, IPartitionKeyFormatter partitionKeyFormatter) { ConfigureAuditStore(configurator, table, null, partitionKeyFormatter); }
public void SetFormatter(IPartitionKeyFormatter formatter) { _formatter = new MessagePartitionKeyFormatter <TMessage>(formatter); }
public AzureTableAuditStore(CloudTable table, IPartitionKeyFormatter partitionKeyFormatter) { _table = table; _partitionKeyFormatter = partitionKeyFormatter; }
public AzureTableAuditBusObserver(CloudTable table, Action <IMessageFilterConfigurator> filter, IPartitionKeyFormatter partitionKeyFormatter) { _table = table; _filter = filter; _partitionKeyFormatter = partitionKeyFormatter; }
internal static AuditRecord Create <T>(T message, MessageAuditMetadata metadata, IPartitionKeyFormatter partitionKeyFormatter) where T : class { var record = new AuditRecord { RowKey = $"{DateTime.MaxValue.Subtract(metadata.SentTime ?? DateTime.UtcNow).TotalMilliseconds}", ContextType = metadata.ContextType, MessageId = metadata.MessageId, ConversationId = metadata.ConversationId, CorrelationId = metadata.CorrelationId, InitiatorId = metadata.InitiatorId, RequestId = metadata.RequestId, SentTime = metadata.SentTime, SourceAddress = metadata.SourceAddress, InputAddress = metadata.InputAddress, DestinationAddress = metadata.DestinationAddress, ResponseAddress = metadata.ResponseAddress, FaultAddress = metadata.FaultAddress, Headers = JsonConvert.SerializeObject(metadata.Headers), Custom = JsonConvert.SerializeObject(metadata.Custom), Message = JsonConvert.SerializeObject(message), MessageType = TypeMetadataCache <T> .ShortName }; record.PartitionKey = SanitizePartitionKey(partitionKeyFormatter.Format <T>(record)); return(record); }