Exemplo n.º 1
0
 public Sender(Func <CancellationToken, Task <DbConnection> > connectionFunc, HeadersBuilder headersBuilder, Table attachmentsTable, Table dedupeTable, ILogger logger)
 {
     this.connectionFunc = connectionFunc;
     attachments         = new Persister(new  NServiceBus.Attachments.Sql.Raw.Table(attachmentsTable.TableName, attachmentsTable.Schema, false));
     this.headersBuilder = headersBuilder;
     this.dedupeTable    = dedupeTable;
     this.logger         = logger;
 }
Exemplo n.º 2
0
 public Sender(Func <CancellationToken, Task <SqlConnection> > connectionFunc, HeadersBuilder headersBuilder, Table attachmentsTable, Table dedupeTable, ILogger logger)
 {
     this.connectionFunc = connectionFunc;
     attachments         = new(new(attachmentsTable.TableName, attachmentsTable.Schema, false));
     this.headersBuilder = headersBuilder;
     this.dedupeTable    = dedupeTable;
     this.logger         = logger;
 }
Exemplo n.º 3
0
    /// <summary>
    /// Add Sql HTTP Passthrough to an instance of <see cref="IServiceCollection"/>.
    /// Used from <code>Startup.ConfigureServices</code>.
    /// </summary>
    public static void AddSqlHttpPassthrough(
        this IServiceCollection services,
        PassthroughConfiguration configuration)
    {
        var headersBuilder = new HeadersBuilder(configuration.OriginatingEndpoint, configuration.OriginatingMachine);

        services.AddSingleton <ISqlPassthrough>(serviceProvider =>
        {
            var loggerFactory = serviceProvider.GetRequiredService <ILoggerFactory>();
            var logger        = loggerFactory.CreateLogger <ISqlPassthrough>();
            var sender        = new Sender(configuration.ConnectionFunc, headersBuilder, configuration.AttachmentsTable, configuration.DedupeTable, logger);
            return(new SqlPassthrough(configuration.SendCallback, sender, configuration.AppendClaims, configuration.ClaimsHeaderPrefix, logger));
        });
        var dedupService = new DedupService(configuration.DedupeTable, configuration.ConnectionFunc, configuration.DedupCriticalError);

        services.AddSingleton <IHostedService>(dedupService);
    }